java.lang.Object
org.apache.beam.sdk.io.aws2.common.ObjectPool<KeyT,ObjectT>
- Type Parameters:
KeyT
- > Key to share objects byObjectT
- > Shared object
- Direct Known Subclasses:
ObjectPool.ClientPool
@Internal
public class ObjectPool<KeyT extends @NonNull Object,ObjectT extends @NonNull Object>
extends Object
Reference counting object pool to easily share invalid input: '&' destroy objects.
Internal only, subject to incompatible changes or removal at any time!
NOTE: This relies heavily on the implementation of Object.equals(Object)
for ObjectPool
.
If not implemented properly, clients can't be shared between instances of DoFn
.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
ObjectPool.ClientPool<ClientT extends SdkClient>
Client pool to easily share AWS clients per configuration. -
Constructor Summary
ConstructorsConstructorDescriptionObjectPool
(Function<KeyT, ObjectT> builder) ObjectPool
(Function<KeyT, ObjectT> builder, @Nullable ThrowingConsumer<Exception, ObjectT> finalizer) -
Method Summary
Modifier and TypeMethodDescriptionstatic <ClientT extends SdkClient,
BuilderT extends AwsClientBuilder<BuilderT, ClientT>>
ObjectPool.ClientPool<ClientT> pooledClientFactory
(BuilderT builder) void
Release a reference to a shared client instance.void
releaseByKey
(KeyT key) Release a reference to a shared object instance usingObjectPool
.Retain a reference to a shared client instance.
-
Constructor Details
-
ObjectPool
-
ObjectPool
-
-
Method Details
-
retain
Retain a reference to a shared client instance. If not available, an instance is created. -
releaseByKey
Release a reference to a shared object instance usingObjectPool
. If that instance is not used anymore, it will be removed and destroyed. -
release
Release a reference to a shared client instance. If that instance is not used anymore, it will be removed and destroyed. -
pooledClientFactory
public static <ClientT extends SdkClient,BuilderT extends AwsClientBuilder<BuilderT, ObjectPool.ClientPool<ClientT> pooledClientFactoryClientT>> (BuilderT builder)
-