/** * Adds the distribution manager that is started up to the current DM's list of members. * * This method is invoked on the receiver side */ @Override protected void process(ClusterDistributionManager dm) { Assert.assertTrue(this.id != null); ReplyMessage reply = new ReplyMessage(); reply.setProcessorId(processorId); reply.setRecipient(getSender()); dm.putOutgoing(reply); }
@Override public void process(DistributionMessage msg) { ReplyMessage reply = (ReplyMessage) msg; if (reply.getException() != null) { Throwable cause = reply.getException().getCause(); if (cause instanceof ForceReattemptException || cause instanceof CancelException) { // TODO do we need to resend to these recipients? Might they have clients that won't // otherwise get // the GC message? // this.forceReattemptSenders.add(reply.getSender()); reply.setException(null); } } super.process(reply); } }
/** * Processes this message. This method is invoked by the receiver of the message if the message is * not direct ack. If the message is a direct ack, the process(dm, ReplyProcessor) method is * invoked instead. * * @param dm the distribution manager that is processing the message. */ @Override protected void process(final ClusterDistributionManager dm) { dmProcess(dm); }
@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); } }
ReplyMessage replyMsg = new ReplyMessage(); replyMsg.setRecipient(getSender()); replyMsg.setProcessorId(this.processorId); if (replyException != null) { replyMsg.setException(replyException);
@Override protected void process(ClusterDistributionManager dm) { Object result = null; ReplyException replyException = null; try { if (logger.isDebugEnabled()) { logger.debug("{}: Providing synchronization region={}; entriesToSynchronize={}", getClass().getSimpleName(), this.regionPath, this.entriesToSynchronize); } result = getSynchronizationEvents(); } catch (Throwable t) { replyException = new ReplyException(t); } finally { ReplyMessage replyMsg = new ReplyMessage(); replyMsg.setRecipient(getSender()); replyMsg.setProcessorId(this.processorId); if (replyException == null) { replyMsg.setReturnValue(result); } else { replyMsg.setException(replyException); } if (logger.isDebugEnabled()) { logger.debug("{}: Sending synchronization reply returnValue={}; exception={}", getClass().getSimpleName(), replyMsg.getReturnValue(), replyMsg.getException()); } dm.putOutgoing(replyMsg); } }
/** Send an ack */ public static void send(InternalDistributedMember recipient, int processorId, Object returnValue, ReplySender dm) { Assert.assertTrue(recipient != null, "Sending a ReplyMessage to ALL"); ReplyMessage m = new ReplyMessage(); m.processorId = processorId; if (returnValue != null) { m.returnValue = returnValue; m.returnValueIsException = false; } m.setRecipient(recipient); dm.putOutgoing(m); }
@Override public void fromData(DataInput in) throws IOException, ClassNotFoundException { super.fromData(in); }
msg.setBytesRead(len); msg.setSender(remoteAddr); stats.incReceivedMessages(1L); stats.incReceivedBytes(msg.getBytesRead()); stats.incMessageChannelTime(msg.resetTimestamp()); msg.process(dm, processor);
protected StringBuilder getStringBuilder() { StringBuilder sb = new StringBuilder(); sb.append(getShortClassName()); sb.append(" processorId="); sb.append(this.processorId); sb.append(" from "); sb.append(this.getSender()); ReplyException ex = getException(); if (ex != null) { if (ex.getCause() != null && ex.getCause() instanceof InvalidDeltaException) { sb.append(" with request for full value"); } else { sb.append(" with exception "); sb.append(ex); } } return sb; }
@Test public void testDataSerializableFixedIDByte() throws IOException { DataSerializableFixedID value = new ReplyMessage(); ByteArrayOutputStream baos = new ByteArrayOutputStream(); DataOutputStream out = new DataOutputStream(baos); InternalDataSerializer.writeDSFID(value, out); byte[] bytes = baos.toByteArray(); String type = DataType.getDataType(bytes); assertEquals( "org.apache.geode.internal.DataSerializableFixedID:" + ReplyMessage.class.getName(), type); }
/** * Constructor for index creation reply message. * * @param processorId processor id of the waiting processor * @param ex any exceptions * @param result ture if indexes removed properly else false * @param numBucketsIndexesRemoved number of buckets indexed. * @param numTotalBuckets number of total buckets. */ RemoveIndexesReplyMessage(int processorId, ReplyException ex, boolean result, int numBucketsIndexesRemoved, int numTotalBuckets) { super(); super.setException(ex); this.result = result; this.numBucketsIndexesRemoved = numBucketsIndexesRemoved; this.numTotalBuckets = numTotalBuckets; setProcessorId(processorId); }
@Override public void process(DistributionMessage msg) { if (msg instanceof GrantorInfoReplyMessage) { GrantorInfoReplyMessage giMsg = (GrantorInfoReplyMessage) msg; this.result = giMsg.getGrantorInfo(); } else if (msg instanceof ReplyMessage) { if (((ReplyMessage) msg).getException() == null) { // must be a reply sent back from a CLEAR_OP this.result = CLEAR_COMPLETE; } } else { Assert.assertTrue(false, "Expected instance of GrantorInfoReplyMessage or CReplyMessage but got " + msg.getClass()); } super.process(msg); }
@Override protected void process(final DistributionMessage dmsg, boolean warn) { if (dmsg instanceof ReplyMessage) { ReplyMessage replyMessage = (ReplyMessage) dmsg; if (msg != null) { boolean discard = !msg.processReply(replyMessage, this); if (discard) { return; } } if (replyMessage.getClosed()) { closedMembers.add(replyMessage.getSender()); } } super.process(dmsg, warn); }
if (reply.getException() != null) { if (isGiiDebugEnabled) { logger.trace(LogMarker.INITIAL_IMAGE_VERBOSE, "Failed to get RVV from {} due to {}", reply.getSender(), reply.getException()); logger.trace(LogMarker.INITIAL_IMAGE_VERBOSE, "{} did not send back rvv. Maybe it's non-persistent proxy region or remote region {} not found or not initialized. Nothing to do.", reply.getSender(), region.getFullPath());
@Override protected void process(ClusterDistributionManager dm) { ReplyException e = null; try { InternalCache cache = dm.getCache(); if (cache != null && !cache.isClosed()) { TypeRegistry pdxRegistry = cache.getPdxRegistry(); if (pdxRegistry != null) { TypeRegistration registry = pdxRegistry.getTypeRegistration(); if (registry instanceof PeerTypeRegistration) { PeerTypeRegistration peerRegistry = (PeerTypeRegistration) registry; peerRegistry.verifyConfiguration(); } } } } catch (Exception ex) { e = new ReplyException(ex); } finally { ReplyMessage rm = new ReplyMessage(); rm.setException(e); rm.setProcessorId(processorId); rm.setRecipient(getSender()); dm.putOutgoing(rm); } }
/** Send an ack */ public static void send(InternalDistributedMember recipient, int processorId, ReplyException exception, ReplySender dm, boolean internal) { Assert.assertTrue(recipient != null, "Sending a ReplyMessage to ALL"); ReplyMessage m = new ReplyMessage(); m.processorId = processorId; if (exception != null) { m.returnValue = exception; m.returnValueIsException = true; } if (exception != null && logger.isDebugEnabled()) { Throwable cause = exception.getCause(); if (cause instanceof EntryNotFoundException) { logger.debug("Replying with entry-not-found: {}", exception.getCause().getMessage()); } else if (cause instanceof ConcurrentCacheModificationException) { logger.debug("Replying with concurrent-modification-exception"); } else if (cause instanceof CancelException) { // no need to log this - it will show up in normal debug-level logs when the reply is sent } else { logger.debug("Replying with exception: " + m, exception); } } m.setRecipient(recipient); dm.putOutgoing(m); }
@Override public void fromData(DataInput in) throws IOException, ClassNotFoundException { super.fromData(in); }
if (msg instanceof ReplyMessage) { ReplyMessage reply = (ReplyMessage) msg; if (reply.getException() == null) { if (logger.isDebugEnabled()) { logger.debug( "{}: Processing reply from member={}; regionPath={}; key={}; entriesToSynchronize={}", getClass().getSimpleName(), reply.getSender(), this.operation.region.getFullPath(), this.operation.entriesToSynchronize, reply.getReturnValue()); (List<Map<String, GatewayQueueEvent>>) reply.getReturnValue(); for (int i = 0; i < events.size(); i++) { Map<String, GatewayQueueEvent> eventsForOneEntry = events.get(i); logger.info( "Synchronization event reply from member={}; regionPath={}; key={}; entryVersion={} is empty", new Object[] {reply.getSender(), this.operation.region.getFullPath(), entry.key, entry.entryVersion});
/** * Constructor for index creation reply message. * * @param processorId processor id of the waiting processor * @param ex any exceptions * @param result true if index created properly else false * @param indexBucketsMap Map of indexes created and number of buckets indexed * @param numTotalBuckets Number of total buckets in this vm */ IndexCreationReplyMsg(int processorId, ReplyException ex, boolean result, boolean isDataStore, Map<String, Integer> indexBucketsMap, int numTotalBuckets) { super(); super.setException(ex); this.result = result; this.indexBucketsMap = indexBucketsMap; this.numTotalBuckets = numTotalBuckets; this.isDataStore = isDataStore; setProcessorId(processorId); }