/** * Block until you can read a message. Returns null if the message * was a message chunk. * @return the message, or null if we only received a chunk of the message * @throws ClassNotFoundException * @throws IOException * @throws InterruptedException */ public DistributionMessage readMessage(Header header) throws IOException, ClassNotFoundException, InterruptedException { ByteBuffer nioInputBuffer = readAtLeast(header.nioMessageLength); this.getStats().incMessagesBeingReceived(true, header.nioMessageLength); long startSer = this.getStats().startMsgDeserialization(); try { bbis.setBuffer(nioInputBuffer); DistributionMessage msg = null; ReplyProcessor21.initMessageRPId(); // add serialization stats msg = (DistributionMessage)InternalDataSerializer.readDSFID(bbis); return msg; } finally { this.getStats().endMsgDeserialization(startSer); this.getStats().decMessagesBeingReceived(header.nioMessageLength); } }
private static void endDeserialization(long start, int bytes) { DMStats stats = InternalDistributedSystem.getDMStats(); if (stats != null) { stats.endDeserialization(start, bytes); } }
@Override public int writeMessage() throws IOException { final long startNumBytes = this.bytesWritten; final DMStats stats = this.stats; acquireLocks(); try { long start = stats.startMsgSerialization(); byte msgType = Connection.NORMAL_MSG_TYPE; if (directReply) { msgType |= Connection.DIRECT_ACK_BIT; } putByte(msgType); InternalDataSerializer.writeDSFID(msg, this); stats.endMsgSerialization(start); flush(); } finally { releaseLocks(); } if (msg.containsRegionContentChange()) { final ArrayList<Connection> connections = this.connections; final int numConnections = connections.size(); for (int i = 0; i < numConnections; i++) { connections.get(i).messagesSent.incrementAndGet(); } } return (int)(this.bytesWritten - startNumBytes); }
@Override protected synchronized Object basicGetObject() { DMStats stats = InternalDataSerializer.getDMStats(null); long start = stats.startPdxInstanceDeserialization(); try { return super.basicGetObject(); } finally { stats.endPdxInstanceDeserialization(start); } }
try { final DMStats stats = this.owner.getConduit().stats; final long threadStart = stats.startAsyncThread(); try { stats.incAsyncQueues(1); stats.incAsyncThreads(1); long flushStart = stats.startAsyncQueueFlush(); try { long curQueuedBytes = this.queuedBytes; LocalizedStrings.Connection_QUEUED_BYTES_0_EXCEEDS_MAX_OF_1_ASKING_SLOW_RECEIVER_2_TO_DISCONNECT, new Object[]{ curQueuedBytes, this.asyncMaxQueueSize, this.remoteAddr})); stats.incAsyncQueueSizeExceeded(1); disconnectSlowReceiver(); return; stats.endAsyncQueueFlush(flushStart); stats.incAsyncQueueSize(-this.queuedBytes); this.queuedBytes = 0; stats.endAsyncThread(threadStart); stats.incAsyncThreads(-1); stats.incAsyncQueues(-1); if (logger.isDebugEnabled()) { logger.debug("runNioPusher terminated id={} from {}/{}", conduitIdStr, remoteAddr, remoteAddr);
if (DistributionStats.enableClockStats) { time = DistributionStats.getStatTime(); dm.getStats().incMessageProcessingScheduleTime(time-getTimestamp()); dm.getStats().decMessagesBeingReceived(this.bytesRead); dm.getStats().incProcessedMessages(1L); if (DistributionStats.enableClockStats) { dm.getStats().incProcessedMessagesTime(time);
byte[] buf = jgmsg.getRawBuffer(); try { long start = services.getStatistics().startMsgDeserialization(); services.getStatistics().endMsgDeserialization(start);
long startSer = theStats.startMsgSerialization(); Message jmsg = createJGMessage(msg, local, Version.CURRENT_ORDINAL); theStats.endMsgSerialization(startSer); jmsg.setFlag(Message.Flag.NO_RELIABILITY); theStats.incSentBytes(jmsg.getLength()); logger.trace("Sending JGroups message: {}", jmsg); myChannel.send(jmsg); long startSer = theStats.startMsgSerialization(); boolean firstMessage = true; for (Iterator<GMSMember> it=calculatedMembers.iterator(); it.hasNext(); ) { messages.put(version, jmsg); if (firstMessage) { theStats.incSentBytes(jmsg.getLength()); firstMessage = false; theStats.endMsgSerialization(startSer); Collections.shuffle(calculatedMembers); int i=0;
if (this.finishedConnecting) { if (this.isReceiver) { stats.decReceivers(); } else { stats.decSenders(this.sharedResource, this.preserveOrder);
long readAckStart = 0; if (stats != null) { readAckStart = stats.startReplyWait(); } finally { if (stats != null) { stats.endReplyWait(readAckStart, startTime);
protected void postWait() { startedWaiting = false; if (this.listenerAdded) { removeListener(); this.listenerAdded = false; } final DM mgr = getDistributionManager(); mgr.getStats().endReplyWait(this.statStart, this.initTime); checkCancellationInPostWait(mgr); }
this.stats.endMsgSerialization(this.serStartTime); for (Iterator it=this.cons.iterator(); it.hasNext();) { Connection con = (Connection)it.next();
try { final DMStats stats = this.owner.getConduit().stats; final long threadStart = stats.startAsyncThread(); try { stats.incAsyncQueues(1); stats.incAsyncThreads(1); long flushStart = stats.startAsyncQueueFlush(); try { long curQueuedBytes = this.queuedBytes; new Object[]{ curQueuedBytes, this.asyncMaxQueueSize, this.remoteAddr}, null); stats.incAsyncQueueSizeExceeded(1); disconnectSlowReceiver(); return; stats.endAsyncQueueFlush(flushStart); stats.incAsyncQueueSize(-this.queuedBytes); this.queuedBytes = 0; stats.endAsyncThread(threadStart); stats.incAsyncThreads(-1); stats.incAsyncQueues(-1); if (logger.fineEnabled()) { logger.fine("runNioPusher terminated " + " id=" + conduitIdStr
if (this.timeStatsEnabled) { time = DistributionStats.getStatTimeNoCheck(); dm.getStats().incMessageProcessingScheduleTime(time-getTimestamp()); dm.getStats().decMessagesBeingReceived(this.bytesRead); dm.getStats().incProcessedMessages(1L); if (this.timeStatsEnabled) { dm.getStats().incProcessedMessagesTime(time);
DataInputStream dis = v == null ? new DataInputStream(this.is) : new VersionedDataInputStream(this.is, v); long startSer = this.stats.startMsgDeserialization(); setResult((DistributionMessage)InternalDataSerializer.readDSFID(dis)); this.stats.endMsgDeserialization(startSer);
@Override protected synchronized Object basicGetObject() { DMStats stats = InternalDataSerializer.getDMStats(null); long start = stats.startPdxInstanceDeserialization(); try { return super.basicGetObject(); } finally { stats.endPdxInstanceDeserialization(start); } }
if (this.finishedConnecting) { if (this.isReceiver) { stats.decReceivers(); } else { stats.decSenders(this.sharedResource, this.preserveOrder);
long readAckStart = 0; if (stats != null) { readAckStart = stats.startReplyWait(); } finally { if (stats != null) { stats.endReplyWait(readAckStart, startTime);
protected void postWait() { waiting = false; removeListener(); final DM mgr = getDistributionManager(); mgr.getStats().endReplyWait(this.statStart, this.initTime); // Make sure that a cancellation check occurs. // TODO there may be a more elegant place to put this... mgr.getCancelCriterion().checkCancelInProgress(null); }
this.stats.endMsgSerialization(this.serStartTime); for (Iterator it=this.cons.iterator(); it.hasNext();) { Connection con = (Connection)it.next();