Class ServiceActivatorDeviceWorker
java.lang.Object
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
Modifier and TypeFieldDescriptionprotected long
protected long
protected long
protected long
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
ConstructorDescriptionServiceActivatorDeviceWorker
(ru.bitel.bgbilling.apps.inet.access.Access access, ScheduledExecutorService scheduledExecutorService, int deviceId, long fetchDelay, long fetchTimeout) -
Method Summary
Modifier and TypeMethodDescriptionВыполнение отдельной задачи.void
execute()
int
ru.bitel.bgbilling.modules.inet.server.runtime.device.InetDeviceRuntime
protected void
processDoTaskException
(Object task, boolean inDoTask, boolean putFirstIfInDoTask, ru.bitel.bgbilling.common.BGException ex, boolean throwException) final void
protected void
runImpl()
protected boolean
Вызывается, когда появляются задачи.void
void
start()
protected void
protected void
taskTimeout
(Object task) 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
-
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
-
getDeviceId
public int getDeviceId() -
getDeviceRuntime
public ru.bitel.bgbilling.modules.inet.server.runtime.device.InetDeviceRuntime getDeviceRuntime() -
start
public void start() -
runImpl
- Overrides:
runImpl
in classEventWorker
- Throws:
Exception
-
execute
public void execute() -
runWorker
protected boolean runWorker() throws ru.bitel.bgbilling.common.BGExceptionDescription copied from class:EventWorker
Вызывается, когда появляются задачи. Внутри данного метода нужно вызватьEventWorker.doTasks()
, который выполняет последовательно появившиеся задачи. А перед и после вызоваEventWorker.doTasks()
можно инициализировать и освободить DAO.- Specified by:
runWorker
in classEventWorker
- Returns:
- Throws:
ru.bitel.bgbilling.common.BGException
-
putLast
- Overrides:
putLast
in classAsyncEventWorker<ru.bitel.bgbilling.kernel.event.common.Event>
- Throws:
InterruptedException
-
doTask
Выполнение отдельной задачи. Очень важная часть - правильная реакция на события.- Specified by:
doTask
in classEventWorker
- Returns:
- обычно null.
- Throws:
ru.bitel.bgbilling.common.BGException
-
taskDone
- Specified by:
taskDone
in classAsyncEventWorker<ru.bitel.bgbilling.kernel.event.common.Event>
- Throws:
ru.bitel.bgbilling.common.BGException
-
toString
-
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 classAsyncEventWorker<ru.bitel.bgbilling.kernel.event.common.Event>
inDoTask
- ошибка произошла в doTask или позже- Throws:
ru.bitel.bgbilling.common.BGException
-
taskTimeout
- Overrides:
taskTimeout
in classAsyncEventWorker<ru.bitel.bgbilling.kernel.event.common.Event>
-