Package org.jgroups.protocols
Class JDBC_PING2
java.lang.Object
org.jgroups.stack.Protocol
org.jgroups.protocols.Discovery
org.jgroups.protocols.FILE_PING
org.jgroups.protocols.JDBC_PING2
- All Implemented Interfaces:
Lifecycle
New version of
JDBC_PING. Has a new, better legible schema. plus some refactoring- Since:
- 5.4, 5.3.7
-
Nested Class Summary
Nested classes/interfaces inherited from class org.jgroups.protocols.FILE_PING
FILE_PING.InfoWriterNested classes/interfaces inherited from class org.jgroups.protocols.Discovery
Discovery.DiscoveryCacheDisseminationTask -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Stringprotected Stringprotected Stringprotected Stringprotected Stringprotected Stringprotected DataSourceprotected Stringprotected Stringprotected Stringprotected Stringprotected Stringprotected Stringprotected final Lockprotected StringFields inherited from class org.jgroups.protocols.FILE_PING
filter, info_writer, info_writer_max_writes_after_view, info_writer_sleep_time, location, reads, regexp, register_shutdown_hook, remove_all_data_on_view_change, remove_old_coords_on_view_change, root_dir, 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, stack, stats, up_prot -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static voidassertNonNull(String... strings) protected voidcallInsertStoredProcedure(Connection connection, PingData data, String clustername) protected voidclearTable(String clustername) protected voidprotected voidprotected voidprotected voidprotected voiddelete(Connection conn, String clustername, Address addressToDelete) voidfindMembers(List<Address> members, boolean initial_discovery, Responses responses) Fetches information (e.g.protected voidprotected Connectionprotected DataSourcegetDataSourceFromJNDI(String name) protected voidhandleView(View new_view, View old_view, boolean coord_changed) voidinit()Called after a protocol has been created and before the protocol is started.protected DataSourceinjectDataSource(String ds_class) protected voidinsert(Connection connection, PingData data, String clustername) booleanprotected voidprotected voidstatic voidprotected static PreparedStatementprepare(Connection conn, String sql, int resultSetType, int resultSetConcurrency) protected voidreadFromDB(String cluster) protected voidprotected voidRemoves all files for the given cluster nameprotected voidsetInsertSp(String sp) protected voidprotected voidprotected voidMethods 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, startInfoWriter, stop, stopInfoWriter, updateStoreOnViewChange, updateStoreOnViewChange, write, writeAll, writeAll, writeDataOnFind, writeDataOnFind, writeInfoMethods 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
-
lock
-
connection_url
-
connection_username
-
connection_password
-
connection_driver
-
initialize_sql
-
insert_sp
-
call_insert_sp
-
insert_single_sql
-
delete_single_sql
-
clear_sql
-
select_all_pingdata_sql
-
datasource_jndi_name
-
datasource_injecter_class
-
dataSource
-
-
Constructor Details
-
JDBC_PING2
public JDBC_PING2()
-
-
Method Details
-
createRootDir
protected void createRootDir()- Overrides:
createRootDirin classFILE_PING
-
setDataSource
-
getDataSource
-
getConnectionUrl
-
setConnectionUrl
-
getConnectionUsername
-
setConnectionUsername
-
getConnectionPassword
-
setConnectionPassword
-
getConnectionDriver
-
setConnectionDriver
-
getInitializeSql
-
setInitializeSql
-
getInsertSingleSql
-
setInsertSingleSql
-
getInsertSp
-
setInsertSp
-
getCallInsertSp
-
setCallInsertSp
-
getDeleteSingleSql
-
setDeleteSingleSql
-
getClearSql
-
setClearSql
-
getSelectAllPingdataSql
-
setSelectAllPingdataSql
-
getDatasourceJndiName
-
setDatasourceJndiName
-
getDatasourceInjecterClass
-
setDatasourceInjecterClass
-
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. -
dump
- Throws:
Exception
-
handleView
- Overrides:
handleViewin classFILE_PING
-
removeAllNotInCurrentView
protected void removeAllNotInCurrentView() -
learnExistingAddresses
protected void learnExistingAddresses() -
isInfoWriterRunning
public boolean isInfoWriterRunning()- Overrides:
isInfoWriterRunningin classFILE_PING
-
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.- Overrides:
findMembersin classFILE_PING- 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
-
findMembersInitialDiscovery
protected void findMembersInitialDiscovery() -
writeLocalAddress
protected void writeLocalAddress() -
write
-
writeToDB
- Throws:
SQLException
-
remove
-
removeAll
Description copied from class:FILE_PINGRemoves all files for the given cluster name -
readAll
-
readFromDB
- Throws:
Exception
-
prepare
protected static PreparedStatement prepare(Connection conn, String sql, int resultSetType, int resultSetConcurrency) throws SQLException - Throws:
SQLException
-
createSchema
protected void createSchema() -
createInsertStoredProcedure
- Throws:
SQLException
-
loadDriver
protected void loadDriver() -
injectDataSource
- Throws:
Exception
-
getConnection
- Throws:
SQLException
-
insert
- Throws:
SQLException
-
callInsertStoredProcedure
protected void callInsertStoredProcedure(Connection connection, PingData data, String clustername) throws SQLException - Throws:
SQLException
-
delete
protected void delete(Connection conn, String clustername, Address addressToDelete) throws SQLException - Throws:
SQLException
-
delete
- Throws:
SQLException
-
clearTable
- Throws:
SQLException
-
getDataSourceFromJNDI
-
assertNonNull
-
main
- Throws:
Exception
-