tigase.monitor.tasks

## Class ConnectionsTask

- java.lang.Object
- - tigase.monitor.tasks.AbstractConfigurableTask
  - - tigase.monitor.tasks.AbstractConfigurableTimerTask
    - - tigase.monitor.tasks.ConnectionsTask

- All Implemented Interfaces:
    Initializable, UnregisterAware, ConfigurableTask, InfoTask, MonitorTask

      @Bean(name="connections-task",
            parent=MonitorComponent.class,
            active=true)
      public class ConnectionsTask
      extends AbstractConfigurableTimerTask
      implements InfoTask, Initializable

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected MonitorComponent` | `component`
    `protected static TimestampHelper` | `dtf`
    `protected EventBus` | `eventBus`
    `protected static Logger` | `log`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ConnectionsTask()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static Element` | `createAlarmEvent(int currentOnlineUsers, int lastOnlineUsers, int thresholdMinimal, int threshold)` Creates alarm event if required.
    `Form` | `getCurrentConfiguration()`
    `Form` | `getTaskInfo()`
    `int` | `getThreshold()`
    `int` | `getThresholdMinimal()`
    `void` | `initialize()` Method will be called, when bean will be created, configured and ready to use.
    `protected void` | `run()`
    `void` | `setNewConfiguration(Form form)`
    `void` | `setThreshold(int threshold)`
    `void` | `setThresholdMinimal(int thresholdMinimal)`

    - ### Methods inherited from class tigase.monitor.tasks.AbstractConfigurableTimerTask

      `beforeUnregister, disable, enable, getPeriod, getTimerTaskService, setPeriod, setTimerTaskService`

    - ### Methods inherited from class tigase.monitor.tasks.AbstractConfigurableTask

      `isEnabled, setEnabled`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### dtf

          protected static final TimestampHelper dtf

    - #### log

          protected static final Logger log

    - #### component

          @Inject
          protected MonitorComponent component

    - #### eventBus

          @Inject
          protected EventBus eventBus

  - ### Constructor Detail

    - #### ConnectionsTask

          public ConnectionsTask()

  - ### Method Detail

    - #### createAlarmEvent

          public static Element createAlarmEvent(int currentOnlineUsers,
                                                 int lastOnlineUsers,
                                                 int thresholdMinimal,
                                                 int threshold)

      Creates alarm event if required. Event will be created only if both conditions will met.
      Parameters:
        `currentOnlineUsers` - current amount of online users.
        `lastOnlineUsers` - previous amount of online users.
        `thresholdMinimal` - minimal amount of disconnected users to create alarm event.
        `threshold` - percent of disconnected users to create alarm event.
      Returns:
        event or `null`.

    - #### getCurrentConfiguration

          public Form getCurrentConfiguration()

      Specified by:
        `getCurrentConfiguration` in interface `ConfigurableTask`
      Overrides:
        `getCurrentConfiguration` in class `AbstractConfigurableTimerTask`

    - #### getTaskInfo

          public Form getTaskInfo()

      Specified by:
        `getTaskInfo` in interface `InfoTask`

    - #### getThreshold

          public int getThreshold()

    - #### setThreshold

          public void setThreshold(int threshold)

    - #### getThresholdMinimal

          public int getThresholdMinimal()

    - #### setThresholdMinimal

          public void setThresholdMinimal(int thresholdMinimal)

    - #### initialize

          public void initialize()

      Description copied from interface: `Initializable`
      Method will be called, when bean will be created, configured and ready to use.
      Specified by:
        `initialize` in interface `Initializable`

    - #### setNewConfiguration

          public void setNewConfiguration(Form form)

      Specified by:
        `setNewConfiguration` in interface `ConfigurableTask`
      Overrides:
        `setNewConfiguration` in class `AbstractConfigurableTimerTask`

    - #### run

          protected void run()

      Specified by:
        `run` in class `AbstractConfigurableTimerTask`

Copyright © 2004–2019 "Tigase, Inc.". All rights reserved.