public long getNumMessagesSent() {return msg_stats.getNumMsgsSent();} public TP incrBatchesSent(int delta) {if(stats) msg_stats.incrNumBatchesSent(delta); return this;}
public void run() { if(batch == null || (!batch.multicast() && tp.unicastDestMismatch(batch.dest()))) return; if(tp.statsEnabled()) { int batch_size=batch.size(); MsgStats msg_stats=tp.getMessageStats(); if(batch.getMode() == MessageBatch.Mode.OOB) msg_stats.incrNumOOBMsgsReceived(batch_size); else if(batch.getMode() == MessageBatch.Mode.INTERNAL) msg_stats.incrNumInternalMsgsReceived(batch_size); else msg_stats.incrNumMsgsReceived(batch_size); msg_stats.incrNumBatchesReceived(1); msg_stats.incrNumBytesReceived(batch.length()); tp.avgBatchSize().add(batch_size); } passBatchUp(); }
public TP incrBatchesSent(int delta) {if(stats) msg_stats.incrNumBatchesSent(delta); return this;} public TP incrNumSingleMsgsSent(int d) {if(stats) msg_stats.incrNumSingleMsgsSent(d); return this;}
public void doSend(byte[] buf, int offset, int length, Address dest) throws Exception { if(stats) { msg_stats.incrNumMsgsSent(1); msg_stats.incrNumBytesSent(length); } if(dest == null) sendMulticast(buf, offset, length); else sendToSingleMember(dest, buf, offset, length); }
public boolean submitToThreadPool(Executor pool, Runnable task, boolean spawn_thread_on_rejection, boolean forward_to_internal_pool) { try { pool.execute(task); } catch(RejectedExecutionException ex) { if(!spawn_thread_on_rejection) { msg_stats.incrNumRejectedMsgs(1); return false; } if(forward_to_internal_pool && internal_pool != null) return submitToThreadPool(internal_pool, task, true, false); else { msg_stats.incrNumThreadsSpawned(1); return runInNewThread(task); } } catch(Throwable t) { log.error("failure submitting task to thread pool", t); msg_stats.incrNumRejectedMsgs(1); return false; } return true; }
/** * Removes messages with flags DONT_BUNDLE and OOB set and executes them in the oob or internal thread pool. JGRP-1737 */ protected void removeAndDispatchNonBundledMessages(MessageBatch oob_batch) { if(oob_batch == null) return; AsciiString tmp=oob_batch.clusterName(); byte[] cname=tmp != null? tmp.chars() : null; for(Iterator<Message> it=oob_batch.iterator(); it.hasNext();) { Message msg=it.next(); if(msg.isFlagSet(Message.Flag.DONT_BUNDLE) && msg.isFlagSet(Message.Flag.OOB)) { boolean internal=msg.isFlagSet(Message.Flag.INTERNAL); it.remove(); if(tp.statsEnabled()) tp.getMessageStats().incrNumOOBMsgsReceived(1); tp.submitToThreadPool(new SingleMessageHandlerWithClusterName(msg, cname), internal); } } }
public void doSend(byte[] buf, int offset, int length, Address dest) throws Exception { if(stats) { msg_stats.incrNumMsgsSent(1); msg_stats.incrNumBytesSent(length); } if(dest == null) sendMulticast(buf, offset, length); else sendToSingleMember(dest, buf, offset, length); }
public boolean submitToThreadPool(Executor pool, Runnable task, boolean spawn_thread_on_rejection, boolean forward_to_internal_pool) { try { pool.execute(task); } catch(RejectedExecutionException ex) { if(!spawn_thread_on_rejection) { msg_stats.incrNumRejectedMsgs(1); return false; } if(forward_to_internal_pool && internal_pool != null) return submitToThreadPool(internal_pool, task, true, false); else { msg_stats.incrNumThreadsSpawned(1); return runInNewThread(task); } } catch(Throwable t) { log.error("failure submitting task to thread pool", t); msg_stats.incrNumRejectedMsgs(1); return false; } return true; }
/** * Removes messages with flags DONT_BUNDLE and OOB set and executes them in the oob or internal thread pool. JGRP-1737 */ protected void removeAndDispatchNonBundledMessages(MessageBatch oob_batch) { if(oob_batch == null) return; AsciiString tmp=oob_batch.clusterName(); byte[] cname=tmp != null? tmp.chars() : null; for(Iterator<Message> it=oob_batch.iterator(); it.hasNext();) { Message msg=it.next(); if(msg.isFlagSet(Message.Flag.DONT_BUNDLE) && msg.isFlagSet(Message.Flag.OOB)) { boolean internal=msg.isFlagSet(Message.Flag.INTERNAL); it.remove(); if(tp.statsEnabled()) tp.getMessageStats().incrNumOOBMsgsReceived(1); tp.submitToThreadPool(new SingleMessageHandlerWithClusterName(msg, cname), internal); } } }
public void run() { Address dest=msg.getDest(); boolean multicast=dest == null; try { if(tp.statsEnabled()) { MsgStats msg_stats=tp.getMessageStats(); if(msg.isFlagSet(Message.Flag.OOB)) msg_stats.incrNumOOBMsgsReceived(1); else if(msg.isFlagSet(Message.Flag.INTERNAL)) msg_stats.incrNumInternalMsgsReceived(1); else msg_stats.incrNumMsgsReceived(1); msg_stats.incrNumBytesReceived(msg.getLength()); } byte[] cname=getClusterName(); tp.passMessageUp(msg, cname, true, multicast, true); } catch(Throwable t) { log.error(Util.getMessage("PassUpFailure"), t); } }
public long getNumMessagesSent() {return msg_stats.getNumMsgsSent();} public TP incrBatchesSent(int delta) {if(stats) msg_stats.incrNumBatchesSent(delta); return this;}
public TP incrBatchesSent(int delta) {if(stats) msg_stats.incrNumBatchesSent(delta); return this;} public TP incrNumSingleMsgsSent(int d) {if(stats) msg_stats.incrNumSingleMsgsSent(d); return this;}
public void run() { if(batch == null || (!batch.multicast() && tp.unicastDestMismatch(batch.dest()))) return; if(tp.statsEnabled()) { int batch_size=batch.size(); MsgStats msg_stats=tp.getMessageStats(); if(batch.getMode() == MessageBatch.Mode.OOB) msg_stats.incrNumOOBMsgsReceived(batch_size); else if(batch.getMode() == MessageBatch.Mode.INTERNAL) msg_stats.incrNumInternalMsgsReceived(batch_size); else msg_stats.incrNumMsgsReceived(batch_size); msg_stats.incrNumBatchesReceived(1); msg_stats.incrNumBytesReceived(batch.length()); tp.avgBatchSize().add(batch_size); } passBatchUp(); }
public void run() { Address dest=msg.getDest(); boolean multicast=dest == null; try { if(tp.statsEnabled()) { MsgStats msg_stats=tp.getMessageStats(); if(msg.isFlagSet(Message.Flag.OOB)) msg_stats.incrNumOOBMsgsReceived(1); else if(msg.isFlagSet(Message.Flag.INTERNAL)) msg_stats.incrNumInternalMsgsReceived(1); else msg_stats.incrNumMsgsReceived(1); msg_stats.incrNumBytesReceived(msg.getLength()); } byte[] cname=getClusterName(); tp.passMessageUp(msg, cname, true, multicast, true); } catch(Throwable t) { log.error(Util.getMessage("PassUpFailure"), t); } }