public PersistentMembershipView getResult() { waitForRepliesUninterruptibly(); if (views.isEmpty()) { // TODO prperist internationalize. throw new ReplyException("Member departed"); } return views.iterator().next(); }
public boolean waitForResponse() { try { waitForRepliesUninterruptibly(); } catch (ReplyException e) { Throwable t = e.getCause(); if (t instanceof CancelException) { String msg = "MoveBucketMessage got remote cancellation,"; logger.debug(msg, t); return false; } if (t instanceof PRLocallyDestroyedException) { String msg = "MoveBucketMessage got local destroy on the PartitionRegion "; logger.debug(msg, t); return false; } if (t instanceof ForceReattemptException) { String msg = "MoveBucketMessage got ForceReattemptException due to local destroy on the PartitionRegion"; logger.debug(msg, t); return false; } e.handleCause(); } return this.moved; } }
if (getSender() == null) { return; String senderId = getSender().toString(); addSenderInfo(t, senderId);
Throwable c = getCause(); if (c == null) { throw new InternalGemFireException( String.format("unexpected exception on member %s", getSender()), this); fixUpRemoteEx(c); throw (RuntimeException) c; fixUpRemoteEx(c); throw (Error) c; getSender()), c);
@Override protected synchronized void processException(ReplyException ex) { // we have already forwarded the exception, no need to keep it here if (execution.isForwardExceptions() || this.execution.waitOnException) { return; } // have to keep all the exception // rest exception will be added to localresultcollector and it will throw // them if ((ex.getCause() instanceof CacheClosedException || ex.getCause() instanceof ForceReattemptException || ex.getCause() instanceof BucketMovedException)) { this.exception = ex; } else if (!execution.getWaitOnExceptionFlag()) { this.exception = ex; } }
removeMember(e.getSender(), true); Throwable t = e.getCause(); if (t instanceof CacheException) { throw (CacheException) t; this.execution.failedNodes.add(e.getSender().getId()); String msg = "PartitionResponse got remote CacheClosedException, throwing PartitionedRegionCommunicationException"; throw (CancelException) t; if (e.getCause() instanceof FunctionException) { throw (FunctionException) e.getCause(); e.handleCause();
public static void sendDenylistedClient(ClientProxyMembershipID proxyId, DistributionManager dm, Set members) { ClientDenylistProcessor processor = new ClientDenylistProcessor(dm, members); ClientDenylistMessage.send(proxyId, dm, processor, members); try { processor.waitForRepliesUninterruptibly(); } catch (ReplyException e) { e.handleCause(); } return; }
waitForRepliesUninterruptibly(); } catch (ReplyException e) { Throwable t = e.getCause(); if (t instanceof CancelException) { logger.debug("FetchKeysResponse got remote CacheClosedException; forcing reattempt. {}", e.getMessage(), e); throw new ForceReattemptException( "Peer requests reattempt", t); e.handleCause();
@Override protected void process(DistributionMessage message, boolean warn) { if (message instanceof AdminFailureResponse) { Exception ex = ((AdminFailureResponse) message).getCause(); if (ex != null) { ReplyException replyException = new ReplyException(ex); replyException.setSenderIfNull(message.getSender()); processException(message, replyException); } } super.process(message, warn); } }
public static void send(DistributionManager 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); } }
/** * Ignore any incoming exception from other VMs, we just want an acknowledgement that the * message was processed. */ @Override protected void processException(ReplyException ex) { logger.debug("MoveBucketMessage ignoring exception: {}", ex.getMessage(), ex); }
@Override protected void processException(ReplyException ex) { // retry on ForceReattempt in case the region is still being initialized if (ex.getRootCause() instanceof ForceReattemptException) { super.processException(ex); } // other errors are ignored else if (logger.isDebugEnabled()) { logger.debug("DestroyRegionResponse ignoring exception", ex); } } }
@Override public String getMessage() { InternalDistributedMember s = getSender(); String m = super.getMessage(); return (s != null) ? ("From " + s + ": " + m) : m; } }
/** * Adds the sender information to the stack trace elements of the given exception. Also traverses * recursively over the 'cause' for adding this sender information. * * @param toModify Throwable instance to modify the stack trace elements * @param senderId id of the sender member */ private static void addSenderInfo(Throwable toModify, String senderId) { StackTraceElement[] stackTrace = toModify.getStackTrace(); StackTraceElement element = null; for (int i = 0; i < stackTrace.length; i++) { element = stackTrace[i]; if (!element.getClassName().startsWith(REMOTE_MEMBER_TOKEN)) { stackTrace[i] = new StackTraceElement( REMOTE_MEMBER_TOKEN + " '" + senderId + "' in " + element.getClassName(), element.getMethodName(), element.getFileName(), element.getLineNumber()); } } toModify.setStackTrace(stackTrace); Throwable cause = toModify.getCause(); if (cause != null) { addSenderInfo(cause, senderId); } }
@Override public void process(DistributionMessage msg) { try { if (msg instanceof ReplyMessage) { ReplyMessage reply = (ReplyMessage) msg; if (logger.isDebugEnabled()) { logger .debug("WaitUntilGatewaySenderFlushedReplyProcessor: Processing reply from sender=" + reply.getSender() + "; returnValue=" + reply.getReturnValue() + "; exception=" + reply.getException()); } if (reply.getException() == null) { this.responses.put(reply.getSender(), (Boolean) reply.getReturnValue()); } else { reply.getException().printStackTrace(); } } } finally { super.process(msg); } }
/** * @return wait for and return the size */ public int waitForSize() { try { waitForRepliesUninterruptibly(); } catch (ReplyException e) { Throwable cause = e.getCause(); if (cause instanceof RegionDestroyedException) { RegionDestroyedException rde = (RegionDestroyedException) cause; throw rde; } throw e; } return this.returnValue; } }
Throwable t = e.getCause(); if (t instanceof RemoteOperationException) { logger.debug( "RemoteOperationResponse got CacheClosedException from {}, throwing RemoteOperationException", e.getSender(), t); e.handleCause();
@Test public void waitForRemoteResponseWithReplyExceptionWithNoCauseCallsHandleCause() throws Exception { ReplyException replyException = mock(ReplyException.class); doThrow(replyException).when(replyProcessor).waitForRepliesUninterruptibly(); replyProcessor.waitForRemoteResponse(); verify(replyException, times(1)).handleCause(); }
/** * The SizeResponse processor ignores remote exceptions by implmenting this method. Ignoring * remote exceptions is acceptable since the SizeMessage is sent to all Nodes and all * {@link SizeMessage.SizeReplyMessage}s are processed for each individual bucket size. The hope * is that any failure due to an exception will be covered by healthy Nodes. */ @Override protected void processException(ReplyException ex) { logger.debug("SizeResponse ignoring exception: {}", ex.getMessage(), ex); }
resp.waitForRepliesUninterruptibly(); } catch (ReplyException e) { if (e.getRootCause() instanceof ForceReattemptException) { return true;