org.jgroups.protocols

Class 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_handler, down_prot, down_queue, down_thread, down_thread_prio, log, observer, props, stack, stats, trace, up_handler, up_prot, up_queue, up_thread, up_thread_prio, warn

Method Summary

String
getName()
void
init()
Called after instance has been created (null constructor) and before protocol is started.
static void
main(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(Properties props)
Setup the Protocol instance acording to the configuration string
void
start()
This method is called on a Channel.connect(String).
void
startDownHandler()
Leave empty: no down_thread will be created, but the down_thread of the neighbor above us will be used
void
startUpHandler()
Leave empty: no up_thread will be created, but the up_thread of the neighbor below us will be used

Methods inherited from class org.jgroups.stack.Protocol

destroy, down, downThreadEnabled, dumpStats, enableStats, getDownProtocol, getDownQueue, getName, getProperties, getUpProtocol, getUpQueue, handleSpecialDownEvent, init, isTrace, isWarn, passDown, passUp, printStats, providedDownServices, providedUpServices, receiveDownEvent, receiveUpEvent, requiredDownServices, requiredUpServices, resetStats, setDownProtocol, setObserver, setProperties, setPropertiesInternal, setProtocolStack, setTrace, setUpProtocol, setWarn, start, startDownHandler, startUpHandler, statsEnabled, stop, stopInternal, up, upThreadEnabled

Method Details

getName

public String getName()
Overrides:
getName in interface Protocol

init

public void init()
            throws Exception
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 interface Protocol

main

public static void main(String[] args)

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).

senseMaxFragSizeStatic

public static int senseMaxFragSizeStatic()

setProperties

public boolean setProperties(Properties props)
Setup the Protocol instance acording to the configuration string
Overrides:
setProperties in interface Protocol

start

public void start()
            throws Exception
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 interface Protocol

startDownHandler

public void startDownHandler()
Leave empty: no down_thread will be created, but the down_thread of the neighbor above us will be used
Overrides:
startDownHandler in interface Protocol

startUpHandler

public void startUpHandler()
Leave empty: no up_thread will be created, but the up_thread of the neighbor below us will be used
Overrides:
startUpHandler in interface Protocol

Copyright B) 1998-2005 Bela Ban. All Rights Reserved.