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;
}
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;
}
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);
}
}
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);
}
}
}
}
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;
}
Aggregations