org.jgroups.protocols
Class AUTOCONF

java.lang.Object
  extended by org.jgroups.stack.Protocol
      extended by 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

Field Summary
 
Fields inherited from class org.jgroups.stack.Protocol
down_prot, log, props, stack, stats, up_prot
 
Constructor Summary
AUTOCONF()
           
 
Method Summary
 java.lang.String getName()
           
 void init()
          Called after instance has been created (null constructor) and before protocol is started.
static void main(java.lang.String[] args)
           
 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).
static int senseMaxFragSizeStatic()
           
 boolean setProperties(java.util.Properties props)
          Setup the Protocol instance acording to the configuration string
 void start()
          This method is called on a Channel.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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AUTOCONF

public AUTOCONF()
Method Detail

getName

public java.lang.String getName()
Specified by:
getName in class Protocol

init

public void init()
          throws java.lang.Exception
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.

Overrides:
init in class Protocol
Throws:
java.lang.Exception - Thrown if protocol cannot be initialized successfully. This will cause the ProtocolStack to fail, so the channel constructor will throw an exception

start

public void start()
           throws java.lang.Exception
Description copied from class: Protocol
This method is called on a Channel.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 class Protocol
Throws:
java.lang.Exception - Thrown if protocol cannot be started successfully. This will cause the ProtocolStack to fail, so Channel.connect(String) will throw an exception

setProperties

public boolean setProperties(java.util.Properties props)
Setup the Protocol instance acording to the configuration string

Overrides:
setProperties in class Protocol

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)


Copyright © 1998-2008 Bela Ban. All Rights Reserved.