Package org.jgroups.protocols
Class TCPGOSSIP
java.lang.Object
org.jgroups.stack.Protocol
org.jgroups.protocols.Discovery
org.jgroups.protocols.TCPGOSSIP
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
-
Nested Class Summary
Nested classes/interfaces inherited from class org.jgroups.protocols.Discovery
Discovery.Responses -
Field Summary
Fields inherited from class org.jgroups.protocols.Discovery
group_addr, local_addr, members, ping_responses, rank, timer, view -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddInitialHost(String hostname, int port) protected voidconnect(RouterStub stub, String group, Address logical_addr) protected voidconnectAllStubs(String group, Address logical_addr) voiddestroy()This method is called on aChannel.close().voidvoidvoidinit()Called after instance has been created (null constructor) and before protocol is started.booleanremoveInitialHost(String hostname, int port) voidsendGetMembersRequest(String cluster_name, Promise promise, boolean return_views_only) voidsetInitialHosts(List<InetSocketAddress> hosts) voidstart()This method is called on aChannel.connect(String).voidstop()This method is called on aChannel.disconnect().Methods inherited from class org.jgroups.protocols.Discovery
discoveryRequestReceived, down, findAllMembers, findAllViews, findAllViewsAsString, findInitialMembers, findInitialMembers, findInitialMembersAsString, getNumberOfDiscoveryRequestsSent, getNumInitialMembers, getNumPingRequests, getTimeout, getView, makeView, providedUpServices, resetStats, setNumInitialMembers, setNumPingRequests, setTimeout, upMethods inherited from class org.jgroups.stack.Protocol
downThreadEnabled, dumpStats, enableStats, getConfigurableObjects, getDownProtocol, getId, getLevel, getName, getProperties, getProtocolStack, getSocketFactory, getThreadFactory, getTransport, getUpProtocol, getValue, isErgonomics, printStats, providedDownServices, requiredDownServices, requiredUpServices, setDownProtocol, setErgonomics, setId, setLevel, setProperties, setPropertiesInternal, setProperty, setProtocolStack, setSocketFactory, setUpProtocol, setValue, setValues, statsEnabled, upThreadEnabled
-
Constructor Details
-
TCPGOSSIP
public TCPGOSSIP()
-
-
Method Details
-
setInitialHosts
-
getInitialHosts
-
init
Description 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
Description 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 classDiscovery- Throws:
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:ProtocolThis 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:ProtocolThis method is called on aChannel.close(). Does some cleanup; after the call the VM will terminate -
handleConnect
public void handleConnect()- Overrides:
handleConnectin classDiscovery
-
handleDisconnect
public void handleDisconnect()- Overrides:
handleDisconnectin classDiscovery
-
sendGetMembersRequest
public void sendGetMembersRequest(String cluster_name, Promise promise, boolean return_views_only) throws Exception - Specified by:
sendGetMembersRequestin classDiscovery- Throws:
Exception
-
addInitialHost
-
removeInitialHost
-
connectAllStubs
-
connect
-