Package org.jgroups.protocols
Class TCPGOSSIP
- java.lang.Object
-
- org.jgroups.stack.Protocol
-
- org.jgroups.protocols.Discovery
-
- org.jgroups.protocols.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 GossipRouters, 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
-
-
Constructor Summary
Constructors Constructor Description TCPGOSSIP()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
destroy()
This method is called on aChannel.close()
.java.lang.String
getName()
void
handleConnect()
void
handleDisconnect()
void
sendGetMembersRequest()
boolean
setProperties(java.util.Properties props)
sets the properties of the PING protocol.void
start()
This method is called on aChannel.connect(String)
.void
stop()
This method is called on aChannel.disconnect()
.-
Methods inherited from class org.jgroups.protocols.Discovery
down, findInitialMembers, findInitialMembersAsString, getNumberOfDiscoveryRequestsSent, getNumInitialMembers, getNumPingRequests, getTimeout, init, localAddressSet, makeView, providedUpServices, resetStats, setNumInitialMembers, setNumPingRequests, setTimeout, up
-
Methods inherited from class org.jgroups.stack.Protocol
downThreadEnabled, dumpStats, enableStats, getDownProtocol, getProperties, getProtocolStack, getThreadFactory, getTransport, getUpProtocol, printStats, providedDownServices, requiredDownServices, requiredUpServices, setDownProtocol, setPropertiesInternal, setProtocolStack, setUpProtocol, statsEnabled, upThreadEnabled
-
-
-
-
Method Detail
-
setProperties
public boolean setProperties(java.util.Properties props)
Description copied from class:Discovery
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 classDiscovery
- 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 java.lang.Exception
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 classDiscovery
- 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
-
stop
public void stop()
Description copied from class:Protocol
This method is called on aChannel.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
-
destroy
public void destroy()
Description copied from class:Protocol
This method is called on aChannel.close()
. Does some cleanup; after the call the VM will terminate
-
handleConnect
public void handleConnect()
- Overrides:
handleConnect
in classDiscovery
-
handleDisconnect
public void handleDisconnect()
- Overrides:
handleDisconnect
in classDiscovery
-
sendGetMembersRequest
public void sendGetMembersRequest()
- Specified by:
sendGetMembersRequest
in classDiscovery
-
-