@Internal public class ObjectPool<KeyT,ObjectT> extends java.lang.Object
Internal only, subject to incompatible changes or removal at any time!
NOTE: This relies heavily on the implementation of Object.equals(Object) for KeyT.
 If not implemented properly, clients can't be shared between instances of DoFn.
| Modifier and Type | Class and Description | 
|---|---|
| static class  | ObjectPool.ClientPool<ClientT extends SdkClient>Client pool to easily share AWS clients per configuration. | 
| Constructor and Description | 
|---|
| ObjectPool(java.util.function.Function<KeyT,ObjectT> builder) | 
| ObjectPool(java.util.function.Function<KeyT,ObjectT> builder,
          @Nullable ThrowingConsumer<java.lang.Exception,ObjectT> finalizer) | 
| Modifier and Type | Method and Description | 
|---|---|
| static <ClientT extends SdkClient,BuilderT extends AwsClientBuilder<BuilderT,ClientT>> | pooledClientFactory(BuilderT builder) | 
| void | release(ObjectT object)Release a reference to a shared client instance. | 
| void | releaseByKey(KeyT key)Release a reference to a shared object instance using  KeyT. | 
| ObjectT | retain(KeyT key)Retain a reference to a shared client instance. | 
public ObjectPool(java.util.function.Function<KeyT,ObjectT> builder, @Nullable ThrowingConsumer<java.lang.Exception,ObjectT> finalizer)
public ObjectT retain(KeyT key)
public void releaseByKey(KeyT key)
KeyT. If that instance is not
 used anymore, it will be removed and destroyed.public void release(ObjectT object)
public static <ClientT extends SdkClient,BuilderT extends AwsClientBuilder<BuilderT,ClientT>> ObjectPool.ClientPool<ClientT> pooledClientFactory(BuilderT builder)