public class PluginServiceImpl extends java.lang.Object implements PluginService, CanReleaseResources, HostListProviderService, PluginManagerService
| Modifier and Type | Field and Description |
|---|---|
protected java.sql.Connection |
currentConnection |
protected HostSpec |
currentHostSpec |
protected HostListProvider |
hostListProvider |
protected java.util.List<HostSpec> |
hosts |
protected HostSpec |
initialConnectionHostSpec |
protected ConnectionPluginManager |
pluginManager |
| Constructor and Description |
|---|
PluginServiceImpl(@NonNull ConnectionPluginManager pluginManager,
@NonNull java.util.Properties props,
@NonNull java.lang.String originalUrl,
java.lang.String targetDriverProtocol) |
| Modifier and Type | Method and Description |
|---|---|
protected java.util.EnumSet<NodeChangeOptions> |
compare(@NonNull java.sql.Connection connA,
@NonNull HostSpec hostSpecA,
@NonNull java.sql.Connection connB,
@NonNull HostSpec hostSpecB) |
protected java.util.EnumSet<NodeChangeOptions> |
compare(@NonNull HostSpec hostSpecA,
@NonNull HostSpec hostSpecB) |
java.sql.Connection |
connect(HostSpec hostSpec,
java.util.Properties props) |
void |
forceRefreshHostList() |
void |
forceRefreshHostList(java.sql.Connection connection) |
java.sql.Connection |
getCurrentConnection() |
HostSpec |
getCurrentHostSpec() |
HostListProvider |
getHostListProvider() |
java.util.List<HostSpec> |
getHosts() |
HostSpec |
getInitialConnectionHostSpec() |
boolean |
isExplicitReadOnly() |
boolean |
isInTransaction() |
boolean |
isReadOnly() |
boolean |
isStaticHostListProvider() |
void |
refreshHostList() |
void |
refreshHostList(java.sql.Connection connection) |
void |
releaseResources()
An object that implements this interface should release all acquired resources assuming it may
be disposed at any time.
|
void |
setAvailability(@NonNull java.util.Set<java.lang.String> hostAliases,
@NonNull 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 |
setHostListProvider(HostListProvider hostListProvider) |
void |
setInitialConnectionHostSpec(@NonNull HostSpec initialConnectionHostSpec) |
void |
setInTransaction(boolean inTransaction) |
void |
setReadOnly(boolean readOnly) |
protected final ConnectionPluginManager pluginManager
protected volatile HostListProvider hostListProvider
protected java.util.List<HostSpec> hosts
protected java.sql.Connection currentConnection
protected HostSpec currentHostSpec
protected HostSpec initialConnectionHostSpec
public PluginServiceImpl(@NonNull ConnectionPluginManager pluginManager, @NonNull java.util.Properties props, @NonNull java.lang.String originalUrl, java.lang.String targetDriverProtocol)
public java.sql.Connection getCurrentConnection()
getCurrentConnection in interface HostListProviderServicegetCurrentConnection in interface PluginServicepublic HostSpec getCurrentHostSpec()
getCurrentHostSpec in interface HostListProviderServicegetCurrentHostSpec in interface PluginServicepublic void setInitialConnectionHostSpec(@NonNull HostSpec initialConnectionHostSpec)
setInitialConnectionHostSpec in interface HostListProviderServicepublic HostSpec getInitialConnectionHostSpec()
getInitialConnectionHostSpec in interface HostListProviderServicegetInitialConnectionHostSpec in interface PluginServicepublic void setCurrentConnection(@NonNull java.sql.Connection connection,
@NonNull HostSpec hostSpec)
throws java.sql.SQLException
setCurrentConnection in interface PluginServicejava.sql.SQLExceptionpublic java.util.EnumSet<NodeChangeOptions> setCurrentConnection(@NonNull java.sql.Connection connection, @NonNull HostSpec hostSpec, @Nullable ConnectionPlugin skipNotificationForThisPlugin) throws java.sql.SQLException
setCurrentConnection in interface PluginServicejava.sql.SQLExceptionprotected java.util.EnumSet<NodeChangeOptions> compare(@NonNull java.sql.Connection connA, @NonNull HostSpec hostSpecA, @NonNull java.sql.Connection connB, @NonNull HostSpec hostSpecB)
protected java.util.EnumSet<NodeChangeOptions> compare(@NonNull HostSpec hostSpecA, @NonNull HostSpec hostSpecB)
public java.util.List<HostSpec> getHosts()
getHosts in interface PluginServicepublic void setAvailability(@NonNull java.util.Set<java.lang.String> hostAliases,
@NonNull HostAvailability availability)
setAvailability in interface PluginServicepublic boolean isExplicitReadOnly()
isExplicitReadOnly in interface PluginServicepublic boolean isReadOnly()
isReadOnly in interface PluginServicepublic boolean isInTransaction()
isInTransaction in interface PluginServicepublic void setReadOnly(boolean readOnly)
setReadOnly in interface PluginManagerServicepublic void setInTransaction(boolean inTransaction)
setInTransaction in interface PluginManagerServicepublic HostListProvider getHostListProvider()
getHostListProvider in interface HostListProviderServicegetHostListProvider in interface PluginServicepublic void refreshHostList()
throws java.sql.SQLException
refreshHostList in interface PluginServicejava.sql.SQLExceptionpublic void refreshHostList(java.sql.Connection connection)
throws java.sql.SQLException
refreshHostList in interface PluginServicejava.sql.SQLExceptionpublic void forceRefreshHostList()
throws java.sql.SQLException
forceRefreshHostList in interface PluginServicejava.sql.SQLExceptionpublic void forceRefreshHostList(java.sql.Connection connection)
throws java.sql.SQLException
forceRefreshHostList in interface PluginServicejava.sql.SQLExceptionpublic boolean isStaticHostListProvider()
isStaticHostListProvider in interface HostListProviderServicepublic void setHostListProvider(HostListProvider hostListProvider)
setHostListProvider in interface HostListProviderServicepublic java.sql.Connection connect(HostSpec hostSpec, java.util.Properties props) throws java.sql.SQLException
connect in interface PluginServicejava.sql.SQLExceptionpublic void releaseResources()
CanReleaseResourcesCalling this method does NOT mean that an object is disposing and there won't be any further calls. An object should keep its functional state after calling this method.
releaseResources in interface CanReleaseResources