tigase.monitor.tasks

## Class ConnectionsTask

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

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

      @Bean(name="connections-task")
      public class ConnectionsTask
      extends AbstractConfigurableTimerTask
      implements InfoTask

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected MonitorComponent` | `component`
    `protected static DateTimeFormatter` | `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()`
    `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, 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 DateTimeFormatter 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)

    - #### run

          protected void run()

      Specified by:
        `run` in class `AbstractConfigurableTimerTask`

    - #### setNewConfiguration

          public void setNewConfiguration(Form form)

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

Copyright © 2022 "Tigase, Inc.". All rights reserved.