Package org.jgroups.protocols
Class FILE_PING
java.lang.Object
org.jgroups.stack.Protocol
org.jgroups.protocols.Discovery
org.jgroups.protocols.FILE_PING
- All Implemented Interfaces:
Lifecycle
- Direct Known Subclasses:
JDBC_PING,JDBC_PING2,RACKSPACE_PING,SWIFT_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
Nested ClassesModifier and TypeClassDescriptionprotected classClass which calls writeAll() a few times.Nested classes/interfaces inherited from class org.jgroups.protocols.Discovery
Discovery.DiscoveryCacheDisseminationTask -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final FilenameFilterprotected Future<?> protected intprotected longprotected Stringprotected intprotected static final Patternprotected booleanprotected booleanprotected booleanprotected Fileprotected static final Stringprotected booleanprotected booleanprotected intFields inherited from class org.jgroups.protocols.Discovery
async_discovery, async_discovery_use_separate_thread_per_request, break_on_coord_rsp, cluster_name, current_coord, discovery_req_futures, discovery_rsp_callback, discovery_rsp_expiry_time, is_coord, is_leaving, is_server, max_members_in_discovery_request, max_rank_to_reply, num_discovery_requests, num_discovery_runs, ping_responses, return_entire_cache, send_cache_on_join, sends_can_block, stagger_timeout, timer, transport, transport_supports_multicasting, use_disk_cache, view, WHITESPACEFields inherited from class org.jgroups.stack.Protocol
after_creation_hook, down_prot, ergonomics, id, local_addr, log, policies, stack, stats, up_prot -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static StringaddressToFilename(Address mbr) protected voidprotected booleandeleteFile(File file) An event is to be sent down the stack.voidfindMembers(List<Address> members, boolean initial_discovery, Responses responses) Fetches information (e.g.intlongprotected voidhandleView(View new_view, View old_view, boolean coord_changed) voidinit()Called after a protocol has been created and before the protocol is started.booleanbooleanread(InputStream in) protected voidbooleanregisterShutdownHook(boolean r) protected voidprotected voidRemoves all files for the given cluster namebooleanremoveAllDataOnViewChange(boolean r) booleanremoveOldCoordsOnViewChange(boolean r) voidsetInfoWriterSleepTime(long i) protected voidvoidstop()Called on aJChannel.disconnect(); stops work (e.g.protected voidbooleanupdateStoreOnViewChange(boolean u) protected voidwrite(List<PingData> list, OutputStream out) protected voidprotected voidwriteAll()Write information about all of the member to file (only if I'm the coord)protected voidbooleanwriteDataOnFind(boolean w) voidMethods inherited from class org.jgroups.protocols.Discovery
addDiscoveryResponseToCaches, addResponse, addResponse, addressAsString, addToCache, breakOnCoordResponse, breakOnCoordResponse, callFindMembersInAllDiscoveryProtocols, clearRequestFutures, deserialize, discoveryRequestReceived, discoveryRspExpiryTime, disseminateDiscoveryInformation, dumpCache, findInitialMembersAsString, findMembers, findTopmostDiscoveryProtocol, getClusterName, getCurrentCoord, getNumberOfDiscoveryRequestsSent, getView, getViewId, handle, handleConnect, handleDisconnect, handleDiscoveryResponse, handleDiscoveryResponse, isCoord, isMergeRunning, marshal, marshal, marshal, print, providedUpServices, readPingData, returnEntireCache, returnEntireCache, sendCacheInformation, sendCacheOnJoin, sendCacheOnJoin, sendDiscoveryResponse, sendDiscoveryResponse, serializeWithoutView, setClusterName, staggerTimeout, staggerTimeout, start, startCacheDissemination, up, up, up, useDiskCache, useDiskCache, weedOutCompletedDiscoveryResponsesMethods inherited from class org.jgroups.stack.Protocol
accept, addPolicy, addr, addr, afterCreationHook, destroy, down, down, enableStats, getAddress, getComponents, getDownProtocol, getDownServices, getId, getIdsAbove, getLevel, getLog, getName, getPolicies, getProtocolStack, getSocketFactory, getThreadFactory, getTransport, getUpProtocol, getUpServices, getValue, isErgonomics, level, parse, policies, providedDownServices, removePolicy, requiredDownServices, requiredUpServices, resetStatistics, setAddress, setDownProtocol, setErgonomics, setId, setLevel, setPolicies, setProtocolStack, setSocketFactory, setUpProtocol, setValue, statsEnabled, toString
-
Field Details
-
SUFFIX
- See Also:
-
regexp
-
location
-
remove_old_coords_on_view_change
protected boolean remove_old_coords_on_view_change -
remove_all_data_on_view_change
protected boolean remove_all_data_on_view_change -
info_writer_max_writes_after_view
protected int info_writer_max_writes_after_view -
info_writer_sleep_time
protected long info_writer_sleep_time -
write_data_on_find
protected boolean write_data_on_find -
register_shutdown_hook
protected boolean register_shutdown_hook -
update_store_on_view_change
protected boolean update_store_on_view_change -
writes
protected int writes -
reads
protected int reads -
root_dir
-
filter
-
info_writer
-
-
Constructor Details
-
FILE_PING
public FILE_PING()
-
-
Method Details
-
isDynamic
public boolean isDynamic() -
getLocation
-
setLocation
-
removeAllDataOnViewChange
public boolean removeAllDataOnViewChange() -
removeAllDataOnViewChange
-
removeOldCoordsOnViewChange
public boolean removeOldCoordsOnViewChange() -
removeOldCoordsOnViewChange
-
getInfoWriterMaxWritesAfterView
public int getInfoWriterMaxWritesAfterView() -
setInfoWriterMaxWritesAfterView
-
getInfoWriterSleepTime
public long getInfoWriterSleepTime() -
setInfoWriterSleepTime
-
writeDataOnFind
public boolean writeDataOnFind() -
writeDataOnFind
-
registerShutdownHook
public boolean registerShutdownHook() -
registerShutdownHook
-
updateStoreOnViewChange
public boolean updateStoreOnViewChange() -
updateStoreOnViewChange
-
isInfoWriterRunning
public boolean isInfoWriterRunning() -
writeInfo
public void writeInfo() -
init
Description copied from class:ProtocolCalled after a protocol has been created and before the protocol is started. Attributes are already set. Other protocols are not yet connected and events cannot yet be sent. -
stop
public void stop()Description copied from class:ProtocolCalled on aJChannel.disconnect(); stops work (e.g. by closing multicast socket). Will be called from top to bottom. -
resetStats
public void resetStats()- Overrides:
resetStatsin classDiscovery
-
down
Description copied from class:ProtocolAn event is to be sent down the stack. A protocol 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 protocol may need to add a header to it (or do nothing at all) before sending it down the stack usingdown_prot.down(). -
findMembers
Description copied from class:DiscoveryFetches information (e.g. physical address, logical name) for the given member addresses. Needs to add responses to theResponsesobject. IfDiscovery.async_discoveryis true, this method will be called in a separate thread, otherwise the caller's thread will be used.- Specified by:
findMembersin classDiscovery- Parameters:
members- A list of logical addresses (typicallyUUIDs). If null, then information for all members is fetchedinitial_discovery- Set to true if this is for the initial membership discovery. Some protocols (e.g. file based ones) may return only the information for the coordinator(s).responses- The list to which responses should be added
-
addressToFilename
-
createRootDir
protected void createRootDir() -
handleView
-
remove
-
removeAll
Removes all files for the given cluster name -
readAll
-
read
- Throws:
Exception
-
read
-
writeAll
protected void writeAll()Write information about all of the member to file (only if I'm the coord) -
writeAll
-
write
-
write
-
deleteFile
-
startInfoWriter
protected void startInfoWriter() -
stopInfoWriter
protected void stopInfoWriter()
-