E
- public abstract class AsyncEventWorker<E extends Event> extends EventWorker
Modifier and Type | Field and Description |
---|---|
protected long |
batchPause |
protected int |
batchSize |
protected long |
errorCount |
protected boolean |
needAcknowledge |
protected long |
waitNextTask |
batchWait, consumer, errorPause, moduleId, working
Constructor and Description |
---|
AsyncEventWorker(EventProcessor ep,
java.lang.Class<? extends Event> clazz,
int moduleId,
int pluginId,
java.lang.String query) |
AsyncEventWorker(EventProcessor ep,
java.lang.String destination,
int moduleId,
int pluginId,
java.lang.String query,
boolean autoAcknowledge,
java.lang.Class<?>... clazz) |
Modifier and Type | Method and Description |
---|---|
boolean |
doTasks()
Выполнение задач (одной или нескольких, с ожиданием новых в течении
EventWorker.batchWait ), нужно вызывать из EventWorker.runWorker() . |
protected boolean |
internalDoTask(java.lang.Object task) |
void |
notify(Event task,
EventListenerContext ctx) |
protected java.lang.Object |
poll(long timeout) |
protected void |
processDoTaskException(java.lang.Object task,
boolean inDoTask,
boolean putFirstIfInDoTask,
ru.bitel.bgbilling.common.BGException ex,
boolean throwException) |
protected void |
putFirst(java.lang.Object task) |
protected void |
putLast(java.lang.Object task) |
protected abstract void |
taskDone(java.lang.Object task,
java.lang.Object result) |
protected void |
taskTimeout(java.lang.Object task) |
doTask, internalRunWorker, pollFirstTask, runImpl, runWorker, setConsumer, shutdown
protected long waitNextTask
protected int batchSize
protected long batchPause
protected final boolean needAcknowledge
protected long errorCount
public AsyncEventWorker(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.BGException
public AsyncEventWorker(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.BGException
protected java.lang.Object poll(long timeout) throws ru.bitel.bgbilling.common.BGException
poll
in class EventWorker
ru.bitel.bgbilling.common.BGException
protected void putFirst(java.lang.Object task) throws java.lang.InterruptedException
java.lang.InterruptedException
protected void putLast(java.lang.Object task) throws java.lang.InterruptedException
java.lang.InterruptedException
public boolean doTasks() throws ru.bitel.bgbilling.common.BGException
EventWorker
EventWorker.batchWait
), нужно вызывать из EventWorker.runWorker()
.doTasks
in class EventWorker
ru.bitel.bgbilling.common.BGException
protected boolean internalDoTask(java.lang.Object task) throws javax.jms.JMSException, javax.xml.bind.JAXBException, ru.bitel.bgbilling.common.BGException
internalDoTask
in class EventWorker
javax.jms.JMSException
javax.xml.bind.JAXBException
ru.bitel.bgbilling.common.BGException
public void notify(Event task, EventListenerContext ctx) throws ru.bitel.bgbilling.common.BGException
notify
in interface EventListener<Event>
notify
in class EventWorker
ru.bitel.bgbilling.common.BGException
protected void processDoTaskException(java.lang.Object task, boolean inDoTask, boolean putFirstIfInDoTask, ru.bitel.bgbilling.common.BGException ex, boolean throwException) throws ru.bitel.bgbilling.common.BGException
task
- inDoTask
- ошибка произошла в doTask или позжеputFirstIfInDoTask
- ex
- throwException
- ru.bitel.bgbilling.common.BGException
protected abstract void taskDone(java.lang.Object task, java.lang.Object result) throws ru.bitel.bgbilling.common.BGException
ru.bitel.bgbilling.common.BGException
protected void taskTimeout(java.lang.Object task)