org.jgroups.protocols
Class TP.DefaultBundler2

java.lang.Object
  extended by org.jgroups.protocols.TP.DefaultBundler2
All Implemented Interfaces:
TP.Bundler
Enclosing class:
TP

protected class TP.DefaultBundler2
extends java.lang.Object
implements TP.Bundler

Similarly to DefaultBundler, this bundler type uses the sender's thread to send accumulated messages. Before a message is added, a thread count is increment (and decremented when returning). If the current message would exceed the max size, the current thread sends all accumulated messages. Else, it decrements the thread count and returns if it is > 0. This means that some other sender is adding a message to the bundler and that thread (or yet some other thread) will send the accumulated messages. If the thread count is 0, the accumulated messages are sent.

The difference to DefaultBundler is that (single) messages are sent immediately when no other messages are present, ignoring max size and max time. This benefits applications which send (e.g.) synchronous RPCs that don't exceed time or size as they are sent immediately (not incurring the max time for the request and response), yet when sending many sync RPCs they are bundled (increasing performance).


Field Summary
protected  java.util.concurrent.atomic.AtomicInteger thread_cnt
           
 
Constructor Summary
protected TP.DefaultBundler2()
           
 
Method Summary
 void send(Message msg)
           
 void start()
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

thread_cnt

protected final java.util.concurrent.atomic.AtomicInteger thread_cnt
Constructor Detail

TP.DefaultBundler2

protected TP.DefaultBundler2()
Method Detail

start

public void start()
Specified by:
start in interface TP.Bundler

stop

public void stop()
Specified by:
stop in interface TP.Bundler

send

public void send(Message msg)
          throws java.lang.Exception
Specified by:
send in interface TP.Bundler
Throws:
java.lang.Exception


Copyright © 1998-2012 Bela Ban / Red Hat. All Rights Reserved.