Class ObjectPool<KeyT extends @NonNull Object,ObjectT extends @NonNull Object>

java.lang.Object
org.apache.beam.sdk.io.aws2.common.ObjectPool<KeyT,ObjectT>
Type Parameters:
KeyT - > Key to share objects by
ObjectT - > 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.

  • Constructor Details

  • Method Details

    • retain

      public ObjectT retain(KeyT key)
      Retain a reference to a shared client instance. If not available, an instance is created.
    • releaseByKey

      public void releaseByKey(KeyT key)
      Release a reference to a shared object instance using ObjectPool. If that instance is not used anymore, it will be removed and destroyed.
    • release

      public void release(ObjectT object)
      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, ClientT>> ObjectPool.ClientPool<ClientT> pooledClientFactory(BuilderT builder)