Class JDBC_PING2

All Implemented Interfaces:
Lifecycle

public class JDBC_PING2 extends FILE_PING
New version of JDBC_PING. Has a new, better legible schema. plus some refactoring
Since:
5.4, 5.3.7
  • Field Details

    • lock

      protected final Lock lock
    • connection_url

      protected String connection_url
    • connection_username

      protected String connection_username
    • connection_password

      protected String connection_password
    • connection_driver

      protected String connection_driver
    • initialize_sql

      protected String initialize_sql
    • insert_sp

      protected String insert_sp
    • call_insert_sp

      protected String call_insert_sp
    • insert_single_sql

      protected String insert_single_sql
    • delete_single_sql

      protected String delete_single_sql
    • clear_sql

      protected String clear_sql
    • select_all_pingdata_sql

      protected String select_all_pingdata_sql
    • datasource_jndi_name

      protected String datasource_jndi_name
    • datasource_injecter_class

      protected String datasource_injecter_class
    • dataSource

      protected DataSource dataSource
  • Constructor Details

    • JDBC_PING2

      public JDBC_PING2()
  • Method Details

    • createRootDir

      protected void createRootDir()
      Overrides:
      createRootDir in class FILE_PING
    • setDataSource

      public JDBC_PING2 setDataSource(DataSource ds)
    • getDataSource

      public DataSource getDataSource()
    • getConnectionUrl

      public String getConnectionUrl()
    • setConnectionUrl

      public JDBC_PING2 setConnectionUrl(String c)
    • getConnectionUsername

      public String getConnectionUsername()
    • setConnectionUsername

      public JDBC_PING2 setConnectionUsername(String c)
    • getConnectionPassword

      public String getConnectionPassword()
    • setConnectionPassword

      public JDBC_PING2 setConnectionPassword(String c)
    • getConnectionDriver

      public String getConnectionDriver()
    • setConnectionDriver

      public JDBC_PING2 setConnectionDriver(String c)
    • getInitializeSql

      public String getInitializeSql()
    • setInitializeSql

      public JDBC_PING2 setInitializeSql(String i)
    • getInsertSingleSql

      public String getInsertSingleSql()
    • setInsertSingleSql

      public JDBC_PING2 setInsertSingleSql(String i)
    • getInsertSp

      public String getInsertSp()
    • setInsertSp

      public JDBC_PING2 setInsertSp(String sp)
    • getCallInsertSp

      public String getCallInsertSp()
    • setCallInsertSp

      public JDBC_PING2 setCallInsertSp(String sp)
    • getDeleteSingleSql

      public String getDeleteSingleSql()
    • setDeleteSingleSql

      public JDBC_PING2 setDeleteSingleSql(String d)
    • getClearSql

      public String getClearSql()
    • setClearSql

      public JDBC_PING2 setClearSql(String c)
    • getSelectAllPingdataSql

      public String getSelectAllPingdataSql()
    • setSelectAllPingdataSql

      public JDBC_PING2 setSelectAllPingdataSql(String s)
    • getDatasourceJndiName

      public String getDatasourceJndiName()
    • setDatasourceJndiName

      public JDBC_PING2 setDatasourceJndiName(String d)
    • getDatasourceInjecterClass

      public String getDatasourceInjecterClass()
    • setDatasourceInjecterClass

      public JDBC_PING2 setDatasourceInjecterClass(String d)
    • init

      public void init() throws 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.
      Specified by:
      init in interface Lifecycle
      Overrides:
      init in class FILE_PING
      Throws:
      Exception - Thrown if protocol cannot be initialized successfully. This will cause the ProtocolStack to fail, so the the channel constructor will throw an exception
    • dump

      public String dump(String cluster) throws Exception
      Throws:
      Exception
    • handleView

      protected void handleView(View new_view, View old_view, boolean coord_changed)
      Overrides:
      handleView in class FILE_PING
    • removeAllNotInCurrentView

      protected void removeAllNotInCurrentView()
    • learnExistingAddresses

      protected void learnExistingAddresses()
    • isInfoWriterRunning

      public boolean isInfoWriterRunning()
      Overrides:
      isInfoWriterRunning in class FILE_PING
    • findMembers

      public void findMembers(List<Address> members, boolean initial_discovery, Responses responses)
      Description copied from class: Discovery
      Fetches information (e.g. physical address, logical name) for the given member addresses. Needs to add responses to the Responses object. If Discovery.async_discovery is true, this method will be called in a separate thread, otherwise the caller's thread will be used.
      Overrides:
      findMembers in class FILE_PING
      Parameters:
      members - A list of logical addresses (typically UUIDs). If null, then information for all members is fetched
      initial_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

      protected void write(List<PingData> list, String clustername)
      Overrides:
      write in class FILE_PING
    • writeToDB

      protected void writeToDB(PingData data, String clustername) throws SQLException
      Throws:
      SQLException
    • remove

      protected void remove(String clustername, Address addr)
      Overrides:
      remove in class FILE_PING
    • removeAll

      protected void removeAll(String clustername)
      Description copied from class: FILE_PING
      Removes all files for the given cluster name
      Overrides:
      removeAll in class FILE_PING
    • readAll

      protected void readAll(List<Address> members, String cluster, Responses rsps)
      Overrides:
      readAll in class FILE_PING
    • readFromDB

      protected List<PingData> readFromDB(String cluster) throws Exception
      Throws:
      Exception
    • prepare

      protected static PreparedStatement prepare(Connection conn, String sql, int resultSetType, int resultSetConcurrency) throws SQLException
      Throws:
      SQLException
    • createSchema

      protected void createSchema()
    • createInsertStoredProcedure

      protected void createInsertStoredProcedure() throws SQLException
      Throws:
      SQLException
    • loadDriver

      protected void loadDriver()
    • injectDataSource

      protected DataSource injectDataSource(String ds_class) throws Exception
      Throws:
      Exception
    • getConnection

      protected Connection getConnection() throws SQLException
      Throws:
      SQLException
    • insert

      protected void insert(Connection connection, PingData data, String clustername) throws SQLException
      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

      protected void delete(String clustername, Address addressToDelete) throws SQLException
      Throws:
      SQLException
    • clearTable

      protected void clearTable(String clustername) throws SQLException
      Throws:
      SQLException
    • getDataSourceFromJNDI

      protected DataSource getDataSourceFromJNDI(String name)
    • assertNonNull

      protected static void assertNonNull(String... strings)
    • main

      public static void main(String[] args) throws Exception
      Throws:
      Exception