isInitialized

Property indicating whether the DatabaseManager is currently initialized and ready for use.

This property provides a comprehensive health check of the DatabaseManager's state, combining multiple indicators to determine if the database system is fully operational and ready to handle connection requests.

Health Check Components: The property evaluates three critical conditions:

  1. Initialization Success Flag:

    • Checks if the DatabaseManager completed initialization successfully

    • Ensures that all setup steps (connection pool, schema creation) completed

    • Verifies that no critical errors occurred during the initialization process

  2. DataSource Existence:

    • Confirms that the HikariCP DataSource object has been created

    • Ensures that the connection pool infrastructure is in place

    • Validates that the DataSource reference is not null

  3. DataSource Operational Status:

    • Verifies that the HikariCP DataSource is not in a closed state

    • Ensures that the connection pool is actively managing connections

    • Confirms that new connections can be obtained from the pool

Return Value Logic: The property returns true only when ALL of the following conditions are met:

  • initializedSuccessfully flag is true

  • dataSource is not null

  • dataSource.isClosed() returns false

If any of these conditions is false, the property returns false, indicating that the DatabaseManager is not ready for use and may need re-initialization.

Usage Scenarios: This property is useful in several contexts:

  1. Startup Validation:

    • Verify that database initialization completed successfully

    • Ensure that the plugin can proceed with database-dependent operations

  2. Health Monitoring:

    • Periodic checks to ensure database connectivity remains available

    • Integration with monitoring systems for alerting

  3. Error Recovery:

    • Determine if re-initialization is needed after connection failures

    • Decide whether to attempt database operations or queue them for later

  4. Administrative Commands:

    • Provide status information to administrators

    • Enable database health checking commands

Thread Safety: This property is thread-safe for reading, as it only accesses immutable state or performs simple property checks. However, the underlying state may change between calls if initialization or shutdown methods are called concurrently.

Performance Considerations: The property evaluation is very fast as it only performs:

  • Boolean flag checks (negligible cost)

  • Null reference checks (negligible cost)

  • HikariCP closed state check (minimal cost)

No database connections are created or tested during this check, making it suitable for frequent status polling without performance concerns.

Return

true if the DatabaseManager is fully initialized and operational, false if any component is not ready or has failed

Since

1.0.0

See also

for the method that sets up the database system

for the method that closes the database system