|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jgroups.stack.Protocol org.jgroups.protocols.Discovery org.jgroups.protocols.FILE_PING
public class 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
Nested Class Summary | |
---|---|
protected class |
FILE_PING.WriterTask
|
Nested classes/interfaces inherited from class org.jgroups.protocols.Discovery |
---|
Discovery.Responses |
Field Summary | |
---|---|
protected java.io.FilenameFilter |
filter
|
protected long |
interval
|
protected java.lang.String |
location
|
protected java.io.File |
root_dir
|
protected static java.lang.String |
SUFFIX
|
Fields inherited from class org.jgroups.protocols.Discovery |
---|
break_on_coord_rsp, current_coord, force_sending_discovery_rsps, group_addr, is_coord, is_leaving, is_server, local_addr, members, num_discovery_requests, num_initial_members, num_initial_srv_members, ping_responses, return_entire_cache, stagger_timeout, timeout, timer, use_disk_cache, view |
Fields inherited from class org.jgroups.stack.Protocol |
---|
down_prot, ergonomics, id, log, name, stack, stats, up_prot |
Constructor Summary | |
---|---|
FILE_PING()
|
Method Summary | |
---|---|
protected static java.lang.String |
addressAsString(Address address)
|
protected void |
createRootDir()
|
java.lang.Object |
down(Event evt)
An event is to be sent down the stack. |
java.util.Collection<PhysicalAddress> |
fetchClusterMembers(java.lang.String cluster_name)
Grab all current cluster members |
protected void |
handleView(View view)
|
void |
init()
Called after instance has been created (null constructor) and before protocol is started. |
boolean |
isDynamic()
|
protected java.util.List<PingData> |
readAll(java.lang.String clustername)
Reads all information from the given directory under clustername |
protected void |
remove(java.lang.String clustername,
Address addr)
|
boolean |
sendDiscoveryRequestsInParallel()
Whether or not to send each discovery request on a separate (timer) thread. |
void |
start()
This method is called on a Channel.connect(String) . |
void |
stop()
This method is called on a Channel.disconnect() . |
protected void |
writeToFile(PingData data,
java.lang.String clustername)
|
Methods inherited from class org.jgroups.stack.Protocol |
---|
destroy, dumpStats, enableStats, getConfigurableObjects, getDownProtocol, getDownServices, getId, getIdsAbove, getLevel, getName, getProtocolStack, getSocketFactory, getThreadFactory, getTransport, getUpProtocol, getUpServices, getValue, isErgonomics, printStats, providedDownServices, requiredDownServices, requiredUpServices, resetStatistics, setDownProtocol, setErgonomics, setId, setLevel, setProtocolStack, setSocketFactory, setUpProtocol, setValue, setValues, statsEnabled |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final java.lang.String SUFFIX
protected java.lang.String location
protected long interval
protected java.io.File root_dir
protected java.io.FilenameFilter filter
Constructor Detail |
---|
public FILE_PING()
Method Detail |
---|
public void init() throws java.lang.Exception
Protocol
init
in class Discovery
java.lang.Exception
- Thrown if protocol cannot be initialized successfully. This will cause the
ProtocolStack to fail, so the channel constructor will throw an exceptionpublic void start() throws java.lang.Exception
Protocol
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.
start
in class Discovery
java.lang.Exception
- Thrown if protocol cannot be started successfully. This will cause the ProtocolStack
to fail, so Channel.connect(String)
will throw an exceptionpublic void stop()
Protocol
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
stop
in class Discovery
public boolean isDynamic()
isDynamic
in class Discovery
public java.util.Collection<PhysicalAddress> fetchClusterMembers(java.lang.String cluster_name)
Discovery
fetchClusterMembers
in class Discovery
public boolean sendDiscoveryRequestsInParallel()
Discovery
Discovery.fetchClusterMembers(String)
sequentially
sendDiscoveryRequestsInParallel
in class Discovery
public java.lang.Object down(Event evt)
Discovery
PassDown
. 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 using up_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.
down
in class Discovery
protected void createRootDir()
protected void handleView(View view)
protected void remove(java.lang.String clustername, Address addr)
protected java.util.List<PingData> readAll(java.lang.String clustername)
protected void writeToFile(PingData data, java.lang.String clustername)
protected static java.lang.String addressAsString(Address address)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |