org.jgroups.protocols
public class FILE_PING extends Discovery
Modifier and Type | Class and Description |
---|---|
protected class |
FILE_PING.WriterTask |
Discovery.Responses
Modifier and Type | Field and Description |
---|---|
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 |
group_addr, local_addr, members, ping_responses, rank, timer, view
Constructor and Description |
---|
FILE_PING() |
Modifier and Type | Method and Description |
---|---|
protected java.lang.String |
addressAsString(Address address) |
protected void |
createRootDir() |
java.lang.Object |
down(Event evt)
An event is to be sent down the stack.
|
protected void |
handleView(View view) |
void |
init()
Called after instance has been created (null constructor) and before protocol is started.
|
protected java.util.List<PingData> |
readAll(java.lang.String clustername)
Reads all information from the given directory under clustername
|
protected static PingData |
readFile(java.io.File file) |
protected void |
remove(java.lang.String clustername,
Address addr) |
void |
sendGetMembersRequest(java.lang.String cluster_name,
Promise promise,
boolean return_views_only) |
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) |
discoveryRequestReceived, findAllMembers, findAllViews, findAllViewsAsString, findInitialMembers, findInitialMembers, findInitialMembersAsString, getNumberOfDiscoveryRequestsSent, getNumInitialMembers, getNumPingRequests, getTimeout, getView, handleConnect, handleDisconnect, makeView, providedUpServices, resetStats, setNumInitialMembers, setNumPingRequests, setTimeout, up
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
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
public void init() throws java.lang.Exception
Protocol
public 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 flushedpublic void sendGetMembersRequest(java.lang.String cluster_name, Promise promise, boolean return_views_only) throws java.lang.Exception
sendGetMembersRequest
in class Discovery
java.lang.Exception
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.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 static PingData readFile(java.io.File file)
protected void writeToFile(PingData data, java.lang.String clustername)
protected java.lang.String addressAsString(Address address)
Copyright © 1998-2009 Bela Ban / Red Hat. All Rights Reserved.