Class JdbcMachineIdInitializer

java.lang.Object
me.ahoo.cosid.jdbc.JdbcMachineIdInitializer

public class JdbcMachineIdInitializer extends Object
Jdbc MachineId Initializer.
  • Field Details

    • INIT_COSID_MACHINE_TABLE_SQL

      public static final String INIT_COSID_MACHINE_TABLE_SQL
      Default SQL for creating the cosid_machine table.

      The idx_namespace and idx_instance_id indexes are declared inline so the table and its indexes are created by a single MySQL-compatible statement. MySQL does not support CREATE INDEX IF NOT EXISTS, so the index DDLs default to empty strings and are skipped by initCosIdMachineTable().

      See Also:
    • INIT_NAMESPACE_IDX_SQL

      public static final String INIT_NAMESPACE_IDX_SQL
      Default SQL for creating the idx_namespace index on cosid_machine.

      Empty by default: the index is created inline by INIT_COSID_MACHINE_TABLE_SQL. Set this to a non-empty value (e.g. CREATE INDEX ...) to create the index separately; empty values are skipped by initCosIdMachineTable().

      See Also:
    • INIT_INSTANCE_ID_IDX_SQL

      public static final String INIT_INSTANCE_ID_IDX_SQL
      Default SQL for creating the idx_instance_id index on cosid_machine.

      Empty by default: the index is created inline by INIT_COSID_MACHINE_TABLE_SQL. Set this to a non-empty value (e.g. CREATE INDEX ...) to create the index separately; empty values are skipped by initCosIdMachineTable().

      See Also:
  • Constructor Details

    • JdbcMachineIdInitializer

      public JdbcMachineIdInitializer(DataSource dataSource)
    • JdbcMachineIdInitializer

      public JdbcMachineIdInitializer(DataSource dataSource, String initCosIdMachineTableSql, String initNamespaceIdxSql, String initInstanceIdIdxSql)
  • Method Details

    • initCosIdMachineTable

      public void initCosIdMachineTable() throws SQLException
      Throws:
      SQLException
    • tryInitCosIdMachineTable

      public boolean tryInitCosIdMachineTable()