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
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.jgroups.protocols.FILE_PING
FILE_PING.InfoWriter
-
Nested classes/interfaces inherited from class org.jgroups.protocols.Discovery
Discovery.DiscoveryCacheDisseminationTask
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.String
call_insert_sp
protected java.lang.String
clear_sql
protected java.lang.String
connection_driver
protected java.lang.String
connection_password
protected java.lang.String
connection_url
protected java.lang.String
connection_username
protected javax.sql.DataSource
dataSource
protected java.lang.String
datasource_injecter_class
protected java.lang.String
datasource_jndi_name
protected java.lang.String
delete_single_sql
protected java.lang.String
initialize_sql
protected java.lang.String
insert_single_sql
protected java.lang.String
insert_sp
protected java.lang.String
select_all_pingdata_sql
-
Fields 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, writes
-
Fields 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, WHITESPACE
-
Fields 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 Constructor Description JDBC_PING2()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static void
assertNonNull(java.lang.String... strings)
protected void
callInsertStoredProcedure(java.sql.Connection connection, PingData data, java.lang.String clustername)
protected void
clearTable(java.lang.String clustername)
protected void
createInsertStoredProcedure()
protected void
createRootDir()
protected void
createSchema()
protected void
delete(java.lang.String clustername, Address addressToDelete)
protected void
delete(java.sql.Connection conn, java.lang.String clustername, Address addressToDelete)
java.lang.String
dump(java.lang.String cluster)
java.lang.String
getCallInsertSp()
java.lang.String
getClearSql()
protected java.sql.Connection
getConnection()
java.lang.String
getConnectionDriver()
java.lang.String
getConnectionPassword()
java.lang.String
getConnectionUrl()
java.lang.String
getConnectionUsername()
javax.sql.DataSource
getDataSource()
protected javax.sql.DataSource
getDataSourceFromJNDI(java.lang.String name)
java.lang.String
getDatasourceInjecterClass()
java.lang.String
getDatasourceJndiName()
java.lang.String
getDeleteSingleSql()
java.lang.String
getInitializeSql()
java.lang.String
getInsertSingleSql()
java.lang.String
getInsertSp()
java.lang.String
getSelectAllPingdataSql()
void
init()
Called after a protocol has been created and before the protocol is started.protected javax.sql.DataSource
injectDataSource(java.lang.String ds_class)
protected void
insert(java.sql.Connection connection, PingData data, java.lang.String clustername)
protected void
loadDriver()
static void
main(java.lang.String[] args)
protected static java.sql.PreparedStatement
prepare(java.sql.Connection conn, java.lang.String sql, int resultSetType, int resultSetConcurrency)
protected void
readAll(java.util.List<Address> members, java.lang.String cluster, Responses rsps)
protected java.util.List<PingData>
readFromDB(java.lang.String cluster)
protected void
remove(java.lang.String clustername, Address addr)
protected void
removeAll(java.lang.String clustername)
Removes all files for the given cluster nameJDBC_PING2
setCallInsertSp(java.lang.String sp)
JDBC_PING2
setClearSql(java.lang.String c)
JDBC_PING2
setConnectionDriver(java.lang.String c)
JDBC_PING2
setConnectionPassword(java.lang.String c)
JDBC_PING2
setConnectionUrl(java.lang.String c)
JDBC_PING2
setConnectionUsername(java.lang.String c)
JDBC_PING2
setDataSource(javax.sql.DataSource ds)
JDBC_PING2
setDatasourceInjecterClass(java.lang.String d)
JDBC_PING2
setDatasourceJndiName(java.lang.String d)
JDBC_PING2
setDeleteSingleSql(java.lang.String d)
JDBC_PING2
setInitializeSql(java.lang.String i)
JDBC_PING2
setInsertSingleSql(java.lang.String i)
JDBC_PING2
setInsertSp(java.lang.String sp)
JDBC_PING2
setSelectAllPingdataSql(java.lang.String s)
protected void
write(java.util.List<PingData> list, java.lang.String clustername)
protected void
writeToDB(PingData data, java.lang.String clustername)
-
Methods inherited from class org.jgroups.protocols.FILE_PING
addressToFilename, deleteFile, down, findMembers, getInfoWriterMaxWritesAfterView, getInfoWriterSleepTime, getLocation, handleView, isDynamic, isInfoWriterRunning, read, read, registerShutdownHook, registerShutdownHook, removeAllDataOnViewChange, removeAllDataOnViewChange, removeOldCoordsOnViewChange, removeOldCoordsOnViewChange, resetStats, setInfoWriterMaxWritesAfterView, setInfoWriterSleepTime, setLocation, startInfoWriter, stop, stopInfoWriter, updateStoreOnViewChange, updateStoreOnViewChange, write, writeAll, writeAll, writeDataOnFind, writeDataOnFind, writeInfo
-
Methods 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, weedOutCompletedDiscoveryResponses
-
Methods 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 Detail
-
connection_url
protected java.lang.String connection_url
-
connection_username
protected java.lang.String connection_username
-
connection_password
protected java.lang.String connection_password
-
connection_driver
protected java.lang.String connection_driver
-
initialize_sql
protected java.lang.String initialize_sql
-
insert_sp
protected java.lang.String insert_sp
-
call_insert_sp
protected java.lang.String call_insert_sp
-
insert_single_sql
protected java.lang.String insert_single_sql
-
delete_single_sql
protected java.lang.String delete_single_sql
-
clear_sql
protected java.lang.String clear_sql
-
select_all_pingdata_sql
protected java.lang.String select_all_pingdata_sql
-
datasource_jndi_name
protected java.lang.String datasource_jndi_name
-
datasource_injecter_class
protected java.lang.String datasource_injecter_class
-
dataSource
protected javax.sql.DataSource dataSource
-
-
Method Detail
-
createRootDir
protected void createRootDir()
- Overrides:
createRootDir
in classFILE_PING
-
setDataSource
public JDBC_PING2 setDataSource(javax.sql.DataSource ds)
-
getDataSource
public javax.sql.DataSource getDataSource()
-
getConnectionUrl
public java.lang.String getConnectionUrl()
-
setConnectionUrl
public JDBC_PING2 setConnectionUrl(java.lang.String c)
-
getConnectionUsername
public java.lang.String getConnectionUsername()
-
setConnectionUsername
public JDBC_PING2 setConnectionUsername(java.lang.String c)
-
getConnectionPassword
public java.lang.String getConnectionPassword()
-
setConnectionPassword
public JDBC_PING2 setConnectionPassword(java.lang.String c)
-
getConnectionDriver
public java.lang.String getConnectionDriver()
-
setConnectionDriver
public JDBC_PING2 setConnectionDriver(java.lang.String c)
-
getInitializeSql
public java.lang.String getInitializeSql()
-
setInitializeSql
public JDBC_PING2 setInitializeSql(java.lang.String i)
-
getInsertSingleSql
public java.lang.String getInsertSingleSql()
-
setInsertSingleSql
public JDBC_PING2 setInsertSingleSql(java.lang.String i)
-
getInsertSp
public java.lang.String getInsertSp()
-
setInsertSp
public JDBC_PING2 setInsertSp(java.lang.String sp)
-
getCallInsertSp
public java.lang.String getCallInsertSp()
-
setCallInsertSp
public JDBC_PING2 setCallInsertSp(java.lang.String sp)
-
getDeleteSingleSql
public java.lang.String getDeleteSingleSql()
-
setDeleteSingleSql
public JDBC_PING2 setDeleteSingleSql(java.lang.String d)
-
getClearSql
public java.lang.String getClearSql()
-
setClearSql
public JDBC_PING2 setClearSql(java.lang.String c)
-
getSelectAllPingdataSql
public java.lang.String getSelectAllPingdataSql()
-
setSelectAllPingdataSql
public JDBC_PING2 setSelectAllPingdataSql(java.lang.String s)
-
getDatasourceJndiName
public java.lang.String getDatasourceJndiName()
-
setDatasourceJndiName
public JDBC_PING2 setDatasourceJndiName(java.lang.String d)
-
getDatasourceInjecterClass
public java.lang.String getDatasourceInjecterClass()
-
setDatasourceInjecterClass
public JDBC_PING2 setDatasourceInjecterClass(java.lang.String d)
-
init
public void init() throws java.lang.Exception
Description copied from class:Protocol
Called 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
public java.lang.String dump(java.lang.String cluster) throws java.lang.Exception
- Throws:
java.lang.Exception
-
write
protected void write(java.util.List<PingData> list, java.lang.String clustername)
-
writeToDB
protected void writeToDB(PingData data, java.lang.String clustername) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
remove
protected void remove(java.lang.String clustername, Address addr)
-
removeAll
protected void removeAll(java.lang.String clustername)
Description copied from class:FILE_PING
Removes all files for the given cluster name
-
readAll
protected void readAll(java.util.List<Address> members, java.lang.String cluster, Responses rsps)
-
readFromDB
protected java.util.List<PingData> readFromDB(java.lang.String cluster) throws java.lang.Exception
- Throws:
java.lang.Exception
-
prepare
protected static java.sql.PreparedStatement prepare(java.sql.Connection conn, java.lang.String sql, int resultSetType, int resultSetConcurrency) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
createSchema
protected void createSchema()
-
createInsertStoredProcedure
protected void createInsertStoredProcedure() throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
loadDriver
protected void loadDriver()
-
injectDataSource
protected javax.sql.DataSource injectDataSource(java.lang.String ds_class) throws java.lang.Exception
- Throws:
java.lang.Exception
-
getConnection
protected java.sql.Connection getConnection() throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
insert
protected void insert(java.sql.Connection connection, PingData data, java.lang.String clustername) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
callInsertStoredProcedure
protected void callInsertStoredProcedure(java.sql.Connection connection, PingData data, java.lang.String clustername) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
delete
protected void delete(java.sql.Connection conn, java.lang.String clustername, Address addressToDelete) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
delete
protected void delete(java.lang.String clustername, Address addressToDelete) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
clearTable
protected void clearTable(java.lang.String clustername) throws java.sql.SQLException
- Throws:
java.sql.SQLException
-
getDataSourceFromJNDI
protected javax.sql.DataSource getDataSourceFromJNDI(java.lang.String name)
-
assertNonNull
protected static void assertNonNull(java.lang.String... strings)
-
main
public static void main(java.lang.String[] args) throws java.lang.Exception
- Throws:
java.lang.Exception
-
-