Search in sources :

Example 86 with GatewaySender

use of org.apache.geode.cache.wan.GatewaySender in project geode by apache.

the class AbstractRegion method getRemoteDsIds.

/**
   * Return the remote DS IDs that need to receive events for this region.
   *
   * @param allGatewaySenderIds the set of gateway sender IDs to consider
   */
List<Integer> getRemoteDsIds(Set<String> allGatewaySenderIds) throws IllegalStateException {
    int sz = allGatewaySenderIds.size();
    Set<GatewaySender> allGatewaySenders = this.cache.getAllGatewaySenders();
    if ((sz > 0 || this.isPdxTypesRegion) && !allGatewaySenders.isEmpty()) {
        List<Integer> allRemoteDSIds = new ArrayList<>(sz);
        for (GatewaySender sender : allGatewaySenders) {
            // This is for all regions except pdx Region
            if (!this.isPdxTypesRegion) {
                // is available on this region
                if (allGatewaySenderIds.contains(sender.getId())) {
                    allRemoteDSIds.add(sender.getRemoteDSId());
                }
            } else {
                // this else is for PDX region
                allRemoteDSIds.add(sender.getRemoteDSId());
            }
        }
        return allRemoteDSIds;
    }
    return null;
}
Also used : GatewaySender(org.apache.geode.cache.wan.GatewaySender) ArrayList(java.util.ArrayList) ExtensionPoint(org.apache.geode.internal.cache.extension.ExtensionPoint) SimpleExtensionPoint(org.apache.geode.internal.cache.extension.SimpleExtensionPoint)

Example 87 with GatewaySender

use of org.apache.geode.cache.wan.GatewaySender in project geode by apache.

the class PartitionedRegion method getParallelGatewaySenderIds.

public Set<String> getParallelGatewaySenderIds() {
    Set<String> regionGatewaySenderIds = this.getAllGatewaySenderIds();
    if (regionGatewaySenderIds.isEmpty()) {
        return Collections.emptySet();
    }
    Set<GatewaySender> cacheGatewaySenders = getCache().getAllGatewaySenders();
    Set<String> parallelGatewaySenderIds = new HashSet<String>();
    for (GatewaySender sender : cacheGatewaySenders) {
        if (regionGatewaySenderIds.contains(sender.getId()) && sender.isParallel()) {
            parallelGatewaySenderIds.add(sender.getId());
        }
    }
    return parallelGatewaySenderIds;
}
Also used : AbstractGatewaySender(org.apache.geode.internal.cache.wan.AbstractGatewaySender) GatewaySender(org.apache.geode.cache.wan.GatewaySender) HashSet(java.util.HashSet)

Example 88 with GatewaySender

use of org.apache.geode.cache.wan.GatewaySender in project geode by apache.

the class PartitionedRegion method addAsyncEventQueueId.

public void addAsyncEventQueueId(String asyncEventQueueId) {
    super.addAsyncEventQueueId(asyncEventQueueId);
    new UpdateAttributesProcessor(this).distribute();
    ((PartitionedRegion) this).distributeUpdatedProfileOnSenderCreation();
    GatewaySender sender = getCache().getGatewaySender(AsyncEventQueueImpl.getSenderIdFromAsyncEventQueueId(asyncEventQueueId));
    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 89 with GatewaySender

use of org.apache.geode.cache.wan.GatewaySender in project geode by apache.

the class LocalRegion method notifyGatewaySender.

protected void notifyGatewaySender(EnumListenerEvent operation, EntryEventImpl event) {
    if (isPdxTypesRegion() || event.isConcurrencyConflict()) {
        // isConcurrencyConflict is usually a concurrent cache modification problem
        return;
    }
    // Return if the inhibit all notifications flag is set
    if (event.inhibitAllNotifications()) {
        if (logger.isDebugEnabled()) {
            logger.debug("Notification inhibited for key {}", event);
        }
        return;
    }
    checkSameSenderIdsAvailableOnAllNodes();
    Set<String> allGatewaySenderIds;
    if (event.getOperation() == Operation.UPDATE_VERSION_STAMP) {
        allGatewaySenderIds = getGatewaySenderIds();
    } else {
        allGatewaySenderIds = getAllGatewaySenderIds();
    }
    List<Integer> allRemoteDSIds = getRemoteDsIds(allGatewaySenderIds);
    if (allRemoteDSIds != null) {
        for (GatewaySender sender : getCache().getAllGatewaySenders()) {
            if (allGatewaySenderIds.contains(sender.getId())) {
                // TODO: This is a BUG. Why return and not continue?
                if (!this.getDataPolicy().withStorage() && sender.isParallel()) {
                    return;
                }
                if (logger.isDebugEnabled()) {
                    logger.debug("Notifying the GatewaySender : {}", sender.getId());
                }
                ((AbstractGatewaySender) sender).distribute(operation, event, allRemoteDSIds);
            }
        }
    }
}
Also used : AtomicInteger(java.util.concurrent.atomic.AtomicInteger) AbstractGatewaySender(org.apache.geode.internal.cache.wan.AbstractGatewaySender) GatewaySender(org.apache.geode.cache.wan.GatewaySender) AbstractGatewaySender(org.apache.geode.internal.cache.wan.AbstractGatewaySender)

Example 90 with GatewaySender

use of org.apache.geode.cache.wan.GatewaySender in project geode by apache.

the class LocalRegion method isParallelWanEnabled.

boolean isParallelWanEnabled() {
    Set<String> regionGatewaySenderIds = this.getAllGatewaySenderIds();
    if (regionGatewaySenderIds.isEmpty()) {
        return false;
    }
    Set<GatewaySender> cacheGatewaySenders = getCache().getAllGatewaySenders();
    for (GatewaySender sender : cacheGatewaySenders) {
        if (regionGatewaySenderIds.contains(sender.getId()) && sender.isParallel()) {
            return true;
        }
    }
    return false;
}
Also used : AbstractGatewaySender(org.apache.geode.internal.cache.wan.AbstractGatewaySender) GatewaySender(org.apache.geode.cache.wan.GatewaySender)

Aggregations

GatewaySender (org.apache.geode.cache.wan.GatewaySender)116 RegionQueue (org.apache.geode.internal.cache.RegionQueue)28 AbstractGatewaySender (org.apache.geode.internal.cache.wan.AbstractGatewaySender)28 Test (org.junit.Test)17 IgnoredException (org.apache.geode.test.dunit.IgnoredException)16 Region (org.apache.geode.cache.Region)10 DistributedTest (org.apache.geode.test.junit.categories.DistributedTest)10 AsyncEventQueue (org.apache.geode.cache.asyncqueue.AsyncEventQueue)9 GatewaySenderFactory (org.apache.geode.cache.wan.GatewaySenderFactory)9 GemFireCacheImpl (org.apache.geode.internal.cache.GemFireCacheImpl)9 DiskStore (org.apache.geode.cache.DiskStore)8 ForceReattemptException (org.apache.geode.internal.cache.ForceReattemptException)8 ConcurrentParallelGatewaySenderQueue (org.apache.geode.internal.cache.wan.parallel.ConcurrentParallelGatewaySenderQueue)8 Expectations (org.jmock.Expectations)8 GatewayTransportFilter (org.apache.geode.cache.wan.GatewayTransportFilter)7 CacheCreation (org.apache.geode.internal.cache.xmlcache.CacheCreation)7 UnitTest (org.apache.geode.test.junit.categories.UnitTest)7 AttributesFactory (org.apache.geode.cache.AttributesFactory)6 HashMap (java.util.HashMap)5 HashSet (java.util.HashSet)5