/** * Find out if this sender is the eldest in the DS. Returns true if: 1. No other sender is running * 2. At least one sender is running in the system apart from this sender AND this sender's start * time is lesser of all (i.e. this sender is oldest) * * @return boolean true if this eldest sender; false otherwise */ private boolean adviseEldestGatewaySender() { Profile[] snapshot = this.profiles; // sender with minimum startTime is eldest. Find out the minimum start time // of remote senders. TreeSet<Long> senderStartTimes = new TreeSet<Long>(); for (Profile profile : snapshot) { GatewaySenderProfile sp = (GatewaySenderProfile) profile; if (!sp.isParallel && sp.isRunning) { senderStartTimes.add(sp.startTime); } } // if none of the remote senders is running, then this sender should // volunteer for primary // if there are remote senders running and this sender is not running then // it should give up // and allow existing running senders to volunteer return (senderStartTimes.isEmpty()) || (this.sender.isRunning() && (this.sender.startTime <= senderStartTimes.first())); }
public void addShadowPartitionedRegionForUserPR(PartitionedRegion pr) { // Reset enqueuedAllTempQueueEvents if the sender is running // This is done so that any events received while the shadow PR is added are queued in the // tmpQueuedEvents // instead of blocking the distribute call which could cause a deadlock. See GEM-801. if (this.sender.isRunning()) { this.sender.setEnqueuedAllTempQueueEvents(false); } this.sender.getLifeCycleLock().writeLock().lock(); try { for (int i = 0; i < processors.length; i++) { processors[i].addShadowPartitionedRegionForUserPR(pr); } } finally { this.sender.getLifeCycleLock().writeLock().unlock(); } }
try { if (!(GatewaySenderAdvisor.this.sender.isRunning())) { return;
if ((this.index == this.nDispatcher - 1) && this.sender.isRunning()) { ((AbstractGatewaySender) sender).enqueueTempEvents();
if ((this.index == this.nDispatcher - 1) && this.sender.isRunning()) { ((AbstractGatewaySender) sender).enqueueTempEvents();