Package 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 | Description
    --- | --- | ---
    `protected MonitorComponent` | `component` |
    `protected static TimestampHelper` | `dtf` |
    `protected EventBus` | `eventBus` |
    `protected static java.util.logging.Logger` | `log` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `ConnectionsTask()` |

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `static Element` | `createAlarmEvent​(int currentOnlineUsers, int lastOnlineUsers, int thresholdMinimal, int threshold)` | Deprecated.
    `static java.util.Optional<tigase.monitor.tasks.ConnectionsTask.UserDisconnectedEvent>` | `createUserDisconnectedEvent​(int currentOnlineUsers, int lastOnlineUsers, int thresholdMinimal, int threshold)` |
    `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 java.util.logging.Logger log

    - #### component

          @Inject
          protected MonitorComponent component

    - #### eventBus

          @Inject
          protected EventBus eventBus

  - ### Constructor Detail

    - #### ConnectionsTask

          public ConnectionsTask()

  - ### Method Detail

    - #### createAlarmEvent

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

      Deprecated.
      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`.

    - #### createUserDisconnectedEvent

          public static java.util.Optional<tigase.monitor.tasks.ConnectionsTask.UserDisconnectedEvent> createUserDisconnectedEvent​(int currentOnlineUsers,
                                                                                                                                   int lastOnlineUsers,
                                                                                                                                   int thresholdMinimal,
                                                                                                                                   int threshold)

    - #### 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`
      Overrides:
        `initialize` in class `AbstractConfigurableTask`

    - #### 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`