Interface DatabaseConnectorService
- All Known Implementing Classes:
DatabaseConnectorServiceImpl
public interface DatabaseConnectorService
Service interface for managing multiple named database connections.
Connections are discovered from environment variables with the
CONNECTOR_DB_ prefix. Each connection is identified by a unique name
extracted from the environment variable pattern
CONNECTOR_DB_<NAME>_CONFIG.
Logging contract:
INFO— lifecycle events (initialization start, connection count, connection created)WARNING— recoverable failures (missing config when exit-on-failure is disabled)SEVERE— fatal failures that will cause server shutdown
- See Also:
-
Method Details
-
init
Initializes all database connections discovered from environment variables.Loads the MariaDB JDBC driver and creates HikariCP pools for each configured connection.
- Throws:
ConnectionInitException- if a connection with exit-on-failure enabled fails to initialize
-
shutdown
void shutdown()Shuts down all managed database connection pools. -
getConnection
Retrieves a database connection by its identifier.- Parameters:
id- the connection identifier (case-sensitive, as extracted from environment variables)- Returns:
- an
Optionalcontaining the connection, or empty if no connection exists with that id
-