@Override public void postRemoveAllSend(DistributedRemoveAllOperation op, VersionedObjectList successfulOps) { if (op.removeAllDataSize > 0) { op.distribute(); } else { getCache().getLoggerI18n().fine("DR.postRemoveAll: no data to distribute"); } }
/** * Distribute the PutAllOp. * This implementation distributes it to peers. * @since 5.7 */ @Override public void postPutAllSend(DistributedPutAllOperation putAllOp, TXStateProxy txProxy, VersionedObjectList successfulPuts) { if (putAllOp.putAllDataSize > 0) { putAllOp.distribute(); } else { getCache().getLoggerI18n().fine("DR.postPutAll: no data to distribute"); } }
@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); } } };
@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); } } };
protected ConcurrentParallelGatewaySenderQueue getHDFSQueue() { if (this.hdfsQueue == null) { String asyncQId = this.getPartitionedRegion().getHDFSEventQueueName(); final AsyncEventQueueImpl asyncQ = (AsyncEventQueueImpl)this.getCache().getAsyncEventQueue(asyncQId); final ParallelGatewaySenderImpl gatewaySender = (ParallelGatewaySenderImpl)asyncQ.getSender(); AbstractGatewaySenderEventProcessor ep = gatewaySender.getEventProcessor(); if (ep == null) return null; hdfsQueue = (ConcurrentParallelGatewaySenderQueue)ep.getQueue(); } return hdfsQueue; }
@Override protected void checkForDataStoreAvailability(DistributedRegion region, Set<InternalDistributedMember> recipients) { if (region.getCache().isGFXDSystem()) { if (recipients.isEmpty() && !region.isUsedForMetaRegion() && !region.isUsedForPartitionedRegionAdmin() && !region.isUsedForPartitionedRegionBucket() && !region.getDataPolicy().withStorage()) { throw new NoDataStoreAvailableException(LocalizedStrings .DistributedRegion_NO_DATA_STORE_FOUND_FOR_DISTRIBUTION .toLocalizedString(region)); } } }
@Override protected void checkForDataStoreAvailability(DistributedRegion region, Set<InternalDistributedMember> recipients) { if (region.getCache().isGFXDSystem()) { if (recipients.isEmpty() && !region.isUsedForMetaRegion() && !region.isUsedForPartitionedRegionAdmin() && !region.isUsedForPartitionedRegionBucket() && !region.getDataPolicy().withStorage()) { throw new NoDataStoreAvailableException( LocalizedStrings.DistributedRegion_NO_DATA_STORE_FOUND_FOR_DISTRIBUTION .toLocalizedString(region)) ; } } }
protected ConcurrentParallelGatewaySenderQueue getHDFSQueue() { if (this.hdfsQueue == null) { String asyncQId = this.getPartitionedRegion().getHDFSEventQueueName(); final AsyncEventQueueImpl asyncQ = (AsyncEventQueueImpl)this.getCache().getAsyncEventQueue(asyncQId); final AbstractGatewaySender gatewaySender = (AbstractGatewaySender)asyncQ.getSender(); AbstractGatewaySenderEventProcessor ep = gatewaySender.getEventProcessor(); if (ep == null) return null; hdfsQueue = (ConcurrentParallelGatewaySenderQueue)ep.getQueue(); } return hdfsQueue; }
/** * Performs the resumption action when reliability is resumed. * * @return true if asynchronous resumption is triggered */ protected boolean resumeReliability(InternalDistributedMember id, Set newlyAcquiredRoles) { boolean async = false; try { ResumptionAction ra = getMembershipAttributes().getResumptionAction(); if (ra.isNone()) { getCache().getLoggerI18n() .fine("Reliability resumption for action of none"); resumeExpiration(); } else if (ra.isReinitialize()) { async = true; asyncResumeReliability(id, newlyAcquiredRoles); } } catch (Exception e) { getCache().getLoggerI18n().severe(LocalizedStrings.DistributedRegion_UNEXPECTED_EXCEPTION, e); } return async; }
@Override protected final InternalCacheEvent createEvent(DistributedRegion rgn) throws EntryNotFoundException { EntryEventImpl ev = createEntryEvent(rgn); boolean evReturned = false; try { ev.setEventId(this.eventId); ev.setOldValueFromRegion(); if (this.filterRouting != null) { ev.setLocalFilterInfo(this.filterRouting.getFilterInfo(rgn.getCache() .getMyId())); } ev.setTailKey(tailKey); evReturned = true; return ev; } finally { if (!evReturned) ev.release(); } }
@Override protected final InternalCacheEvent createEvent(DistributedRegion rgn) throws EntryNotFoundException { EntryEventImpl ev = createEntryEvent(rgn); boolean evReturned = false; try { ev.setEventId(this.eventId); ev.setOldValueFromRegion(); if (this.filterRouting != null) { ev.setLocalFilterInfo(this.filterRouting.getFilterInfo(rgn.getCache() .getMyId())); } ev.setTailKey(tailKey); evReturned = true; return ev; } finally { if (!evReturned) ev.release(); } }
/** * Do the actual update after operationOnRegion has confirmed work needs to be done * Note this is the default implementation used by UpdateOperation. * DistributedPutAllOperation overrides and then calls back using super * to this implementation. * NOTE: be careful to not use methods like getEvent(); defer to * the ev passed as a parameter instead. */ protected void basicOperateOnRegion(EntryEventImpl ev, DistributedRegion rgn) { if (StateFlushOperation.DEBUG) { rgn.getCache().getLoggerI18n().info(LocalizedStrings.AbstractUpdateOperation_PROCESSING__0, this); } try { long time = this.lastModified; if (ev.getVersionTag() != null) { checkVersionTag(rgn, ev.getVersionTag()); time = ev.getVersionTag().getVersionTimeStamp(); } this.appliedOperation = doPutOrCreate(rgn, ev, time, true, true); } catch (ConcurrentCacheModificationException e) { dispatchElidedEvent(rgn, ev); this.appliedOperation = false; } }
@Override public void cleanupFailedInitialization() { super.cleanupFailedInitialization(); try { RegionEventImpl ev = new RegionEventImpl(this, Operation.REGION_CLOSE, null, false, getMyId(), generateEventID()); distributeDestroyRegion(ev, true); distributedRegionCleanup(null); } catch(RegionDestroyedException e) { //someone else must have concurrently destroyed the region (maybe a distributed destroy) } catch(CancelException e) { //cache or DS is closed, ignore } catch(Throwable t) { Error err; if (t instanceof Error && SystemFailure.isJVMFailureError( err = (Error)t)) { SystemFailure.initiateFailure(err); // If this ever returns, rethrow the error. We're poisoned // now, so don't let this thread continue. throw err; } getCache().getLoggerI18n().warning(LocalizedStrings.DistributedRegion_ERROR_CLEANING_UP_FAILED_INITIALIZATION, this, t); } }
if (rgn.getCache().isClosed()) { return false;
public void run() { try { rgn.reinitializeFromImageTarget(getSender()); } catch (TimeoutException e) { // dlock timed out, log message rgn.getCache().getLoggerI18n().warning( LocalizedStrings.DestroyRegionOperation_GOT_TIMEOUT_WHEN_TRYING_TO_RECREATE_REGION_DURING_REINITIALIZATION_1, rgn.getFullPath(), e); } catch (IOException e) { // only if loading snapshot, not here InternalGemFireError assErr = new InternalGemFireError(LocalizedStrings.UNEXPECTED_EXCEPTION.toLocalizedString()); assErr.initCause(e); throw assErr; } catch (ClassNotFoundException e) { // only if loading snapshot, not here InternalGemFireError assErr = new InternalGemFireError(LocalizedStrings.UNEXPECTED_EXCEPTION.toLocalizedString()); assErr.initCause(e); throw assErr; } finally { if (loc_lockRoot != null) loc_lockRoot.releaseDestroyLock(); } } });