Package ru.bitel.bgbilling.apps.inet.access.sa

# Class ServiceActivatorDeviceWorker

java.lang.Object
ru.bitel.bgbilling.kernel.base.server.logger.BGLogger
ru.bitel.common.worker.WorkerTask<EventListenerContext>
ru.bitel.bgbilling.kernel.event.EventWorker
ru.bitel.bgbilling.kernel.event.AsyncEventWorker<ru.bitel.bgbilling.kernel.event.common.Event>
ru.bitel.bgbilling.apps.inet.access.sa.ServiceActivatorDeviceWorker

All Implemented Interfaces:
  `Runnable`, `EventListener<ru.bitel.bgbilling.kernel.event.common.Event>`

public class ServiceActivatorDeviceWorker extends AsyncEventWorker<ru.bitel.bgbilling.kernel.event.common.Event>

- ## Nested Class Summary

  ## Nested classes/interfaces inherited from class ru.bitel.common.worker.WorkerTask

  `ru.bitel.common.worker.WorkerTask.BlockingExecutionHandler`

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected long`
  `connectErrorCount`
  `protected long`
  `errorAlarmCount`
  `protected long`
  `errorRedeliveryCount`
  `protected long`
  `errorRedeliveryTimeout`

  ### Fields inherited from class ru.bitel.bgbilling.kernel.event.AsyncEventWorker

  `batchPause, batchSize, errorCount, needAcknowledge, waitNextTask`

  ### Fields inherited from class ru.bitel.bgbilling.kernel.event.EventWorker

  `batchWait, consumer, errorPause, moduleId, working`

  ### Fields inherited from class ru.bitel.common.worker.WorkerTask

  `context`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ServiceActivatorDeviceWorker(ru.bitel.bgbilling.apps.inet.access.Access access, ScheduledExecutorService scheduledExecutorService, int deviceId, long fetchDelay, long fetchTimeout)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Object`
  `doTask(Object task)`
  Выполнение отдельной задачи.
  `void`
  `execute()`
  `int`
  `getDeviceId()`
  `ru.bitel.bgbilling.modules.inet.server.runtime.device.InetDeviceRuntime`
  `getDeviceRuntime()`
  `protected void`
  `processDoTaskException(Object task, boolean inDoTask, boolean putFirstIfInDoTask, ru.bitel.bgbilling.common.BGException ex, boolean throwException)`
  `final void`
  `putLast(Object task)`
  `protected void`
  `runImpl()`
  `protected boolean`
  `runWorker()`
  Вызывается, когда появляются задачи.
  `void`
  `skipEvent()`
  `void`
  `start()`
  `protected void`
  `taskDone(Object task, Object result)`
  `protected void`
  `taskTimeout(Object task)`
  `String`
  `toString()`

  ### Methods inherited from class ru.bitel.bgbilling.kernel.event.AsyncEventWorker

  `doTasks, internalDoTask, notify, poll, putFirst`

  ### Methods inherited from class ru.bitel.bgbilling.kernel.event.EventWorker

  `internalRunWorker, pollFirstTask, setConsumer, shutdown`

  ### Methods inherited from class ru.bitel.common.worker.WorkerTask

  `newBlockingFixedThreadPool, newFixedThreadPool, newFixedThreadPool, newScheduledThreadPool, run, runSync, runSync, setContext`

  ### Methods inherited from class ru.bitel.bgbilling.kernel.base.server.logger.BGLogger

  `error, error, error, getLogger, logError, logError, warn`

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

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

- ## Field Details

  - ### errorAlarmCount

    protected long errorAlarmCount

  - ### errorRedeliveryCount

    protected long errorRedeliveryCount

  - ### errorRedeliveryTimeout

    protected long errorRedeliveryTimeout

  - ### connectErrorCount

    protected long connectErrorCount

- ## Constructor Details

  - ### ServiceActivatorDeviceWorker

    public ServiceActivatorDeviceWorker(ru.bitel.bgbilling.apps.inet.access.Access access, ScheduledExecutorService scheduledExecutorService, int deviceId, long fetchDelay, long fetchTimeout) throws ru.bitel.bgbilling.common.BGException
    Throws:
      `ru.bitel.bgbilling.common.BGException`

- ## Method Details

  - ### start

    public void start()

  - ### getDeviceId

    public int getDeviceId()

  - ### getDeviceRuntime

    public ru.bitel.bgbilling.modules.inet.server.runtime.device.InetDeviceRuntime getDeviceRuntime()

  - ### runImpl

    protected void runImpl() throws Exception
    Overrides:
      `runImpl` in class `EventWorker`
    Throws:
      `Exception`

  - ### execute

    public void execute()

  - ### runWorker

    protected boolean runWorker() throws ru.bitel.bgbilling.common.BGException
    Description copied from class: `EventWorker`
    Вызывается, когда появляются задачи. Внутри данного метода нужно вызвать `EventWorker.doTasks()`, который выполняет последовательно появившиеся задачи. А перед и после вызова `EventWorker.doTasks()` можно инициализировать и освободить DAO.
    Specified by:
      `runWorker` in class `EventWorker`
    Returns:
    Throws:
      `ru.bitel.bgbilling.common.BGException`

  - ### putLast

    public final void putLast(Object task) throws InterruptedException
    Overrides:
      `putLast` in class `AsyncEventWorker<ru.bitel.bgbilling.kernel.event.common.Event>`
    Throws:
      `InterruptedException`

  - ### doTask

    public Object doTask(Object task) throws ru.bitel.bgbilling.common.BGException
    Выполнение отдельной задачи. Очень важная часть - правильная реакция на события.
    Specified by:
      `doTask` in class `EventWorker`
    Parameters:
      `task` -
    Returns:
      обычно null.
    Throws:
      `ru.bitel.bgbilling.common.BGException`

  - ### taskDone

    protected void taskDone(Object task, Object result) throws ru.bitel.bgbilling.common.BGException
    Specified by:
      `taskDone` in class `AsyncEventWorker<ru.bitel.bgbilling.kernel.event.common.Event>`
    Throws:
      `ru.bitel.bgbilling.common.BGException`

  - ### toString

    public String toString()
    Overrides:
      `toString` in class `Object`

  - ### skipEvent

    public void skipEvent()

  - ### processDoTaskException

    protected void processDoTaskException(Object task, boolean inDoTask, boolean putFirstIfInDoTask, ru.bitel.bgbilling.common.BGException ex, boolean throwException) throws ru.bitel.bgbilling.common.BGException
    Overrides:
      `processDoTaskException` in class `AsyncEventWorker<ru.bitel.bgbilling.kernel.event.common.Event>`
    Parameters:
      `task` -
      `inDoTask` - ошибка произошла в doTask или позже
      `putFirstIfInDoTask` -
      `ex` -
      `throwException` -
    Throws:
      `ru.bitel.bgbilling.common.BGException`

  - ### taskTimeout

    protected void taskTimeout(Object task)
    Overrides:
      `taskTimeout` in class `AsyncEventWorker<ru.bitel.bgbilling.kernel.event.common.Event>`