public int localSize() { return ((ParallelGatewaySenderQueue)(processors[0].getQueue())).localSize(); }
public int localSize() { return ((ParallelGatewaySenderQueue)(processors[0].getQueue())).localSize(); }
protected int eventQueueSize() { // This should be local size instead of PR size. Fix for #48627 if (this.queue instanceof ParallelGatewaySenderQueue) { return ((ParallelGatewaySenderQueue) queue).localSize(); } if (this.queue instanceof ConcurrentParallelGatewaySenderQueue) { return ((ConcurrentParallelGatewaySenderQueue) queue).localSize(); } return this.queue.size(); }
protected int eventQueueSize() { // This should be local size instead of PR size. Fix for #48627 if (this.queue instanceof ParallelGatewaySenderQueue) { return ((ParallelGatewaySenderQueue) queue).localSize(); } if (this.queue instanceof ConcurrentParallelGatewaySenderQueue) { return ((ConcurrentParallelGatewaySenderQueue) queue).localSize(); } return this.queue.size(); }
@Override protected void initializeMessageQueue(String id ) { Set<Region> targetRs = new HashSet<Region>(); for (LocalRegion region : ((GemFireCacheImpl)((AbstractGatewaySender)sender).getCache()) .getApplicationRegions()) { if (region.getAllGatewaySenderIds().contains(id)) { targetRs.add(region); } } if (logger.isDebugEnabled()) { logger.debug("The target Regions are(PGSEP) {}", targetRs); } if (sender.getIsHDFSQueue()) this.queue = new HDFSParallelGatewaySenderQueue(this.sender, targetRs, this.index, this.nDispatcher); else this.queue = new ParallelGatewaySenderQueue(this.sender, targetRs, this.index, this.nDispatcher); if(((ParallelGatewaySenderQueue)queue).localSize() > 0) { ((ParallelGatewaySenderQueue)queue).notifyEventProcessorIfRequired(); } }
this, batch.size(), size(), localSize());
@Override protected void initializeMessageQueue(String id ) { Set<Region> targetRs = new HashSet<Region>(); for (LocalRegion region : ((GemFireCacheImpl)((ParallelGatewaySenderImpl)sender).getCache()) .getApplicationRegions()) { if (region.getAllGatewaySenderIds().contains(id)) { targetRs.add(region); } } if (getLogger().fineEnabled()) { getLogger().fine("The target Regions are(PGSEP) " + targetRs); } if (sender.getIsHDFSQueue()) this.queue = new HDFSParallelGatewaySenderQueue(this.sender, targetRs, this.index, this.nDispatcher); else this.queue = new ParallelGatewaySenderQueue(this.sender, targetRs, this.index, this.nDispatcher); if(((ParallelGatewaySenderQueue)queue).localSize() > 0) { ((ParallelGatewaySenderQueue)queue).notifyEventProcessorIfRequired(); } }
+ " the size of queue is " + size() + "localSize is : " + localSize());
/** * Should take care of scenario where some one wants to pause/stop the processor. * So the while condition should also have paused/stop check. * pause/stop should notify this thread. * Also no need to wait indefinitely in while loop. We just wait for 1 sec, * and if not the again let the processor try to peek check for pause/stop/queueEmpty * and come back. * This should avoid threads being blocked for pause/stop when processor * is waiting here and also avoid the hot loop. */ protected void blockProcesorThreadIfRequired() throws InterruptedException { queueEmptyLock.lock(); try { //while (isQueueEmpty) { if(isQueueEmpty) { if (getLogger().finerEnabled()) { getLogger().finer("Going to wait, till notified."); } queueEmptyCondition.await(1000,TimeUnit.MILLISECONDS); //isQueueEmpty = this.localSize() == 0; } // update the flag so that next time when we come we will block. isQueueEmpty = this.localSize() == 0; } finally { if (getLogger().finerEnabled()) { getLogger().finer("Going to unblock. isQueueEmpty " + isQueueEmpty); } queueEmptyLock.unlock(); } }