public abstract class EventWorker extends ru.bitel.common.worker.WorkerTask<EventListenerContext> implements EventListener<Event>
| Modifier and Type | Field and Description |
|---|---|
protected long |
batchWait
Сколько ждать следующего задания/события, прежде чем прекратить цикл (прекратить
doTasks()), в мс. |
protected ru.bitel.bgbilling.kernel.event.AbstractConsumer |
consumer |
protected long |
errorPause
Длительность паузы после возникновения ошибки, в мс.
|
protected int |
moduleId |
protected boolean |
working |
| Modifier | Constructor and Description |
|---|---|
|
EventWorker(EventProcessor ep,
java.lang.Class<? extends Event> clazz,
int moduleId,
int pluginId,
java.lang.String query) |
|
EventWorker(EventProcessor ep,
java.lang.String destination,
int moduleId,
int pluginId,
java.lang.String query,
boolean autoAcknowledge,
java.lang.Class<?>... clazz) |
protected |
EventWorker(int moduleId) |
| Modifier and Type | Method and Description |
|---|---|
abstract java.lang.Object |
doTask(java.lang.Object task)
Выполнение одной задачи (события).
|
boolean |
doTasks()
Выполнение задач (одной или нескольких, с ожиданием новых в течении
batchWait), нужно вызывать из runWorker(). |
protected boolean |
internalDoTask(java.lang.Object task) |
protected int |
internalRunWorker(long timeout,
boolean wait) |
void |
notify(Event e,
EventListenerContext ctx) |
protected java.lang.Object |
poll(long timeout) |
protected java.lang.Object |
pollFirstTask() |
protected void |
runImpl() |
protected abstract boolean |
runWorker()
Вызывается, когда появляются задачи.
|
void |
setConsumer(java.lang.Class<? extends Event> clazz,
java.lang.String query) |
void |
shutdown() |
protected ru.bitel.bgbilling.kernel.event.AbstractConsumer consumer
protected long batchWait
doTasks()), в мс.protected long errorPause
protected volatile boolean working
protected final int moduleId
protected EventWorker(int moduleId)
throws ru.bitel.bgbilling.common.BGException
ru.bitel.bgbilling.common.BGExceptionpublic EventWorker(EventProcessor ep, java.lang.Class<? extends Event> clazz, int moduleId, int pluginId, java.lang.String query) throws ru.bitel.bgbilling.common.BGException
ru.bitel.bgbilling.common.BGExceptionpublic EventWorker(EventProcessor ep, java.lang.String destination, int moduleId, int pluginId, java.lang.String query, boolean autoAcknowledge, java.lang.Class<?>... clazz) throws ru.bitel.bgbilling.common.BGException
ru.bitel.bgbilling.common.BGExceptionpublic void setConsumer(java.lang.Class<? extends Event> clazz, java.lang.String query) throws ru.bitel.bgbilling.common.BGException
ru.bitel.bgbilling.common.BGExceptionprotected void runImpl()
throws java.lang.Exception
runImpl in class ru.bitel.common.worker.WorkerTask<EventListenerContext>java.lang.Exceptionprotected int internalRunWorker(long timeout,
boolean wait)
timeout - wait - protected java.lang.Object pollFirstTask()
protected java.lang.Object poll(long timeout)
throws ru.bitel.bgbilling.common.BGException
ru.bitel.bgbilling.common.BGExceptionpublic boolean doTasks()
throws ru.bitel.bgbilling.common.BGException
batchWait), нужно вызывать из runWorker().ru.bitel.bgbilling.common.BGExceptionprotected boolean internalDoTask(java.lang.Object task)
throws javax.jms.JMSException,
javax.xml.bind.JAXBException,
ru.bitel.bgbilling.common.BGException
javax.jms.JMSExceptionjavax.xml.bind.JAXBExceptionru.bitel.bgbilling.common.BGExceptionprotected abstract boolean runWorker()
throws ru.bitel.bgbilling.common.BGException
doTasks(), который выполняет последовательно появившиеся задачи.
А перед и после вызова doTasks() можно инициализировать и освободить DAO.ru.bitel.bgbilling.common.BGExceptionpublic void notify(Event e, EventListenerContext ctx) throws ru.bitel.bgbilling.common.BGException
notify in interface EventListener<Event>ru.bitel.bgbilling.common.BGExceptionpublic abstract java.lang.Object doTask(java.lang.Object task)
throws ru.bitel.bgbilling.common.BGException
task - ru.bitel.bgbilling.common.BGExceptionpublic void shutdown()
throws ru.bitel.bgbilling.common.BGException
ru.bitel.bgbilling.common.BGException