public interface RwSplitContext
| Modifier and Type | Method and Description |
|---|---|
void |
bindReader(java.sql.Connection conn,
HostSpec host)
Records (caches) the reader connection and host, preserving the legacy
setReaderConnection log. |
void |
bindWriter(java.sql.Connection conn,
HostSpec host)
Records the writer connection and host, preserving the legacy
setWriterConnection log. |
void |
closeReaderConnectionIfIdle() |
void |
closeWriterConnectionIfIdle() |
java.sql.Connection |
connect(HostSpec host,
java.util.Properties props)
Opens a connection to the given host via the plugin service (using this plugin as the caller).
|
@Nullable java.sql.Connection |
currentConnection() |
@Nullable HostSpec |
currentHostSpec() |
void |
enterReadWriteSplit()
Marks that the plugin is actively read/write splitting (sets
inReadWriteSplit). |
@Nullable HostListProviderService |
hostListProviderService() |
boolean |
isConnectionUsable(@Nullable java.sql.Connection conn) |
boolean |
isInReadWriteSplit() |
boolean |
isReaderFromPool() |
boolean |
isWriterFromPool() |
void |
logAndThrow(java.lang.String message)
Logs the message at SEVERE and throws a
ReadWriteSplittingSQLException. |
void |
logAndThrow(java.lang.String message,
SqlState sqlState)
Logs the message at SEVERE and throws a
ReadWriteSplittingSQLException with the SQL state. |
void |
markReaderFromPool(boolean fromPool) |
void |
markWriterFromPool(boolean fromPool) |
PluginService |
pluginService() |
java.util.Properties |
properties() |
@Nullable java.sql.Connection |
readerConnection() |
@Nullable HostSpec |
readerHostSpec() |
void |
setWriterHostSpec(HostSpec host)
Records the resolved writer host (without a connection), e.g.
|
void |
switchCurrentConnectionTo(java.sql.Connection conn,
HostSpec host)
Switches the wrapper's current connection to the given connection/host.
|
@Nullable java.sql.Connection |
writerConnection() |
@Nullable HostSpec |
writerHostSpec() |
PluginService pluginService()
@Nullable HostListProviderService hostListProviderService()
java.util.Properties properties()
@Nullable java.sql.Connection currentConnection()
@Nullable HostSpec currentHostSpec()
@Nullable java.sql.Connection writerConnection()
@Nullable java.sql.Connection readerConnection()
@Nullable HostSpec writerHostSpec()
@Nullable HostSpec readerHostSpec()
void bindWriter(java.sql.Connection conn,
HostSpec host)
throws java.sql.SQLException
setWriterConnection log.java.sql.SQLExceptionvoid setWriterHostSpec(HostSpec host)
void bindReader(java.sql.Connection conn,
HostSpec host)
setReaderConnection log.void switchCurrentConnectionTo(java.sql.Connection conn,
HostSpec host)
throws java.sql.SQLException
java.sql.SQLExceptionjava.sql.Connection connect(HostSpec host, java.util.Properties props) throws java.sql.SQLException
java.sql.SQLExceptionvoid enterReadWriteSplit()
inReadWriteSplit).boolean isInReadWriteSplit()
boolean isConnectionUsable(@Nullable java.sql.Connection conn)
throws java.sql.SQLException
java.sql.SQLExceptionvoid closeReaderConnectionIfIdle()
void closeWriterConnectionIfIdle()
void markReaderFromPool(boolean fromPool)
void markWriterFromPool(boolean fromPool)
boolean isReaderFromPool()
boolean isWriterFromPool()
void logAndThrow(java.lang.String message)
throws java.sql.SQLException
ReadWriteSplittingSQLException.java.sql.SQLExceptionvoid logAndThrow(java.lang.String message,
SqlState sqlState)
throws java.sql.SQLException
ReadWriteSplittingSQLException with the SQL state.java.sql.SQLException