Package org.jgroups.protocols
Class FILE_PING
java.lang.Object
org.jgroups.stack.Protocol
org.jgroups.protocols.Discovery
org.jgroups.protocols.FILE_PING
Simple discovery protocol which uses a file on shared storage such as an SMB share, NFS mount or S3. The local
address information, e.g. UUID and physical addresses mappings are written to the file and the content is read and
added to our transport's UUID-PhysicalAddress cache.
The design is at doc/design/FILE_PING.txt
- Author:
- Bela Ban
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class org.jgroups.protocols.Discovery
Discovery.Responses -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected FilenameFilterprotected longprotected Stringprotected Fileprotected static final StringFields inherited from class org.jgroups.protocols.Discovery
group_addr, local_addr, members, ping_responses, rank, timer, view -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected StringaddressAsString(Address address) protected voidAn event is to be sent down the stack.protected voidhandleView(View view) voidinit()Called after instance has been created (null constructor) and before protocol is started.Reads all information from the given directory under clusternameprotected static PingDataprotected voidvoidsendGetMembersRequest(String cluster_name, Promise promise, boolean return_views_only) voidstart()This method is called on aChannel.connect(String).voidstop()This method is called on aChannel.disconnect().protected voidwriteToFile(PingData data, String clustername) Methods inherited from class org.jgroups.protocols.Discovery
discoveryRequestReceived, findAllMembers, findAllViews, findAllViewsAsString, findInitialMembers, findInitialMembers, findInitialMembersAsString, getNumberOfDiscoveryRequestsSent, getNumInitialMembers, getNumPingRequests, getTimeout, getView, handleConnect, handleDisconnect, makeView, providedUpServices, resetStats, setNumInitialMembers, setNumPingRequests, setTimeout, upMethods inherited from class org.jgroups.stack.Protocol
destroy, 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
-
Field Details
-
SUFFIX
- See Also:
-
location
-
interval
protected long interval -
root_dir
-
filter
-
-
Constructor Details
-
FILE_PING
public FILE_PING()
-
-
Method Details
-
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 -
sendGetMembersRequest
public void sendGetMembersRequest(String cluster_name, Promise promise, boolean return_views_only) throws Exception - Specified by:
sendGetMembersRequestin classDiscovery- Throws:
Exception
-
down
Description copied from class:DiscoveryAn event is to be sent down the stack. The layer may want to examine its type and perform some action on it, depending on the event's type. If the event is a message MSG, then the layer may need to add a header to it (or do nothing at all) before sending it down the stack usingPassDown. In case of a GET_ADDRESS event (which tries to retrieve the stack's address from one of the bottom layers), the layer may need to send a new response event back up the stack usingup_prot.up(). The PING protocol is interested in several different down events, Event.FIND_INITIAL_MBRS - sent by the GMS layer and expecting a GET_MBRS_OK Event.TMP_VIEW and Event.VIEW_CHANGE - a view change event Event.BECOME_SERVER - called after client has joined and is fully working group member Event.CONNECT, Event.DISCONNECT. -
createRootDir
protected void createRootDir() -
handleView
-
remove
-
readAll
Reads all information from the given directory under clustername- Returns:
-
readFile
-
writeToFile
-
addressAsString
-