Package org.opensearch.discovery.ec2
Class AmazonEc2Reference
- java.lang.Object
-
- org.opensearch.common.util.concurrent.AbstractRefCounted
-
- org.opensearch.discovery.ec2.AmazonEc2Reference
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,Releasable,RefCounted
public class AmazonEc2Reference extends AbstractRefCounted implements Releasable
Handles the shutdown of the wrappedAmazonEC2using reference counting.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description com.amazonaws.services.ec2.AmazonEC2client()Returns the underlying `AmazonEC2` client.voidclose()Call when the client is not needed anymore.protected voidcloseInternal()-
Methods inherited from class org.opensearch.common.util.concurrent.AbstractRefCounted
alreadyClosed, decRef, getName, incRef, refCount, tryIncRef
-
-
-
-
Method Detail
-
close
public void close()
Call when the client is not needed anymore.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Specified by:
closein interfaceReleasable
-
client
public com.amazonaws.services.ec2.AmazonEC2 client()
Returns the underlying `AmazonEC2` client. All method calls are permitted BUT NOT shutdown. Shutdown is called when reference count reaches 0.
-
closeInternal
protected void closeInternal()
- Specified by:
closeInternalin classAbstractRefCounted
-
-