use of org.apache.geode.internal.cache.wan.GatewaySenderStats in project geode by apache.
the class SerialGatewaySenderEventProcessor method queuePrimaryEvent.
private boolean queuePrimaryEvent(GatewaySenderEventImpl gatewayEvent) throws IOException, CacheException {
// Queue the event
GatewaySenderStats statistics = this.sender.getStatistics();
if (logger.isDebugEnabled()) {
logger.debug("{}: Queueing event ({}): {}", sender.getId(), (statistics.getEventsQueued() + 1), gatewayEvent);
}
if (!sender.beforeEnqueue(gatewayEvent)) {
if (logger.isDebugEnabled()) {
logger.debug("Event {} is not added to queue.", gatewayEvent);
}
statistics.incEventsFiltered();
return false;
}
long start = statistics.startTime();
boolean putDone = false;
try {
putDone = this.queue.put(gatewayEvent);
} catch (InterruptedException e) {
// Asif Not expected from SingleWriteSingleReadRegionQueue as it does not
// throw
// InterruptedException. But since both HARegionQueue and
// SingleReadSingleWriteRegionQueue
// extend RegionQueue , it has to handle InterruptedException
Thread.currentThread().interrupt();
getSender().getCancelCriterion().checkCancelInProgress(e);
}
statistics.endPut(start);
if (logger.isDebugEnabled()) {
logger.debug("{}: Queued event ({}): {}", sender.getId(), (statistics.getEventsQueued()), gatewayEvent);
}
// this._logger.warning(getGateway() + ": Queued event (" +
// (statistics.getEventsQueued()) + "): " + gatewayEvent + " queue size: "
// + this._eventQueue.size());
/*
* FAILOVER TESTING CODE System.out.println(getName() + ": Queued event (" +
* (statistics.getEventsQueued()) + "): " + gatewayEvent.getId());
*/
int queueSize = eventQueueSize();
statistics.incQueueSize(1);
if (!this.eventQueueSizeWarning && queueSize >= AbstractGatewaySender.QUEUE_SIZE_THRESHOLD) {
logger.warn(LocalizedMessage.create(LocalizedStrings.GatewayImpl_0_THE_EVENT_QUEUE_SIZE_HAS_REACHED_THE_THRESHOLD_1, new Object[] { sender.getId(), Integer.valueOf(AbstractGatewaySender.QUEUE_SIZE_THRESHOLD) }));
this.eventQueueSizeWarning = true;
}
return putDone;
}
Aggregations