Class MONGO_PING
java.lang.Object
org.jgroups.stack.Protocol
org.jgroups.protocols.Discovery
org.jgroups.protocols.FILE_PING
org.jgroups.protocols.JDBC_PING2
org.jgroups.protocols.mongo.MONGO_PING
- All Implemented Interfaces:
org.jgroups.Lifecycle
public class MONGO_PING
extends org.jgroups.protocols.JDBC_PING2
Discovery protocol using MongoDB as a shared store for cluster member information.
This protocol stores node discovery data (address, name, IP, coordinator status) in a MongoDB collection.
Configuration example:
<mongo.MONGO_PING connection_url="mongodb://localhost:27017/jgroups"
collection_name="jgroups-ping"
remove_all_data_on_view_change="true"/>
The connection URL must include the database name (e.g., mongodb://host:port/database).
- Author:
- rsobies, Radoslav Husar
-
Nested Class Summary
Nested classes/interfaces inherited from class org.jgroups.protocols.FILE_PING
org.jgroups.protocols.FILE_PING.InfoWriterNested classes/interfaces inherited from class org.jgroups.protocols.Discovery
org.jgroups.protocols.Discovery.DiscoveryCacheDisseminationTask -
Field Summary
FieldsFields inherited from class org.jgroups.protocols.JDBC_PING2
call_insert_sp, clear_sql, connection_driver, connection_password, connection_url, connection_username, dataSource, datasource_injecter_class, datasource_jndi_name, delete_single_sql, initialize_sql, insert_single_sql, insert_sp, lock, select_all_pingdata_sqlFields inherited from class org.jgroups.protocols.FILE_PING
filter, info_writer, info_writer_max_writes_after_view, info_writer_sleep_time, location, num_read_loops, read_sleep, reads, regexp, register_shutdown_hook, remove_all_data_on_view_change, remove_old_coords_on_view_change, root_dir, shutdown_hook, SUFFIX, update_store_on_view_change, write_data_on_find, writesFields 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, preview_warning, stack, stats, up_prot -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidclearTable(String clustername) protected voidprotected voidprotected voidprotected voiddelete(Connection conn, String clustername, org.jgroups.Address addressToDelete) protected com.mongodb.client.MongoCollection<org.bson.Document> protected ConnectionReturns null as MongoDB does not use JDBC connections.voidinit()protected voidprotected List<org.jgroups.protocols.PingData> readFromDB(String cluster) setCollectionName(String collectionName) setConnectionUrl(String connectionUrl) voidstop()protected voidMethods inherited from class org.jgroups.protocols.JDBC_PING2
assertNonNull, callInsertStoredProcedure, createRootDir, dump, findMembers, findMembersInitialDiscovery, getCallInsertSp, getClearSql, getConnectionDriver, getConnectionPassword, getConnectionUrl, getConnectionUsername, getDataSource, getDataSourceFromJNDI, getDatasourceInjecterClass, getDatasourceJndiName, getDeleteSingleSql, getInitializeSql, getInsertSingleSql, getInsertSp, getSelectAllPingdataSql, handleView, injectDataSource, insert, isInfoWriterRunning, learnExistingAddresses, main, prepare, readAll, remove, removeAll, removeAllNotInCurrentView, setCallInsertSp, setClearSql, setConnectionDriver, setConnectionPassword, setConnectionUsername, setDataSource, setDatasourceInjecterClass, setDatasourceJndiName, setDeleteSingleSql, setInitializeSql, setInsertSingleSql, setInsertSp, setSelectAllPingdataSql, write, writeLocalAddressMethods inherited from class org.jgroups.protocols.FILE_PING
addressToFilename, deleteFile, down, getInfoWriterMaxWritesAfterView, getInfoWriterSleepTime, getLocation, isDynamic, read, read, registerShutdownHook, registerShutdownHook, removeAllDataOnViewChange, removeAllDataOnViewChange, removeOldCoordsOnViewChange, removeOldCoordsOnViewChange, resetStats, setInfoWriterMaxWritesAfterView, setInfoWriterSleepTime, setLocation, start, startInfoWriter, stopInfoWriter, updateStoreOnViewChange, updateStoreOnViewChange, write, writeAll, writeAll, writeDataOnFind, writeDataOnFind, writeInfoMethods inherited from class org.jgroups.protocols.Discovery
addDiscoveryResponseToCaches, addResponse, addResponse, addressAsString, addToCache, asyncDiscovery, asyncDiscovery, asyncDiscoveryUseSeparateThread, asyncDiscoveryUseSeparateThread, breakOnCoordResponse, breakOnCoordResponse, callFindMembersInAllDiscoveryProtocols, clearRequestFutures, deserialize, discoveryRequestReceived, discoveryRspExpiryTime, discoveryRspExpiryTime, disseminateDiscoveryInformation, dumpCache, findInitialMembersAsString, findMembers, findTopmostDiscoveryProtocol, getClusterName, getCurrentCoord, getNumberOfDiscoveryRequestsSent, getView, getViewId, handle, handleConnect, handleDisconnect, handleDiscoveryResponse, handleDiscoveryResponse, isCoord, isMergeRunning, marshal, marshal, marshal, maxRankToReply, maxRankToReply, numDiscoveryRuns, numDiscoveryRuns, print, providedUpServices, readPingData, returnEntireCache, returnEntireCache, sendCacheInformation, sendCacheOnJoin, sendCacheOnJoin, sendDiscoveryResponse, sendDiscoveryResponse, serializeWithoutView, setClusterName, staggerTimeout, staggerTimeout, startCacheDissemination, transportSupportsMulticasting, 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, previewWarning, previewWarning, providedDownServices, removePolicy, requiredDownServices, requiredUpServices, resetStatistics, setAddress, setDownProtocol, setErgonomics, setId, setLevel, setPolicies, setProtocolStack, setSocketFactory, setUpProtocol, setValue, statsEnabled, toString
-
Field Details
-
MONGO_PING_DEFAULT_PROTOCOL_ID
protected static final short MONGO_PING_DEFAULT_PROTOCOL_ID- See Also:
-
collection_name
-
-
Constructor Details
-
MONGO_PING
public MONGO_PING()
-
-
Method Details
-
setConnectionUrl
- Overrides:
setConnectionUrlin classorg.jgroups.protocols.JDBC_PING2
-
getCollectionName
-
setCollectionName
-
init
-
getCollection
protected com.mongodb.client.MongoCollection<org.bson.Document> getCollection() -
stop
public void stop()- Specified by:
stopin interfaceorg.jgroups.Lifecycle- Overrides:
stopin classorg.jgroups.protocols.FILE_PING
-
loadDriver
protected void loadDriver()- Overrides:
loadDriverin classorg.jgroups.protocols.JDBC_PING2
-
createInsertStoredProcedure
protected void createInsertStoredProcedure()- Overrides:
createInsertStoredProcedurein classorg.jgroups.protocols.JDBC_PING2
-
clearTable
- Overrides:
clearTablein classorg.jgroups.protocols.JDBC_PING2
-
getConnection
Returns null as MongoDB does not use JDBC connections. The parent class methods that receive a Connection parameter (e.g.,delete(Connection, String, Address)) are overridden to ignore it and use the cachedMongoCollectioninstead.- Overrides:
getConnectionin classorg.jgroups.protocols.JDBC_PING2
-
writeToDB
- Overrides:
writeToDBin classorg.jgroups.protocols.JDBC_PING2
-
createSchema
protected void createSchema()- Overrides:
createSchemain classorg.jgroups.protocols.JDBC_PING2
-
readFromDB
-
delete
- Overrides:
deletein classorg.jgroups.protocols.JDBC_PING2
-
delete
- Overrides:
deletein classorg.jgroups.protocols.JDBC_PING2
-