Search in sources :

Example 31 with AbstractGatewaySender

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());
}
Also used : GatewaySender(org.apache.geode.cache.wan.GatewaySender) AbstractGatewaySender(org.apache.geode.internal.cache.wan.AbstractGatewaySender) AbstractGatewaySender(org.apache.geode.internal.cache.wan.AbstractGatewaySender)

Example 32 with AbstractGatewaySender

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);
    }
}
Also used : AbstractGatewaySender(org.apache.geode.internal.cache.wan.AbstractGatewaySender) GatewaySender(org.apache.geode.cache.wan.GatewaySender) ConcurrentParallelGatewaySenderQueue(org.apache.geode.internal.cache.wan.parallel.ConcurrentParallelGatewaySenderQueue) AbstractGatewaySender(org.apache.geode.internal.cache.wan.AbstractGatewaySender)

Example 33 with AbstractGatewaySender

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();
                }
            }
        }
    }
}
Also used : ConcurrentParallelGatewaySenderQueue(org.apache.geode.internal.cache.wan.parallel.ConcurrentParallelGatewaySenderQueue) GatewaySenderEventImpl(org.apache.geode.internal.cache.wan.GatewaySenderEventImpl) AbstractGatewaySender(org.apache.geode.internal.cache.wan.AbstractGatewaySender) AbstractGatewaySenderEventProcessor(org.apache.geode.internal.cache.wan.AbstractGatewaySenderEventProcessor)

Example 34 with AbstractGatewaySender

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);
                }
            }
        }
    }
}
Also used : AbstractGatewaySender(org.apache.geode.internal.cache.wan.AbstractGatewaySender) GatewaySender(org.apache.geode.cache.wan.GatewaySender) HashSet(java.util.HashSet) Set(java.util.Set) ResultsSet(org.apache.geode.cache.query.internal.ResultsSet) RegionMembershipListener(org.apache.geode.cache.RegionMembershipListener) CacheListener(org.apache.geode.cache.CacheListener) PartitionListener(org.apache.geode.cache.partition.PartitionListener) ConcurrentParallelGatewaySenderQueue(org.apache.geode.internal.cache.wan.parallel.ConcurrentParallelGatewaySenderQueue) InternalDistributedMember(org.apache.geode.distributed.internal.membership.InternalDistributedMember) DistributedMember(org.apache.geode.distributed.DistributedMember) AbstractGatewaySender(org.apache.geode.internal.cache.wan.AbstractGatewaySender)

Example 35 with AbstractGatewaySender

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();
}
Also used : AsyncEventQueueImpl(org.apache.geode.cache.asyncqueue.internal.AsyncEventQueueImpl) AbstractGatewaySender(org.apache.geode.internal.cache.wan.AbstractGatewaySender)

Aggregations

AbstractGatewaySender (org.apache.geode.internal.cache.wan.AbstractGatewaySender)40 GatewaySender (org.apache.geode.cache.wan.GatewaySender)23 AttributesFactory (org.apache.geode.cache.AttributesFactory)6 ConcurrentParallelGatewaySenderQueue (org.apache.geode.internal.cache.wan.parallel.ConcurrentParallelGatewaySenderQueue)6 IgnoredException (org.apache.geode.test.dunit.IgnoredException)6 DistributedTest (org.apache.geode.test.junit.categories.DistributedTest)6 Test (org.junit.Test)6 RegionQueue (org.apache.geode.internal.cache.RegionQueue)5 Properties (java.util.Properties)4 Set (java.util.Set)4 Region (org.apache.geode.cache.Region)4 GatewayEventFilter (org.apache.geode.cache.wan.GatewayEventFilter)4 GatewaySenderFactory (org.apache.geode.cache.wan.GatewaySenderFactory)4 GatewayTransportFilter (org.apache.geode.cache.wan.GatewayTransportFilter)4 MyGatewayEventFilter1 (org.apache.geode.cache30.MyGatewayEventFilter1)4 MyGatewayTransportFilter1 (org.apache.geode.cache30.MyGatewayTransportFilter1)4 HashMap (java.util.HashMap)3 Map (java.util.Map)3 AsyncEventQueueImpl (org.apache.geode.cache.asyncqueue.internal.AsyncEventQueueImpl)3 MyGatewayTransportFilter2 (org.apache.geode.cache30.MyGatewayTransportFilter2)3