org.jgroups.protocols

Class TCPGOSSIP


public class TCPGOSSIP
extends Discovery

The TCPGOSSIP protocol layer retrieves the initial membership (used by the GMS when started by sending event FIND_INITIAL_MBRS down the stack). We do this by contacting one or more GossipServers, which must be running at well-known addresses:ports. The responses should allow us to determine the coordinator whom we have to contact, e.g. in case we want to join the group. When we are a server (after having received the BECOME_SERVER event), we'll respond to TCPGOSSIP requests with a TCPGOSSIP response.

The FIND_INITIAL_MBRS event will eventually be answered with a FIND_INITIAL_MBRS_OK event up the stack.

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
handleConnectOK()
Called when CONNECT_OK has been received
void
sendGetMembersRequest()
boolean
setProperties(Properties props)
sets the properties of the PING protocol.
void
start()
This method is called on a Channel.connect(String).
void
stop()
This method is called on a Channel.disconnect().

Methods inherited from class org.jgroups.protocols.Discovery

down, findInitialMembers, findInitialMembersAsString, getNumInitialMembers, getNumPingRequests, getNumberOfDiscoveryRequestsSent, getTimeout, handleConnect, handleConnectOK, handleDisconnect, localAddressSet, makeView, providedUpServices, resetStats, sendGetMembersRequest, setNumInitialMembers, setNumPingRequests, setProperties, setTimeout, start, stop, up

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

handleConnectOK

public void handleConnectOK()
Called when CONNECT_OK has been received
Overrides:
handleConnectOK in interface Discovery

sendGetMembersRequest

public void sendGetMembersRequest()
Overrides:
sendGetMembersRequest in interface Discovery

setProperties

public boolean setProperties(Properties props)
sets the properties of the PING protocol. The following properties are available property: timeout - the timeout (ms) to wait for the initial members, default is 3000=3 secs property: num_initial_members - the minimum number of initial members for a FIND_INITAL_MBRS, default is 2
Overrides:
setProperties in interface Discovery
Parameters:
props - - a property set
Returns:
returns true if all properties were parsed properly returns false if there are unrecnogized properties in the property set

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 Discovery

stop

public void stop()
This method is called on a Channel.disconnect(). Stops work (e.g. by closing multicast socket). Will be called from top to bottom. This means that at the time of the method invocation the neighbor protocol below is still working. This method will replace the STOP, STOP_OK, CLEANUP and CLEANUP_OK events. The ProtocolStack guarantees that when this method is called all messages in the down queue will have been flushed
Overrides:
stop in interface Discovery

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