public class JDBC_PING extends FILE_PING
Discovery protocol using a JDBC connection to a shared database.
Connection options can be defined as configuration properties, or the JNDI
name of a DataSource can be provided (avoid providing both).
Both the schema and the used SQL statements can be customized; make sure the order of parameters of such customized SQL statements is maintained and that compatible types are used for the columns. The recommended schema uses a single table, with two String columns being used primary key (local address, cluster name) and a third column to store the serialized form of the objects needed by JGroups.
A default table will be created at first connection, errors during this
operation are not considered critical. Set the initialize_sql
to an empty value to prevent this initial table creation, or change it to
create a customized table.
FILE_PING.WriterTaskDiscovery.Responses| Modifier and Type | Field and Description |
|---|---|
protected String |
connection_driver |
protected String |
connection_password |
protected String |
connection_url |
protected String |
connection_username |
protected String |
datasource_jndi_name |
protected String |
delete_single_sql |
protected String |
initialize_sql |
protected String |
insert_single_sql |
protected String |
select_all_pingdata_sql |
filter, interval, location, root_dir, SUFFIXbreak_on_coord_rsp, current_coord, force_sending_discovery_rsps, group_addr, is_coord, is_leaving, is_server, local_addr, members, num_discovery_requests, num_initial_members, num_initial_srv_members, ping_responses, return_entire_cache, stagger_timeout, timeout, timer, view| Constructor and Description |
|---|
JDBC_PING() |
| Modifier and Type | Method and Description |
|---|---|
protected void |
attemptSchemaInitialization() |
protected void |
closeConnection(Connection connection) |
protected void |
createRootDir() |
protected void |
delete(Connection connection,
String clustername,
String addressToDelete) |
protected void |
delete(String clustername,
String addressToDelete) |
protected void |
deleteSelf() |
protected Connection |
getConnection() |
protected DataSource |
getDataSourceFromJNDI(String name) |
void |
init()
Called after instance has been created (null constructor) and before protocol is started.
|
protected void |
insert(Connection connection,
PingData data,
String clustername,
String address) |
protected void |
loadDriver() |
protected List<PingData> |
readAll(Connection connection,
String clustername) |
protected List<PingData> |
readAll(String clustername)
Reads all information from the given directory under clustername
|
protected void |
remove(String clustername,
Address addr) |
void |
stop()
This method is called on a
Channel.disconnect(). |
protected void |
verifyconfigurationParameters() |
protected void |
writeToFile(PingData data,
String clustername) |
addressAsString, down, fetchClusterMembers, handleView, isDynamic, readFile, sendDiscoveryRequestsInParallel, startdeserialize, discoveryRequestReceived, findAllViews, findAllViewsAsString, findInitialMembers, findInitialMembersAsString, findMembers, getCurrentCoord, getNumberOfDiscoveryRequestsSent, getNumInitialMembers, getTimeout, getView, getViewId, handleConnect, handleDisconnect, isMergeRunning, providedUpServices, resetStats, sendDiscoveryRequest, sendDiscoveryResponse, sendMcastDiscoveryRequest, serializeWithoutView, setForceSendingDiscoveryRsps, setNumInitialMembers, setTimeout, updestroy, dumpStats, enableStats, getConfigurableObjects, getDownProtocol, getId, getLevel, getName, getProtocolStack, getSocketFactory, getThreadFactory, getTransport, getUpProtocol, getValue, isErgonomics, printStats, providedDownServices, requiredDownServices, requiredUpServices, resetStatistics, setDownProtocol, setErgonomics, setId, setLevel, setProtocolStack, setSocketFactory, setUpProtocol, setValue, setValues, statsEnabledprotected String connection_url
protected String connection_username
protected String connection_password
protected String connection_driver
protected String initialize_sql
protected String insert_single_sql
protected String delete_single_sql
protected String select_all_pingdata_sql
protected String datasource_jndi_name
public void init()
throws Exception
Protocolpublic void stop()
ProtocolChannel.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 flushedprotected void attemptSchemaInitialization()
protected void loadDriver()
protected Connection getConnection()
protected void createRootDir()
createRootDir in class FILE_PINGprotected List<PingData> readAll(String clustername)
FILE_PINGprotected List<PingData> readAll(Connection connection, String clustername) throws SQLException
SQLExceptionprotected void writeToFile(PingData data, String clustername)
writeToFile in class FILE_PINGprotected void insert(Connection connection, PingData data, String clustername, String address) throws SQLException
SQLExceptionprotected void delete(Connection connection, String clustername, String addressToDelete) throws SQLException
SQLExceptionprotected void delete(String clustername, String addressToDelete) throws SQLException
SQLExceptionprotected void deleteSelf()
throws SQLException
SQLExceptionprotected void closeConnection(Connection connection)
protected DataSource getDataSourceFromJNDI(String name)
protected void verifyconfigurationParameters()
Copyright © 2012 JBoss by Red Hat. All Rights Reserved.