public interface PluginService extends ExceptionHandler
Connection and its HostSpec.| Modifier and Type | Method and Description |
|---|---|
boolean |
acceptsStrategy(HostRole role,
java.lang.String strategy)
Returns a boolean indicating if the available
ConnectionProvider or
ConnectionPlugin instances support the selection of a host with the requested role and
strategy via getHostSpecByStrategy(software.amazon.jdbc.HostRole, java.lang.String). |
java.sql.Connection |
connect(HostSpec hostSpec,
java.util.Properties props)
Establishes a connection to the given host using the given properties.
|
void |
fillAliases(java.sql.Connection connection,
HostSpec hostSpec) |
java.sql.Connection |
forceConnect(HostSpec hostSpec,
java.util.Properties props)
Establishes a connection to the given host using the given properties.
|
void |
forceRefreshHostList() |
void |
forceRefreshHostList(java.sql.Connection connection) |
ConnectionProvider |
getConnectionProvider() |
java.sql.Connection |
getCurrentConnection() |
HostSpec |
getCurrentHostSpec() |
Dialect |
getDialect() |
java.lang.String |
getDriverProtocol() |
HostListProvider |
getHostListProvider() |
HostRole |
getHostRole(java.sql.Connection conn)
Evaluates the host role of the given connection - either a writer or a reader.
|
java.util.List<HostSpec> |
getHosts() |
HostSpecBuilder |
getHostSpecBuilder() |
HostSpec |
getHostSpecByStrategy(HostRole role,
java.lang.String strategy)
Selects a
HostSpec with the requested role from available hosts using the requested
strategy. |
HostSpec |
getInitialConnectionHostSpec() |
HostSpec |
identifyConnection(java.sql.Connection connection) |
boolean |
isExplicitReadOnly() |
boolean |
isInTransaction() |
boolean |
isReadOnly() |
void |
refreshHostList() |
void |
refreshHostList(java.sql.Connection connection) |
void |
setAvailability(java.util.Set<java.lang.String> hostAliases,
HostAvailability availability) |
void |
setCurrentConnection(@NonNull java.sql.Connection connection,
@NonNull HostSpec hostSpec) |
java.util.EnumSet<NodeChangeOptions> |
setCurrentConnection(@NonNull java.sql.Connection connection,
@NonNull HostSpec hostSpec,
@Nullable ConnectionPlugin skipNotificationForThisPlugin) |
void |
updateDialect(@NonNull java.sql.Connection connection) |
isLoginException, isLoginException, isNetworkException, isNetworkExceptionjava.sql.Connection getCurrentConnection()
HostSpec getCurrentHostSpec()
void setCurrentConnection(@NonNull java.sql.Connection connection,
@NonNull HostSpec hostSpec)
throws java.sql.SQLException
java.sql.SQLExceptionjava.util.EnumSet<NodeChangeOptions> setCurrentConnection(@NonNull java.sql.Connection connection, @NonNull HostSpec hostSpec, @Nullable ConnectionPlugin skipNotificationForThisPlugin) throws java.sql.SQLException
java.sql.SQLExceptionjava.util.List<HostSpec> getHosts()
HostSpec getInitialConnectionHostSpec()
boolean acceptsStrategy(HostRole role, java.lang.String strategy) throws java.sql.SQLException
ConnectionProvider or
ConnectionPlugin instances support the selection of a host with the requested role and
strategy via getHostSpecByStrategy(software.amazon.jdbc.HostRole, java.lang.String).role - the desired host rolestrategy - the strategy that should be used to pick a host (eg "random")ConnectionProvider or ConnectionPlugin instances
support the selection of a host with the requested role and strategy via
getHostSpecByStrategy(software.amazon.jdbc.HostRole, java.lang.String). Otherwise, return false.java.sql.SQLExceptionHostSpec getHostSpecByStrategy(HostRole role, java.lang.String strategy) throws java.sql.SQLException, java.lang.UnsupportedOperationException
HostSpec with the requested role from available hosts using the requested
strategy. acceptsStrategy(software.amazon.jdbc.HostRole, java.lang.String) should be called first to evaluate if the available
ConnectionProvider or ConnectionPlugin instances support the selection of a
host with the requested role and strategy.role - the desired role of the host - either a writer or a readerstrategy - the strategy that should be used to select a HostSpec from the
available hosts (eg "random")HostSpec with the requested rolejava.sql.SQLException - if the available ConnectionProvider or
ConnectionPlugin instances do not cannot find a
host matching the requested role or an error occurs while
selecting a hostjava.lang.UnsupportedOperationException - if the available ConnectionProvider or
ConnectionPlugin instances do not support the
requested strategyHostRole getHostRole(java.sql.Connection conn) throws java.sql.SQLException
conn - a connection to the database instance whose role should be determinedjava.sql.SQLException - if there is a problem executing or processing the SQL query used to
determine the host rolevoid setAvailability(java.util.Set<java.lang.String> hostAliases,
HostAvailability availability)
boolean isExplicitReadOnly()
boolean isReadOnly()
boolean isInTransaction()
HostListProvider getHostListProvider()
void refreshHostList()
throws java.sql.SQLException
java.sql.SQLExceptionvoid refreshHostList(java.sql.Connection connection)
throws java.sql.SQLException
java.sql.SQLExceptionvoid forceRefreshHostList()
throws java.sql.SQLException
java.sql.SQLExceptionvoid forceRefreshHostList(java.sql.Connection connection)
throws java.sql.SQLException
java.sql.SQLExceptionjava.sql.Connection connect(HostSpec hostSpec, java.util.Properties props) throws java.sql.SQLException
ConnectionProvider has been set with
ConnectionProviderManager.setConnectionProvider(software.amazon.jdbc.ConnectionProvider) and
ConnectionProvider.acceptsUrl(String, HostSpec, Properties) returns true for the
desired protocol, host, and properties, the connection will be created by the non-default
ConnectionProvider. Otherwise, the connection will be created by the default
ConnectionProvider. The default ConnectionProvider will be DriverConnectionProvider for
connections requested via the DriverManager and
DataSourceConnectionProvider for connections requested via an
AwsWrapperDataSource.hostSpec - the host details for the desired connectionprops - the connection propertiesConnection to the requested hostjava.sql.SQLException - if there was an error establishing a Connection to the requested
hostjava.sql.Connection forceConnect(HostSpec hostSpec, java.util.Properties props) throws java.sql.SQLException
ConnectionPlugin.connect(java.lang.String, software.amazon.jdbc.HostSpec, java.util.Properties, boolean, software.amazon.jdbc.JdbcCallable<java.sql.Connection, java.sql.SQLException>) in that the default ConnectionProvider will be used to
establish the connection even if a non-default ConnectionProvider has been set via
ConnectionProviderManager.setConnectionProvider(software.amazon.jdbc.ConnectionProvider). The default ConnectionProvider will be
DriverConnectionProvider for connections requested via the
DriverManager and DataSourceConnectionProvider for connections
requested via an AwsWrapperDataSource.hostSpec - the host details for the desired connectionprops - the connection propertiesConnection to the requested hostjava.sql.SQLException - if there was an error establishing a Connection to the requested
hostDialect getDialect()
void updateDialect(@NonNull java.sql.Connection connection)
throws java.sql.SQLException
java.sql.SQLExceptionHostSpec identifyConnection(java.sql.Connection connection) throws java.sql.SQLException
java.sql.SQLExceptionvoid fillAliases(java.sql.Connection connection,
HostSpec hostSpec)
throws java.sql.SQLException
java.sql.SQLExceptionHostSpecBuilder getHostSpecBuilder()
ConnectionProvider getConnectionProvider()
java.lang.String getDriverProtocol()