@MBean public class DatabaseClusterImpl<Z,D extends Database<Z>> extends Object implements DatabaseCluster<Z,D>
Constructor and Description |
---|
DatabaseClusterImpl(String id,
DatabaseClusterConfiguration<Z,D> configuration,
DatabaseClusterConfigurationListener<Z,D> listener) |
Modifier and Type | Method and Description |
---|---|
boolean |
activate(D database,
StateManager manager)
Activates the specified database
|
void |
activate(String databaseId)
Synchronizes, using the default strategy, and reactivates the specified database.
|
void |
activate(String databaseId,
String strategyId)
Synchronizes, using the specified strategy, and reactivates the specified database.
|
void |
add(String databaseId)
Removes the specified database from the cluster.
|
void |
addConfigurationListener(DatabaseClusterConfigurationListener<Z,D> listener) |
void |
addListener(DatabaseClusterListener listener) |
void |
addSynchronizationListener(SynchronizationListener listener) |
boolean |
deactivate(D database,
StateManager manager)
Deactivates the specified database
|
void |
deactivate(String databaseId)
Deactivates the specified database.
|
void |
flushMetaDataCache()
Flushes this cluster's cache of DatabaseMetaData.
|
Set<String> |
getActiveDatabases()
Returns a collection of active databases in this cluster.
|
Balancer<Z,D> |
getBalancer()
Returns the Balancer implementation used by this database cluster.
|
D |
getDatabase(String id)
Returns the database identified by the specified id
|
DatabaseMetaDataCache<Z,D> |
getDatabaseMetaDataCache()
Returns a DatabaseMetaData cache.
|
Decoder |
getDecoder() |
String |
getDefaultSynchronizationStrategy()
Returns the default synchronization strategy used by this cluster.
|
Dialect |
getDialect()
Returns a dialect capable of returning database vendor specific values.
|
Durability<Z,D> |
getDurability() |
ExecutorService |
getExecutor() |
String |
getId()
Returns the identifier of this cluster.
|
Set<String> |
getInactiveDatabases()
Returns a collection of inactive databases in this cluster.
|
InputSinkStrategy<? extends Object> |
getInputSinkStrategy() |
LockManager |
getLockManager()
Returns a LockManager capable of acquiring named read/write locks on the specific objects in this database cluster.
|
StateManager |
getStateManager()
Returns a StateManager for persisting database cluster state.
|
Set<String> |
getSynchronizationStrategies()
Returns the set of synchronization strategies available to this cluster.
|
ThreadFactory |
getThreadFactory() |
TransactionIdentifierFactory<? extends Object> |
getTransactionIdentifierFactory() |
TransactionMode |
getTransactionMode() |
String |
getVersion()
Return the current HA-JDBC version
|
boolean |
isActive()
Indicates whether or not this cluster is active, i.e.
|
boolean |
isAlive(String databaseId)
Determines whether or not the specified database is responsive
|
boolean |
isCurrentDateEvaluationEnabled()
Indicates whether or not non-deterministic CURRENT_DATE SQL functions will be evaluated to deterministic static values.
|
boolean |
isCurrentTimeEvaluationEnabled()
Indicates whether or not non-deterministic CURRENT_TIME functions will be evaluated to deterministic static values.
|
boolean |
isCurrentTimestampEvaluationEnabled()
Indicates whether or not non-deterministic CURRENT_TIMESTAMP functions will be evaluated to deterministic static values.
|
boolean |
isIdentityColumnDetectionEnabled()
Indicates whether or not identity column detection is enabled for this cluster.
|
boolean |
isRandEvaluationEnabled()
Indicates whether or not non-deterministic RAND() functions will be replaced by evaluated to static values.
|
boolean |
isSequenceDetectionEnabled()
Indicates whether or not sequence detection is enabled for this cluster.
|
void |
remove(String databaseId)
Removes the specified database from the cluster.
|
void |
removeConfigurationListener(DatabaseClusterConfigurationListener<Z,D> listener) |
void |
removeListener(DatabaseClusterListener listener) |
void |
removeSynchronizationListener(SynchronizationListener listener) |
void |
start()
Called upon database cluster start.
|
void |
stop()
Called when database cluster is stopped.
|
String |
toString() |
public DatabaseClusterImpl(String id, DatabaseClusterConfiguration<Z,D> configuration, DatabaseClusterConfigurationListener<Z,D> listener)
@ManagedOperation public void deactivate(String databaseId)
databaseId
- a database identifierIllegalArgumentException
- if no database exists with the specified identifier.@ManagedOperation public void activate(String databaseId)
databaseId
- a database identifierIllegalArgumentException
- if no database exists with the specified identifier.IllegalStateException
- if synchronization fails.@ManagedOperation public void activate(String databaseId, String strategyId)
databaseId
- a database identifierstrategyId
- the identifer of a synchronization strategyIllegalArgumentException
- if no database exists with the specified identifier, or no synchronization strategy exists with the specified identifier.IllegalStateException
- if synchronization fails.@ManagedOperation public boolean isAlive(String databaseId)
databaseId
- a database identifierIllegalArgumentException
- if no database exists with the specified identifier.@ManagedAttribute public Set<String> getActiveDatabases()
@ManagedAttribute public Set<String> getInactiveDatabases()
@ManagedAttribute public String getVersion()
@ManagedOperation public void add(String databaseId) throws JMException
databaseId
- a database identifierJMException
IllegalArgumentException
- if database already exists.@ManagedOperation public void remove(String databaseId)
databaseId
- a database identifierIllegalStateException
- if database is still active.@ManagedAttribute public String getId()
getId
in interface DatabaseCluster<Z,D extends Database<Z>>
DatabaseCluster.getId()
@ManagedAttribute public boolean isActive()
isActive
in interface DatabaseCluster<Z,D extends Database<Z>>
DatabaseCluster.isActive()
@ManagedAttribute public Set<String> getSynchronizationStrategies()
@ManagedAttribute public String getDefaultSynchronizationStrategy()
@ManagedOperation @Description(value="Flushes this cluster\'s cache of database meta data") public void flushMetaDataCache()
@ManagedOperation public void addConfigurationListener(DatabaseClusterConfigurationListener<Z,D> listener)
addConfigurationListener
in interface DatabaseCluster<Z,D extends Database<Z>>
DatabaseCluster.addConfigurationListener(net.sf.hajdbc.DatabaseClusterConfigurationListener)
@ManagedOperation public void addListener(DatabaseClusterListener listener)
addListener
in interface DatabaseCluster<Z,D extends Database<Z>>
DatabaseCluster.addListener(net.sf.hajdbc.DatabaseClusterListener)
@ManagedOperation public void addSynchronizationListener(SynchronizationListener listener)
addSynchronizationListener
in interface DatabaseCluster<Z,D extends Database<Z>>
DatabaseCluster.addSynchronizationListener(net.sf.hajdbc.SynchronizationListener)
@ManagedOperation public void removeConfigurationListener(DatabaseClusterConfigurationListener<Z,D> listener)
removeConfigurationListener
in interface DatabaseCluster<Z,D extends Database<Z>>
DatabaseCluster.removeConfigurationListener(net.sf.hajdbc.DatabaseClusterConfigurationListener)
@ManagedOperation public void removeListener(DatabaseClusterListener listener)
removeListener
in interface DatabaseCluster<Z,D extends Database<Z>>
DatabaseCluster.removeListener(net.sf.hajdbc.DatabaseClusterListener)
@ManagedOperation public void removeSynchronizationListener(SynchronizationListener listener)
removeSynchronizationListener
in interface DatabaseCluster<Z,D extends Database<Z>>
DatabaseCluster.removeSynchronizationListener(net.sf.hajdbc.SynchronizationListener)
public boolean activate(D database, StateManager manager)
activate
in interface DatabaseCluster<Z,D extends Database<Z>>
database
- a database descriptormanager
- a state managerDatabaseCluster.activate(net.sf.hajdbc.Database, net.sf.hajdbc.state.StateManager)
public boolean deactivate(D database, StateManager manager)
deactivate
in interface DatabaseCluster<Z,D extends Database<Z>>
database
- a database descriptormanager
- a state managerDatabaseCluster.deactivate(net.sf.hajdbc.Database, net.sf.hajdbc.state.StateManager)
public Balancer<Z,D> getBalancer()
getBalancer
in interface DatabaseCluster<Z,D extends Database<Z>>
Balancer
DatabaseCluster.getBalancer()
public D getDatabase(String id)
getDatabase
in interface DatabaseCluster<Z,D extends Database<Z>>
id
- a database identifierDatabaseCluster.getDatabase(java.lang.String)
public DatabaseMetaDataCache<Z,D> getDatabaseMetaDataCache()
getDatabaseMetaDataCache
in interface DatabaseCluster<Z,D extends Database<Z>>
DatabaseMetaDataCache
implementationDatabaseCluster.getDatabaseMetaDataCache()
public Dialect getDialect()
getDialect
in interface DatabaseCluster<Z,D extends Database<Z>>
Dialect
DatabaseCluster.getDialect()
public Durability<Z,D> getDurability()
getDurability
in interface DatabaseCluster<Z,D extends Database<Z>>
DatabaseCluster.getDurability()
public LockManager getLockManager()
getLockManager
in interface DatabaseCluster<Z,D extends Database<Z>>
DatabaseCluster.getLockManager()
public ExecutorService getExecutor()
getExecutor
in interface DatabaseCluster<Z,D extends Database<Z>>
DatabaseCluster.getExecutor()
public TransactionMode getTransactionMode()
getTransactionMode
in interface DatabaseCluster<Z,D extends Database<Z>>
DatabaseCluster.getTransactionMode()
public StateManager getStateManager()
getStateManager
in interface DatabaseCluster<Z,D extends Database<Z>>
DatabaseCluster.getStateManager()
public ThreadFactory getThreadFactory()
getThreadFactory
in interface DatabaseCluster<Z,D extends Database<Z>>
public Decoder getDecoder()
getDecoder
in interface DatabaseCluster<Z,D extends Database<Z>>
public InputSinkStrategy<? extends Object> getInputSinkStrategy()
getInputSinkStrategy
in interface DatabaseCluster<Z,D extends Database<Z>>
public TransactionIdentifierFactory<? extends Object> getTransactionIdentifierFactory()
getTransactionIdentifierFactory
in interface DatabaseCluster<Z,D extends Database<Z>>
DatabaseCluster.getTransactionIdentifierFactory()
public boolean isCurrentDateEvaluationEnabled()
isCurrentDateEvaluationEnabled
in interface DatabaseCluster<Z,D extends Database<Z>>
DatabaseCluster.isCurrentDateEvaluationEnabled()
public boolean isCurrentTimeEvaluationEnabled()
isCurrentTimeEvaluationEnabled
in interface DatabaseCluster<Z,D extends Database<Z>>
DatabaseCluster.isCurrentTimeEvaluationEnabled()
public boolean isCurrentTimestampEvaluationEnabled()
isCurrentTimestampEvaluationEnabled
in interface DatabaseCluster<Z,D extends Database<Z>>
DatabaseCluster.isCurrentTimestampEvaluationEnabled()
public boolean isIdentityColumnDetectionEnabled()
isIdentityColumnDetectionEnabled
in interface DatabaseCluster<Z,D extends Database<Z>>
DatabaseCluster.isIdentityColumnDetectionEnabled()
public boolean isRandEvaluationEnabled()
isRandEvaluationEnabled
in interface DatabaseCluster<Z,D extends Database<Z>>
DatabaseCluster.isRandEvaluationEnabled()
public boolean isSequenceDetectionEnabled()
isSequenceDetectionEnabled
in interface DatabaseCluster<Z,D extends Database<Z>>
DatabaseCluster.isSequenceDetectionEnabled()
public void start() throws Exception
start
in interface Lifecycle
Exception
- if this service fails to start.Lifecycle.start()
public void stop()
stop
in interface Lifecycle
Lifecycle.stop()
Copyright © 2004–2014 Paul Ferraro. All rights reserved.