getLocalNodeId(),
HexDumper.toHexString(channel.channelRefId));
}
ChannelServiceImpl channelService =
ChannelServiceImpl.getInstance();
DataService dataService = getDataService();
/*
* Process channel events
*/
int eventsPerTxn = channelService.eventsPerTxn;
ManagedQueue<ChannelEvent> eventQueue = getQueue();
boolean completed = false;
do {
ChannelEvent event = eventQueue.peek();
if (event == null) {
// No more events to process, so return.
if (logger.isLoggable(Level.FINEST)) {
logger.log(Level.FINEST,
"coordinator:{0} channelId:{1} " +
"no more events",
getLocalNodeId(),
HexDumper.toHexString(channel.channelRefId));
}
return;
} else if (event.isCompleted()) {
// Remove completed event and get next event to
// process. Return if there are no more events.
if (logger.isLoggable(Level.FINEST)) {
logger.log(Level.FINEST,
"coordinator:{0} channelId:{1} " +
"removing completed event:{2}",
getLocalNodeId(),
HexDumper.toHexString(channel.channelRefId),
event);
}
eventQueue.poll();
event = eventQueue.peek();
if (event == null) {
if (logger.isLoggable(Level.FINEST)) {
logger.log(Level.FINEST,
"coordinator:{0} channelId:{1} " +
"no more events",
getLocalNodeId(),
HexDumper.toHexString(
channel.channelRefId));
}
return;
}
} else if (event.isProcessing()) {
if (logger.isLoggable(Level.FINEST)) {
logger.log(Level.FINEST,
"coordinator:{0} channelId:{1} " +
"event:{2} is already processing",
getLocalNodeId(),
HexDumper.toHexString(channel.channelRefId),
event);
}
return;
}
int cost = event.getCost();
if (cost > 0) {
dataService.markForUpdate(this);
writeBufferAvailable += cost;
if (logger.isLoggable(Level.FINEST)) {
logger.log(
Level.FINEST,