Class SystemDatabaseMonitor
java.lang.Object
de.xima.fc.persistence.impl.system.health.SystemDatabaseMonitor
Monitors the database connection status.
-
Method Summary
Modifier and TypeMethodDescriptionbooleanChecks whether the last known status of the database connection is connected.booleanChecks whether the last known status of the database encryption settings is valid.booleanChecks whether the database connection is healthy, i.e. whether the database is reachable, the schema is up to date with the latest migrations and the encryption settings are valid.booleanChecks whether the last known status of the database schema is valid.booleantestConnectionStatus(boolean fireEvent) Checks whether the database connection is healthy, i.e. whether the database is reachable.booleantestEncryptionStatus(boolean fireEvent) Checks whether the database encryption settings are healthy, i.e. whether the database encryption settings are valid.booleantestHealth(boolean fireEvent) Checks whether the database connection is healthy, i.e. whether the database is reachable, the schema is up to date with the latest migrations and the encryption settings are valid.booleantestHealth(boolean fireEvent, boolean forceEvent) Checks whether the database connection is healthy, i.e. whether the database is reachable, the schema is up to date with the latest migrations and the encryption settings are valid.booleantestSchemaStatus(boolean fireEvent) Checks whether the database schema is healthy, i.e. whether the database schema is up to date with the latest migrations.
-
Method Details
-
isConnectionValid
public boolean isConnectionValid()Checks whether the last known status of the database connection is connected. A check is run in a fixed interval. UsetestConnectionStatus(boolean)to run a check now.- Returns:
trueif the database connection is connected,falseotherwise.
-
isSchemaValid
public boolean isSchemaValid()Checks whether the last known status of the database schema is valid. A check is run in a fixed interval. UsetestSchemaStatus(boolean)to run a check now.- Returns:
trueif the database schema is valid,falseotherwise.
-
isEncryptionValid
public boolean isEncryptionValid()Checks whether the last known status of the database encryption settings is valid. A check is run in a fixed interval. UsetestEncryptionStatus(boolean)to run a check now.- Returns:
trueif the database encryption settings are valid,falseotherwise.
-
testConnectionStatus
public boolean testConnectionStatus(boolean fireEvent) Checks whether the database connection is healthy, i.e. whether the database is reachable. In contrast withisConnectionValid(), this method actually performs a check and tries to reach the database, instead of returning the current status.- Returns:
trueif the database connection is healthy,falseotherwise.
-
testSchemaStatus
public boolean testSchemaStatus(boolean fireEvent) Checks whether the database schema is healthy, i.e. whether the database schema is up to date with the latest migrations. In contrast withisSchemaValid(), this method actually performs a check and tries to verify the database schema, instead of returning the current status.- Returns:
trueif the database schema is healthy,falseotherwise.
-
testEncryptionStatus
public boolean testEncryptionStatus(boolean fireEvent) Checks whether the database encryption settings are healthy, i.e. whether the database encryption settings are valid. In contrast withisEncryptionValid(), this method actually performs a check and tries to verify the database encryption settings, instead of returning the current status.- Returns:
trueif the database encryption settings are healthy,falseotherwise.
-
isHealthy
public boolean isHealthy()Checks whether the database connection is healthy, i.e. whether the database is reachable, the schema is up to date with the latest migrations and the encryption settings are valid. This method returns the last known status based on the periodic checks or the active checks performed bytestHealth(boolean). UsetestHealth(boolean)to perform an active check and update the status.- Returns:
trueif the database connection is healthy,falseotherwise.
-
testHealth
public boolean testHealth(boolean fireEvent) Checks whether the database connection is healthy, i.e. whether the database is reachable, the schema is up to date with the latest migrations and the encryption settings are valid. In contrast withisHealthy(), this method actually performs a check and tries to reach the database, verify the schema and encryption settings, instead of returning the current status.- Returns:
trueif the database connection is healthy,falseotherwise.
-
testHealth
public boolean testHealth(boolean fireEvent, boolean forceEvent) Checks whether the database connection is healthy, i.e. whether the database is reachable, the schema is up to date with the latest migrations and the encryption settings are valid. In contrast withisHealthy(), this method actually performs a check and tries to reach the database, verify the schema and encryption settings, instead of returning the current status.- Parameters:
fireEvent- whether to fire a health change event if the health status has changedforceEvent- whether to force firing a health change event even if the health status has not changed- Returns:
trueif the database connection is healthy,falseotherwise.
-