/** * A wait for replies that can be overridden by child classes. */ public boolean waitForProcessedReplies() throws InterruptedException, ReplyException { return waitForReplies(0L); }
/** * Wait for all expected acks to be returned or an exception to come * in. This method will return whether a) we have received replies * from all desired members or b) the necessary conditions have been * met so that we don't need to wait anymore. * @throws InternalGemFireException if ack-threshold was exceeded and system * property "ack-threshold-exception" is set to true * @throws InterruptedException TODO-javadocs * @see #canStopWaiting() */ public final void waitForReplies() throws InterruptedException, ReplyException { boolean result = waitForReplies(0); Assert.assertTrue(result, "failed but no exception thrown"); }
/** * Wait for all expected acks to be returned or an exception to come * in. This method will return whether a) we have received replies * from all desired members or b) the necessary conditions have been * met so that we don't need to wait anymore. * @throws InternalGemFireException if ack-threshold was exceeded and system * property "ack-threshold-exception" is set to true * @throws InterruptedException TODO-javadocs * @see #canStopWaiting() */ public final void waitForReplies() throws InterruptedException, ReplyException { boolean result = waitForReplies(0); Assert.assertTrue(result, "failed but no exception thrown"); }
/** * 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); }
/** * 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); }
/** * @see #waitForReliableDelivery() * @param msecs the number of milliseconds to wait for replies * @throws ReplyException * @throws InterruptedException * @throws ReliableReplyException */ public final void waitForReliableDelivery(long msecs) throws ReplyException, InterruptedException, ReliableReplyException { super.waitForReplies(msecs); synchronized (this) { if (this.departedMembers != null) { throw new ReliableReplyException(LocalizedStrings.ReliableReplyProcessor_FAILED_TO_DELIVER_MESSAGE_TO_MEMBERS_0 .toLocalizedString(departedMembers)); } } } }
/** * @see #waitForReliableDelivery() * @param msecs the number of milliseconds to wait for replies * @throws ReplyException * @throws InterruptedException * @throws ReliableReplyException */ public final void waitForReliableDelivery(long msecs) throws ReplyException, InterruptedException, ReliableReplyException { super.waitForReplies(msecs); synchronized (this) { if (this.departedMembers != null) { throw new ReliableReplyException(LocalizedStrings.ReliableReplyProcessor_FAILED_TO_DELIVER_MESSAGE_TO_MEMBERS_0 .toLocalizedString(departedMembers)); } } } }
/** * send the message and wait for replies * @param recipients the destination manager ids * @param multicast whether to use multicast or unicast * @throws InterruptedException if the operation is interrupted (as by shutdown) * @throws ReplyException if an exception was sent back by another manager */ public void send(Set recipients, boolean multicast) throws InterruptedException, ReplyException { if (Thread.interrupted()) { throw new InterruptedException(); } this.op = operationType.DRAIN_POOL; Set recips = new HashSet(recipients); DistributedMember me = originDm.getDistributionManagerId(); if (recips.contains(me)) { recips.remove(me); } rp = new ReplyProcessor21(originDm, recips); processorId = rp.getProcessorId(); setRecipients(recips); setMulticast(multicast); originDm.putOutgoing(this); rp.waitForReplies(); }
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(); } }
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(); } }
private void sendAddCacheServerProfileMessage() { DM dm = this.getDistributedSystem().getDistributionManager(); Set otherMembers = dm.getOtherDistributionManagerIds(); AddCacheServerProfileMessage msg = new AddCacheServerProfileMessage(); msg.operateOnLocalCache(this); if (!otherMembers.isEmpty()) { if (logger.isDebugEnabled()) { logger.debug("Sending add cache server profile message to other members."); } ReplyProcessor21 rp = new ReplyProcessor21(dm, otherMembers); msg.setRecipients(otherMembers); msg.processorId = rp.getProcessorId(); dm.putOutgoing(msg); // Wait for replies. try { rp.waitForReplies(); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); } } }
private void sendFilterProfileOperation(OperationMessage msg) { Set recipients = ((CacheDistributionAdvisee)this.region).getDistributionAdvisor() .adviseProfileUpdate(); msg.setRecipients(recipients); ReplyProcessor21 rp = new ReplyProcessor21(this.region.getDistributionManager(), recipients); msg.processorId = rp.getProcessorId(); this.region.getDistributionManager().putOutgoing(msg); try { rp.waitForReplies(); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); } }
private void sendFilterProfileOperation(OperationMessage msg) { Set recipients = ((CacheDistributionAdvisee)this.region).getDistributionAdvisor() .adviseProfileUpdate(); msg.setRecipients(recipients); ReplyProcessor21 rp = new ReplyProcessor21(this.region.getDistributionManager(), recipients); msg.processorId = rp.getProcessorId(); this.region.getDistributionManager().putOutgoing(msg); try { rp.waitForReplies(); } catch (InterruptedException ie) { Thread.currentThread().interrupt(); } }
public void run() { // Send a request, wait for a response DM dm = getSystem().getDistributionManager(); int expected = dm.getOtherNormalDistributionManagerIds().size(); assertEquals("For DM " + dm.getId(), 3, expected); Response.totalResponses = 0; Request request = new Request(); ReplyProcessor21 processor = new ReplyProcessor21(getSystem(), dm.getOtherNormalDistributionManagerIds()); request.processorId = processor.getProcessorId(); dm.putOutgoing(request); try { processor.waitForReplies(); } catch (Exception ex) { fail("While waiting for replies", ex); } assertEquals(expected, Response.totalResponses); } });
private void sendAddCacheServerProfileMessage() { DM dm = this.getDistributedSystem().getDistributionManager(); Set otherMembers = dm.getOtherDistributionManagerIds(); AddCacheServerProfileMessage msg = new AddCacheServerProfileMessage(); msg.operateOnLocalCache(this); if (!otherMembers.isEmpty()) { final LogWriterI18n l = GemFireCacheImpl.this.getLoggerI18n(); if (l.fineEnabled()) { l.fine("Sending add cache server profile message to other members."); } ReplyProcessor21 rp = new ReplyProcessor21(dm, otherMembers); msg.setRecipients(otherMembers); msg.processorId = rp.getProcessorId(); dm.putOutgoing(msg); // Wait for replies. 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); }
public void run() { DM dm = getSystem().getDistributionManager(); OnlyGFDMReply message = new OnlyGFDMReply(); ReplyProcessor21 processor = new ReplyProcessor21(getSystem(), dm.getOtherNormalDistributionManagerIds()); message.processorId = processor.getProcessorId(); dm.putOutgoing(message); try { processor.waitForReplies(); } catch (Exception ex) { fail("While waiting for replies", ex); } } });
public static void send(DM dm) { Set recipients = dm.getOtherDistributionManagerIds(); ReplyProcessor21 replyProcessor = new ReplyProcessor21(dm, recipients); CheckTypeRegistryState msg = new CheckTypeRegistryState(replyProcessor.getProcessorId()); msg.setRecipients(recipients); dm.putOutgoing(msg); try { replyProcessor.waitForReplies(); } catch (ReplyException e) { if(e.getCause() instanceof PdxInitializationException) { throw new PdxInitializationException("Bad PDX configuration on member " + e.getSender() + ": " + e.getCause().getMessage(), e.getCause()); } else { throw new InternalGemFireError("Unexpected exception", e); } } catch (InterruptedException e) { throw new InternalGemFireError("Unexpected exception", e); } }
public static void send(DM dm) { Set recipients = dm.getOtherDistributionManagerIds(); ReplyProcessor21 replyProcessor = new ReplyProcessor21(dm, recipients); CheckTypeRegistryState msg = new CheckTypeRegistryState(replyProcessor.getProcessorId()); msg.setRecipients(recipients); dm.putOutgoing(msg); try { replyProcessor.waitForReplies(); } catch (ReplyException e) { if(e.getCause() instanceof PdxInitializationException) { throw new PdxInitializationException("Bad PDX configuration on member " + e.getSender() + ": " + e.getCause().getMessage(), e.getCause()); } else { throw new InternalGemFireError("Unexpected exception", e); } } catch (InterruptedException e) { throw new InternalGemFireError("Unexpected exception", e); } }
public static void send(DistributionManager dm) throws InterruptedException { long viewId = dm.getMembershipManager().getView().getViewNumber(); 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 (dm.getLoggerI18n().fineEnabled()) { dm.getLoggerI18n().fine("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); }