use of org.apache.geode.internal.cache.wan.AbstractGatewaySender in project geode by apache.
the class SerialGatewaySenderOperationsDUnitTest method verifySenderStoppedState.
public static void verifySenderStoppedState(String senderId) {
Set<GatewaySender> senders = cache.getGatewaySenders();
AbstractGatewaySender sender = null;
for (GatewaySender s : senders) {
if (s.getId().equals(senderId)) {
sender = (AbstractGatewaySender) s;
break;
}
}
assertFalse(sender.isRunning());
assertFalse(sender.isPaused());
}
use of org.apache.geode.internal.cache.wan.AbstractGatewaySender in project geode by apache.
the class PartitionedRegion method addGatewaySenderId.
public void addGatewaySenderId(String gatewaySenderId) {
super.addGatewaySenderId(gatewaySenderId);
new UpdateAttributesProcessor(this).distribute();
((PartitionedRegion) this).distributeUpdatedProfileOnSenderCreation();
GatewaySender sender = getCache().getGatewaySender(gatewaySenderId);
if (sender != null && sender.isParallel() && sender.isRunning()) {
AbstractGatewaySender senderImpl = (AbstractGatewaySender) sender;
((ConcurrentParallelGatewaySenderQueue) senderImpl.getQueues().toArray(new RegionQueue[1])[0]).addShadowPartitionedRegionForUserPR(this);
}
}
use of org.apache.geode.internal.cache.wan.AbstractGatewaySender in project geode by apache.
the class PartitionedRegionDataStore method clearAllTempQueueForShadowPR.
protected void clearAllTempQueueForShadowPR(final int bucketId) {
List<PartitionedRegion> colocatedWithList = ColocationHelper.getColocatedChildRegions(partitionedRegion);
for (PartitionedRegion childRegion : colocatedWithList) {
if (childRegion.isShadowPR()) {
AbstractGatewaySender sender = childRegion.getParallelGatewaySender();
if (sender == null) {
return;
}
AbstractGatewaySenderEventProcessor eventProcessor = sender.getEventProcessor();
if (eventProcessor == null) {
return;
}
ConcurrentParallelGatewaySenderQueue queue = (ConcurrentParallelGatewaySenderQueue) eventProcessor.getQueue();
if (queue == null) {
return;
}
BlockingQueue<GatewaySenderEventImpl> tempQueue = queue.getBucketTmpQueue(bucketId);
if (tempQueue != null) {
synchronized (tempQueue) {
for (GatewaySenderEventImpl event : tempQueue) {
event.release();
}
tempQueue.clear();
}
}
}
}
}
use of org.apache.geode.internal.cache.wan.AbstractGatewaySender in project geode by apache.
the class PartitionedRegion method postCreateRegion.
@Override
protected void postCreateRegion() {
super.postCreateRegion();
CacheListener[] listeners = fetchCacheListenersField();
if (listeners != null && listeners.length > 0) {
Set others = getRegionAdvisor().adviseGeneric();
for (int i = 0; i < listeners.length; i++) {
if (listeners[i] instanceof RegionMembershipListener) {
RegionMembershipListener rml = (RegionMembershipListener) listeners[i];
try {
DistributedMember[] otherDms = new DistributedMember[others.size()];
others.toArray(otherDms);
rml.initialMembers(this, otherDms);
} catch (VirtualMachineError err) {
SystemFailure.initiateFailure(err);
// now, so don't let this thread continue.
throw err;
} catch (Throwable t) {
// Whenever you catch Error or Throwable, you must also
// catch VirtualMachineError (see above). However, there is
// _still_ a possibility that you are dealing with a cascading
// error condition, so you also need to check to see if the JVM
// is still usable:
SystemFailure.checkFailure();
logger.error(LocalizedMessage.create(LocalizedStrings.DistributedRegion_EXCEPTION_OCCURRED_IN_REGIONMEMBERSHIPLISTENER), t);
}
}
}
}
PartitionListener[] partitionListeners = this.getPartitionListeners();
if (partitionListeners != null && partitionListeners.length != 0) {
for (int i = 0; i < partitionListeners.length; i++) {
PartitionListener listener = partitionListeners[i];
if (listener != null) {
listener.afterRegionCreate(this);
}
}
}
Set<String> allGatewaySenderIds = getAllGatewaySenderIds();
if (!allGatewaySenderIds.isEmpty()) {
for (GatewaySender sender : cache.getAllGatewaySenders()) {
if (sender.isParallel() && allGatewaySenderIds.contains(sender.getId())) {
/*
* get the ParallelGatewaySender to create the colocated partitioned region for this
* region.
*/
if (sender.isRunning()) {
AbstractGatewaySender senderImpl = (AbstractGatewaySender) sender;
((ConcurrentParallelGatewaySenderQueue) senderImpl.getQueues().toArray(new RegionQueue[1])[0]).addShadowPartitionedRegionForUserPR(this);
}
}
}
}
}
use of org.apache.geode.internal.cache.wan.AbstractGatewaySender in project geode by apache.
the class AsyncEventQueueEvictionAndExpirationJUnitTest method getEventsReceived.
public int getEventsReceived(String aeqId) {
AsyncEventQueueImpl aeq = (AsyncEventQueueImpl) cache.getAsyncEventQueue(aeqId);
AbstractGatewaySender sender = (AbstractGatewaySender) aeq.getSender();
return sender.getStatistics().getEventsReceived();
}
Aggregations