ProviderT
- Client providerConfigT
- Optional, nullable configurationClientT
- Clientpublic class ClientPool<ProviderT,ConfigT,ClientT extends java.lang.AutoCloseable>
extends java.lang.Object
NOTE: This relies heavily on the implementation of Object.equals(Object)
for ProviderT
and ConfigT
. If not implemented properly, clients can't be shared between
instances of DoFn
.
Constructor and Description |
---|
ClientPool(java.util.function.BiFunction<ProviderT,ConfigT,ClientT> builder) |
Modifier and Type | Method and Description |
---|---|
static <ClientT extends java.lang.AutoCloseable,BuilderT extends AwsClientBuilder<BuilderT,ClientT>> |
pooledClientFactory(BuilderT builder) |
void |
release(ClientT client)
Release a reference to a shared client instance.
|
void |
release(ProviderT provider,
ConfigT config)
Release a reference to a shared client instance using
ProviderT and ConfigT . |
ClientT |
retain(ProviderT provider,
ConfigT config)
Retain a reference to a shared client instance.
|
public static <ClientT extends java.lang.AutoCloseable,BuilderT extends AwsClientBuilder<BuilderT,ClientT>> ClientPool<AwsOptions,ClientConfiguration,ClientT> pooledClientFactory(BuilderT builder)
public ClientT retain(ProviderT provider, ConfigT config)
public void release(ProviderT provider, ConfigT config) throws java.lang.Exception
ProviderT
and ConfigT
.
If that instance is not used anymore, it will be removed and destroyed.java.lang.Exception
public void release(ClientT client) throws java.lang.Exception
java.lang.Exception