private ConsumerCallbackResult submitBatch(long curNanos, boolean barrierBefore,
boolean barrierAfter)
{
++_runCallsCounter;
ConsumerCallbackResult retValue = ConsumerCallbackResult.SUCCESS;
if (0 >= curNanos) curNanos = System.nanoTime();
try
{
if (barrierBefore) retValue = flushCallQueue(curNanos);
if (ConsumerCallbackResult.isSuccess(retValue))
{
String batchName = _currentBatch.size() > 0 ? _currentBatch.get(0).getClass().getSimpleName()
: "";
for (ConsumerCallable<ConsumerCallbackResult> call: _currentBatch)
{
Future<ConsumerCallbackResult> future = _executorService.submit(call);
_submittedCalls.add(new TimestampedFuture<ConsumerCallbackResult>(call, future,
batchName, ++_runCallsCounter));
}
}
_currentBatch.clear();
if (ConsumerCallbackResult.isSuccess(retValue))
{
ConsumerCallbackResult retValue2 = barrierAfter ? flushCallQueue(curNanos)
: cleanUpCallQueue(curNanos);
retValue = ConsumerCallbackResult.max(retValue, retValue2);
}
}
catch (RuntimeException e)