Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
* Interface for connection plugin factories. This class implements ways to initialize a connection
* plugin.
*
* @apiNote Consider using {@link ServicesContainerPluginFactory} for new implementations as it provides access to all
* services in the {@link FullServicesContainer}.
* <p>Note: consider using {@link ServicesContainerPluginFactory} for new implementations as it provides access to all
* services in the {@link FullServicesContainer}.
*/
public interface ConnectionPluginFactory {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@ public Connection connect(
*
* @param props The connection properties.
* @return {@link CustomEndpointMonitor}
* @throws SQLException if an error occurs while attempting to create the monitor.
*/
protected CustomEndpointMonitor createMonitorIfAbsent(Properties props) throws SQLException {
return this.servicesContainer.getMonitorService().runIfAbsent(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ public interface ConnectionService {
* @param hostSpec the hostSpec containing the host information for the auxiliary connection.
* @param props the properties for the auxiliary connection.
* @return a new connection to the given host using the given props.
* @throws SQLException if an error occurs while opening the connection.
*/
Connection open(HostSpec hostSpec, Properties props) throws SQLException;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public interface MonitorService {
* last-updated timestamp within this duration it will be considered stuck.
* @param errorResponses a {@link Set} defining actions to take if the monitor is stuck or in an error state.
* @param producedDataClass the class of data produced by the monitor.
* @param <T> the type of the monitor.
*/
<T extends Monitor> void registerMonitorTypeIfAbsent(
Class<T> monitorClass,
Expand All @@ -52,18 +53,20 @@ <T extends Monitor> void registerMonitorTypeIfAbsent(
* Creates and starts the given monitor if it does not already exist and stores it under the given monitor type and
* key. If the monitor already exists, its expiration time will be renewed, even if it was already expired.
*
* @param monitorClass the concrete class of the monitor, eg `CustomEndpointMonitorImpl.class`.
* @param key the key for the monitor, eg
* "custom-endpoint.cluster-custom-XYZ.us-east-2.rds.amazonaws.com:5432".
* @param storageService the storage service for the monitor to use.
* @param monitorClass the concrete class of the monitor, eg `CustomEndpointMonitorImpl.class`.
* @param key the key for the monitor, eg
* "custom-endpoint.cluster-custom-XYZ.us-east-2.rds.amazonaws.com:5432".
* @param storageService the storage service for the monitor to use.
* @param telemetryFactory the telemetry factory for creating telemetry data.
* @param originalUrl the URL of the original database connection.
* @param driverProtocol the protocol for the underlying target driver.
* @param driverDialect the target driver dialect.
* @param dbDialect the database dialect.
* @param originalProps the properties of the original database connection.
* @param initializer an initializer function to use to create the monitor if it does not already exist.
* @param originalUrl the URL of the original database connection.
* @param driverProtocol the protocol for the underlying target driver.
* @param driverDialect the target driver dialect.
* @param dbDialect the database dialect.
* @param originalProps the properties of the original database connection.
* @param initializer an initializer function to use to create the monitor if it does not already exist.
* @param <T> the type of the monitor.
* @return the new or existing monitor.
* @throws SQLException if an error occurs while trying to create the monitor.
*/
<T extends Monitor> T runIfAbsent(
Class<T> monitorClass,
Expand All @@ -82,6 +85,7 @@ <T extends Monitor> T runIfAbsent(
*
* @param monitorClass the expected class of the monitor.
* @param key the key for the monitor.
* @param <T> the type of the monitor.
* @return the monitor stored at the given key.
*/
@Nullable
Expand All @@ -93,6 +97,7 @@ <T extends Monitor> T runIfAbsent(
*
* @param monitorClass the expected class of the monitor.
* @param key the key for the monitor.
* @param <T> the type of the monitor.
* @return the monitor that was removed. Returns null if there was no monitor at the given key or the expected monitor
* class did not match the actual monitor class.
*/
Expand All @@ -105,13 +110,15 @@ <T extends Monitor> T runIfAbsent(
* @param monitorClass the class of the monitor, eg `CustomEndpointMonitorImpl.class`.
* @param key the key for the monitor, eg
* "custom-endpoint.cluster-custom-XYZ.us-east-2.rds.amazonaws.com:5432".
* @param <T> the type of the monitor.
*/
<T extends Monitor> void stopAndRemove(Class<T> monitorClass, Object key);

/**
* Stops all monitors for the given type and removes them from the monitor service.
*
* @param monitorClass the class of the monitor, eg `CustomEndpointMonitorImpl.class`.
* @param <T> the type of the monitor.
*/
<T extends Monitor> void stopAndRemoveMonitors(Class<T> monitorClass);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ protected boolean isExpired() {

/**
* Renews a cache item's expiration time.
*
* @param timeToLiveNanos the duration that the item should sit in the cache before being considered expired, in
* nanoseconds.
*/
protected void extendExpiration(long timeToLiveNanos) {
this.expirationTimeNanos = System.nanoTime() + timeToLiveNanos;
Expand Down
Loading