Package org.jgroups.protocols
Class AUTOCONF
- java.lang.Object
-
- org.jgroups.stack.Protocol
-
- org.jgroups.protocols.AUTOCONF
-
public class AUTOCONF extends Protocol
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
-
-
Constructor Summary
Constructors Constructor Description AUTOCONF()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetName()voidinit()Called after instance has been created (null constructor) and before protocol is started.static voidmain(java.lang.String[] args)intsenseMaxFragSize()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 intsenseMaxFragSizeStatic()booleansetProperties(java.util.Properties props)Setup the Protocol instance acording to the configuration stringvoidstart()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
-
-
-
-
Method Detail
-
init
public void init() throws java.lang.ExceptionDescription copied from class:ProtocolCalled 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
public void start() throws java.lang.ExceptionDescription copied from class:ProtocolThis 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:
startin classProtocol- Throws:
java.lang.Exception- Thrown if protocol cannot be started successfully. This will cause the ProtocolStack to fail, soChannel.connect(String)will throw an exception
-
setProperties
public boolean setProperties(java.util.Properties props)
Setup the Protocol instance acording to the configuration string- Overrides:
setPropertiesin 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
public static void main(java.lang.String[] args)
-
-