public static void send( Set<InternalDistributedMember> recipients, DM dm, String regionPath) throws ReplyException { ReplyProcessor21 processor = new ReplyProcessor21(dm, recipients); MembershipFlushRequest msg = new MembershipFlushRequest(regionPath, processor.getProcessorId()); msg.setRecipients(recipients); dm.putOutgoing(msg); processor.waitForRepliesUninterruptibly(); }
/** * Call to send a {@link AdminResponse} and notify the thread waiting for it. */ public static void sendResponse(AdminResponse msg) { int id = msg.getMsgId(); ReplyProcessor21 processor = (ReplyProcessor21) ReplyProcessor21.getProcessor(id); if (processor == null) { return; //must've been cancelled } else { processor.process(msg); } } /**
/** * A wait for replies that can be overridden by child classes. */ public boolean waitForProcessedReplies() throws InterruptedException, ReplyException { return waitForReplies(0L); }
@Override public String toString() { return "<" + shortName() + " " + this.getProcessorId() + " waiting for " + numMembers() + " replies" + (exception == null ? "" : (" exception: " + exception)) + " from " + membersToString() + ">"; }
/** * Wait a given number of milliseconds for the expected acks to be * received. If <code>msecs</code> milliseconds pass before all * acknowlegdements are received, <code>false</code> is returned. * * @param msecs the number of milliseconds to wait for replies * @throws InterruptedException if interrupted while waiting on latch * @throws ReplyException an exception passed back in reply * @throws InternalGemFireException if ack-threshold was exceeded and system * property "ack-threshold-exception" is set to true * @throws IllegalStateException if the processor is not registered to receive messages * * @return Whether or not we received all of the replies in the * given amount of time. */ public final boolean waitForReplies(long msecs) throws InterruptedException, ReplyException { return waitForReplies(msecs, getLatch(), true); }
static void sendInterestChange(DM dm, ClientProxyMembershipID clientID, ClientInterestMessageImpl msg) { ServerInterestRegistrationMessage smsg = new ServerInterestRegistrationMessage( clientID, msg); Set recipients = dm.getOtherDistributionManagerIds(); smsg.setRecipients(recipients); ReplyProcessor21 rp = new ReplyProcessor21(dm, recipients); smsg.processorId = rp.getProcessorId(); dm.putOutgoing(smsg); try { rp.waitForReplies(); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); } }
public static void send(DistributionManager dm) throws InterruptedException { long viewId = dm.getMembershipManager().getView().getViewId(); ReplyProcessor21 rp = new ReplyProcessor21(dm, dm.getOtherDistributionManagerIds()); rp.enableSevereAlertProcessing(); dm.putOutgoing(new WaitForViewInstallation(viewId, rp.getProcessorId())); try { rp.waitForReplies(); } catch (ReplyException e) { if (e.getCause() != null && !(e.getCause() instanceof CancelException)) { if (logger.isDebugEnabled()) { logger.debug("Reply to WaitForViewInstallation received odd exception", e.getCause()); } } } // this isn't necessary for TXFailoverCommand, which is the only use of this // message right now. TXFailoverCommand performs messaging to all servers, // which will force us to wait for the view containing the crash of another // server to be processed. // dm.waitForViewInstallation(viewId); }
@Override public void process(DistributionMessage msg) { super.process(msg); } /** Creates a new instance of ClientBlacklistProcessor
/** * Send this message to the bucket primary, after the {@link ReplyProcessor21#waitForRepliesUninterruptibly()} returns, all updates * from the primary should be complete. Use this from a host of a backup bucket (aka secondary) when the update * operations originating from the primary {@link Scope#DISTRIBUTED_NO_ACK do not require an acknowldgement} * @param primary * @param p * @param bucketId * @return a processor on which to wait for the flush operation to complete */ public static ReplyProcessor21 send(InternalDistributedMember primary, PartitionedRegion p, int bucketId) { ReplyProcessor21 reply = new ReplyProcessor21(p.getDistributionManager(), primary); FlushMessage fm = new FlushMessage(p.getPRId(), bucketId, reply.getProcessorId(), primary); p.getDistributionManager().putOutgoing(fm); return reply; }
public TXMessage(int txUniqueId, InternalDistributedMember onBehalfOfMember, ReplyProcessor21 processor) { this.txUniqId = txUniqueId; this.txMemberId = onBehalfOfMember; this.processorId = processor == null ? 0 : processor.getProcessorId(); }
@Override public void fromData(DataInput in) throws IOException, ClassNotFoundException { super.fromData(in); boolean nullEntry = in.readBoolean(); if (!nullEntry) { // since the Entry object shares state with the PartitionedRegion, // we have to find the region and ask it to create a new Entry instance // to be populated from the DataInput FetchEntryResponse processor = (FetchEntryResponse)ReplyProcessor21 .getProcessor(this.processorId); if (processor == null) { throw new OperationCancelledException("This operation was cancelled (null processor)"); } this.value = new EntrySnapshot(in,processor.partitionedRegion); } }
@Override public void setProcessor(final ReplyProcessor21 processor) { if (GemFireXDUtils.TraceQuery) { SanityManager.DEBUG_PRINT(GfxdConstants.TRACE_QUERYDISTRIB, toString() + ": initial members: " + processor.membersToString()); } //Fixes #43878 - start looking for member departures early. processor.startWait(); }
public PartitionMessage(Collection<InternalDistributedMember> recipients, int regionId, ReplyProcessor21 processor, final TXStateInterface tx) { super(tx); setRecipients(recipients); this.regionId = regionId; this.processorId = processor == null ? 0 : processor.getProcessorId(); if (processor != null && this.isSevereAlertCompatible()) { processor.enableSevereAlertProcessing(); } }
public final void dmProcess(final DM dm) { // TODO: because startTime uses getTimeStamp replyMessageTime // ends up measuring both messageProcessingScheduleTime and // processedMessagesTime. I'm not sure this was intended. // I've added this info to the stat description so update it // if the startTime changes. final long startTime = getTimestamp(); ReplyProcessor21 processor = ReplyProcessor21.getProcessor(processorId); try { this.process(dm, processor); if (DistributionStats.enableClockStats) { dm.getStats().incReplyMessageTime(DistributionStats.getStatTime()-startTime); } } catch (RuntimeException ex) { if (processor != null) { processor.cancel(getSender(), ex); } throw ex; } }
public static ReplyProcessor21 send(final InternalDistributedSystem system, final DM dm, final TXStateInterface txState, final Set<DistributedMember> recipients, final LocalRegion dataRegion, final Object regionKey, final byte originalOp, final byte originalDestroy, final boolean originalBulkOp, final Object originalValue, final Delta originalDelta) { final ReplyProcessor21 response = new ReplyProcessor21(system, recipients); final TXCleanupEntryMessage msg = new TXCleanupEntryMessage(txState, response, dataRegion.getFullPath(), regionKey, originalOp, originalDestroy, originalBulkOp, originalValue, originalDelta); msg.setRecipients(recipients); dm.putOutgoing(msg); return response; }
protected void preWait() { waiting = true; DM mgr = getDistributionManager(); statStart = mgr.getStats().startReplyWait(); synchronized (this.members) { Set activeMembers = addListenerAndGetMembers(); processActiveMembers(activeMembers); } }
/** * Waits if necessary for the computation to complete, and then retrieves its * result.<br> * If {@link Function#hasResult()} is false, upon calling * {@link ResultCollector#getResult()} throws {@link FunctionException}. * * @return the computed result * @throws FunctionException * if something goes wrong while retrieving the result */ public LinkedBlockingQueue<Object> getResult() throws FunctionException, ReplyException { this.getInvoked = true; if (this.processor != null) { this.processor.startWait(); } return this; }
/** * Call back provided to caller, which is called after function execution is * complete and caller can retrieve results using * {@link ResultCollector#getResult()} */ public final void endResults() { if (GemFireXDUtils.TraceRSIter) { SanityManager.DEBUG_PRINT(GfxdConstants.TRACE_RSITER, toString() + "#endResults: ending results by adding EOF"); } try { if (this.processor != null) { this.processor.endWait(); } } finally { offer(EOF); this.helper.closeContainers(this, true); } }
/** * Registers this processor as a membership listener and * returns a set of the current members. * @return a Set of the current members * @since 5.7 */ @Override protected Set addListenerAndGetMembers() { DistributionAdvisor da = UpdateAttributesProcessor.this.advisee.getDistributionAdvisor(); if (da.useAdminMembersForDefault()) { return getDistributionManager() .addAllMembershipListenerAndGetAllIds(this); } else { return super.addListenerAndGetMembers(); } } /**
static void sendInterestChange(DM dm, ClientProxyMembershipID clientID, ClientInterestMessageImpl msg) { ServerInterestRegistrationMessage smsg = new ServerInterestRegistrationMessage( clientID, msg); Set recipients = dm.getOtherDistributionManagerIds(); smsg.setRecipients(recipients); ReplyProcessor21 rp = new ReplyProcessor21(dm, recipients); smsg.processorId = rp.getProcessorId(); dm.putOutgoing(smsg); try { rp.waitForReplies(); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); } }