private RemoteRegionOperation(InternalDistributedMember recipient, DistributedRegion region, Operation op) { super(recipient, region, new RemoteOperationResponse(region.getSystem(), Collections.singleton(recipient)), null); this.op = op; this.region = region; }
private RemoteRegionOperation(InternalDistributedMember recipient, DistributedRegion region, Operation op) { super(recipient, region.getFullPath(), new RemoteOperationResponse(region.getSystem(), Collections.singleton(recipient))); this.op = op; this.region = region; }
public final DistributionConfig getDistributionConfig() { return getSystem().getDistributionManager().getConfig(); }
protected boolean basicIsRoleInRegionMembership(Role role) { if (getSystem().getDistributedMember().getRoles().contains(role)) { // since we are playing the role return true; } Set members = this.distAdvisor.adviseGeneric(); for (Iterator iter = members.iterator(); iter.hasNext();) { DistributedMember member = (DistributedMember)iter.next(); Set roles = member.getRoles(); if (roles.contains(role)) { return true; } } return false; }
public final DistributionConfig getDistributionConfig() { return getSystem().getDistributionManager().getConfig(); }
protected boolean basicIsRoleInRegionMembership(Role role) { if (getSystem().getDistributedMember().getRoles().contains(role)) { // since we are playing the role return true; } Set members = this.distAdvisor.adviseGeneric(); for (Iterator iter = members.iterator(); iter.hasNext();) { DistributedMember member = (DistributedMember)iter.next(); Set roles = member.getRoles(); if (roles.contains(role)) { return true; } } return false; }
private ResultCollector executeOnReplicate( final DistributedRegionFunctionExecutor execution, final Function function, final Object args, ResultCollector rc, final Set filter, final DistributedMember target, final TXStateInterface tx) { final Set singleMember = Collections.singleton(target); execution.validateExecution(function, singleMember); execution.setExecutionNodes(singleMember); HashMap<InternalDistributedMember, Object> memberArgs = new HashMap<InternalDistributedMember, Object>(); memberArgs.put((InternalDistributedMember)target, execution.getArgumentsForMember(target.getId())); final ResultSender resultSender = new DistributedRegionFunctionResultSender( null, tx, rc, function, execution.getServerResultSender()); DistributedRegionFunctionResultWaiter waiter = new DistributedRegionFunctionResultWaiter( this.getSystem(), this, rc, function, filter, Collections.singleton(target), memberArgs, resultSender); rc = waiter.getFunctionResultFrom(Collections.singleton(target), function, execution); return rc; }
private ResultCollector executeOnReplicate( final DistributedRegionFunctionExecutor execution, final Function function, final Object args, ResultCollector rc, final Set filter, final DistributedMember target) { final Set singleMember = Collections.singleton(target); execution.validateExecution(function, singleMember); execution.setExecutionNodes(singleMember); HashMap<InternalDistributedMember, Object> memberArgs = new HashMap<InternalDistributedMember, Object>(); memberArgs.put((InternalDistributedMember)target, execution.getArgumentsForMember(target.getId())); ResultSender resultSender = new DistributedRegionFunctionResultSender(null, rc, function, execution.getServerResultSender()); DistributedRegionFunctionResultWaiter waiter = new DistributedRegionFunctionResultWaiter( this.getSystem(), this.getFullPath(), rc, function, filter, Collections.singleton(target), memberArgs, resultSender); rc = waiter.getFunctionResultFrom(Collections.singleton(target), function, execution); return rc; }
@Override public void run() { try { // TODO: may need to check isReconnecting and checkReadiness... if (logger.isDebugEnabled()) { logger.debug("Reliability loss with policy of reconnect and membership thread doing reconnect"); } initializationLatchAfterMemberTimeout.await(); getSystem().tryReconnect(false, "Role Loss", getCache()); synchronized (missingRequiredRoles) { // any number of threads may be waiting on missingRequiredRoles missingRequiredRoles.notifyAll(); // need to fire an event if id is not null if (hasListener() && id != null) { RoleEventImpl relEvent = new RoleEventImpl( DistributedRegion.this, Operation.CACHE_RECONNECT, null, true, id, newlyMissingRoles); dispatchListenerEvent(EnumListenerEvent.AFTER_ROLE_LOSS, relEvent); } } } catch (Exception e) { logger.fatal(LocalizedMessage.create(LocalizedStrings.DistributedRegion_UNEXPECTED_EXCEPTION), e); } } };
@Override public void becomeLockGrantor() { checkReadiness(); checkForLimitedOrNoAccess(); if (!this.scope.isGlobal()) { throw new IllegalStateException(LocalizedStrings.DistributedRegion_DISTRIBUTION_LOCKS_ARE_ONLY_SUPPORTED_FOR_REGIONS_WITH_GLOBAL_SCOPE_NOT_0.toLocalizedString(this.scope)); } DistributedLockService svc = getLockService(); try { super.becomeLockGrantor(); if (!svc.isLockGrantor()) { svc.becomeLockGrantor(); } } finally { if (getSystem().getLogWriter().fineEnabled() && !svc.isLockGrantor()) { getSystem().getLogWriter().fine( "isLockGrantor is false after becomeLockGrantor for " + getFullPath()); } } }
/** * Distribute Tombstone garbage-collection information to all peers with storage */ protected EventID distributeTombstoneGC(Set<Object> keysRemoved) { this.getCachePerfStats().incTombstoneGCCount(); EventID eventId = new EventID(getSystem()); DistributedTombstoneOperation gc = DistributedTombstoneOperation.gc(this, eventId); gc.distribute(); notifyClientsOfTombstoneGC(getVersionVector().getTombstoneGCVector(), keysRemoved, eventId, null); return eventId; }
this.dlockService = DLockService.create( getFullPath(), getSystem(), true /*distributed*/, false /*destroyOnDisconnect*/, // region destroy will destroy dls
/** * Distribute Tombstone garbage-collection information to all peers with storage */ protected EventID distributeTombstoneGC(Set<Object> keysRemoved) { this.getCachePerfStats().incTombstoneGCCount(); EventID eventId = new EventID(getSystem()); DistributedTombstoneOperation gc = DistributedTombstoneOperation.gc(this, eventId); gc.distribute(); notifyClientsOfTombstoneGC(getVersionVector().getTombstoneGCVector(), keysRemoved, eventId, null); return eventId; }
this.dlockService = DLockService.create( getFullPath(), getSystem(), true /*distributed*/, false /*destroyOnDisconnect*/, // region destroy will destroy dls this.dlockService.becomeLockGrantor(); getSystem().getLogWriter().fine( "LockService for " + svcName + " is using LockLease=" + getCache().getLockLease() + ", LockTimeout="
private void setDeltaFlag(DistributedRegion region) { try { if (region != null && region.getSystem().getConfig().getDeltaPropagation() && this.sendDelta && !region.scope.isDistributedNoAck() && this.event.getDeltaBytes() != null) { setHasDelta(true); return; } setHasDelta(false); } catch (RuntimeException re) { throw new InvalidDeltaException( LocalizedStrings.DistributionManager_CAUGHT_EXCEPTION_WHILE_SENDING_DELTA .toLocalizedString(), re); } }
private void setDeltaFlag(DistributedRegion region) { try { // if (region != null && region.getLogWriterI18n().fineEnabled()) { // region.getLogWriterI18n().fine("setDeltaFlag(sendDelta="+sendDelta+", scope="+region.scope // +", deltaBytes="+this.event.getDeltaBytes()+")"); // } if (region != null && region.getSystem().getConfig().getDeltaPropagation() && this.sendDelta && !region.scope.isDistributedNoAck() && this.event.getDeltaBytes() != null) { setHasDelta(true); return; } setHasDelta(false); } catch (RuntimeException re) { throw new InvalidDeltaException( LocalizedStrings.DistributionManager_CAUGHT_EXCEPTION_WHILE_SENDING_DELTA .toLocalizedString(), re); } }
@Override public void run() { try { // TODO: may need to check isReconnecting and checkReadiness... getCache() .getLoggerI18n() .fine( "Reliability loss with policy of reconnect and membership thread doing reconnect"); initializationLatchAfterMemberTimeout.await(); getSystem().tryReconnect(false, "Role Loss", getCache()); synchronized (missingRequiredRoles) { // any number of threads may be waiting on missingRequiredRoles missingRequiredRoles.notifyAll(); // need to fire an event if id is not null if (hasListener() && id != null) { RoleEventImpl relEvent = new RoleEventImpl( DistributedRegion.this, Operation.CACHE_RECONNECT, null, true, id, newlyMissingRoles); dispatchListenerEvent(EnumListenerEvent.AFTER_ROLE_LOSS, relEvent); } } } catch (Exception e) { getCache().getLoggerI18n().severe(LocalizedStrings.DistributedRegion_UNEXPECTED_EXCEPTION, e); } } };
rrm.setRecipient(recipient); RequestRVVProcessor rvv_processor = new RequestRVVProcessor(this.region.getSystem(), recipient); rrm.processorId = rvv_processor.getProcessorId();
protected RequestRVVProcessor getRVVDetailsFromProvider(final DistributionManager dm, InternalDistributedMember recipient, boolean targetReinitialized) { RegionVersionVector received_rvv = null; // RequestRVVMessage is to send rvv of gii provider for both persistent and non-persistent region RequestRVVMessage rrm = new RequestRVVMessage(); rrm.regionPath = this.region.getFullPath(); rrm.targetReinitialized = targetReinitialized; rrm.setRecipient(recipient); RequestRVVProcessor rvv_processor = new RequestRVVProcessor(this.region.getSystem(), recipient); rrm.processorId = rvv_processor.getProcessorId(); dm.putOutgoing(rrm); if (internalAfterRequestRVV != null && internalAfterRequestRVV.getRegionName().equals(this.region.getName())) { internalAfterRequestRVV.run(); } try { rvv_processor.waitForRepliesUninterruptibly(); } catch (InternalGemFireException ex) { Throwable cause = ex.getCause(); if (cause instanceof com.gemstone.gemfire.cache.TimeoutException) { throw (com.gemstone.gemfire.cache.TimeoutException)cause; } throw ex; } catch (ReplyException e) { if(!region.isDestroyed()) { e.handleAsUnexpected(); } } return rvv_processor; }
filterInfoMsg.regionPath = this.region.getFullPath(); filterInfoMsg.setRecipient(recipient); FilterInfoProcessor processor = new FilterInfoProcessor(this.region.getSystem(), recipient); filterInfoMsg.processorId = processor.getProcessorId();