Package org.jgroups.protocols
Class AUTOCONF
java.lang.Object
org.jgroups.stack.Protocol
org.jgroups.protocols.AUTOCONF
Senses the network configuration when it is initialized (in init()) and sends a CONFIG event up
and down the stack. The CONFIG event contains a hashmap, with strings as keys (e.g. "frag_size")
and Objects as values. Certain protocols can set some of their properties when receiving the CONFIG
event.
This protocol should be placed above the transport protocol (e.g. UDP). It is not needed for TCP.
Example: senses the network send and receive buffers, plus the max size of a message to be sent and generates a CONFIG event containing "frag_size", "send_buf_size" and "receive_buf_size" keys.
- Author:
- Bela Ban
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetName()
void
init()
Called after instance has been created (null constructor) and before protocol is started.static void
int
Tries to find out the max number of bytes in a DatagramPacket we can send by sending increasingly larger packets, until there is an exception (e.g., java.io.IOException: message too long).static int
boolean
setProperties
(Properties props) Setup the Protocol instance acording to the configuration stringvoid
start()
This method is called on aChannel.connect(String)
.Methods inherited from class org.jgroups.stack.Protocol
destroy, down, downThreadEnabled, dumpStats, enableStats, getDownProtocol, getProperties, getProtocolStack, getThreadFactory, getTransport, getUpProtocol, printStats, providedDownServices, providedUpServices, requiredDownServices, requiredUpServices, resetStats, setDownProtocol, setPropertiesInternal, setProtocolStack, setUpProtocol, statsEnabled, stop, up, upThreadEnabled
-
Constructor Details
-
AUTOCONF
public AUTOCONF()
-
-
Method Details
-
getName
-
init
Description copied from class:Protocol
Called after instance has been created (null constructor) and before protocol is started. Properties are already set. Other protocols are not yet connected and events cannot yet be sent. -
start
Description copied from class:Protocol
This method is called on aChannel.connect(String)
. Starts work. Protocols are connected and queues are ready to receive events. Will be called from bottom to top. This call will replace the START and START_OK events.- Overrides:
start
in classProtocol
- Throws:
Exception
- Thrown if protocol cannot be started successfully. This will cause the ProtocolStack to fail, soChannel.connect(String)
will throw an exception
-
setProperties
Setup the Protocol instance acording to the configuration string- Overrides:
setProperties
in classProtocol
-
senseMaxFragSizeStatic
public static int senseMaxFragSizeStatic() -
senseMaxFragSize
public int senseMaxFragSize()Tries to find out the max number of bytes in a DatagramPacket we can send by sending increasingly larger packets, until there is an exception (e.g., java.io.IOException: message too long). -
main
-