Package com.hazelcast.dataconnection
Class DataConnectionBase
java.lang.Object
com.hazelcast.dataconnection.DataConnectionBase
- All Implemented Interfaces:
DataConnection
- Direct Known Subclasses:
HazelcastDataConnection,KafkaDataConnection,MongoDataConnection
Base class for
DataConnection implementations. Provides a ReferenceCounter. When the ref count gets to 0, calls the DataConnection.destroy()
method.- Since:
- 5.3
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal DataConnectionConfigReturns the configuration of this DataConnection.final StringgetName()Returns the name of this data connection as specified in theDataConnectionConfigor theCREATE DATA CONNECTIONcommand.final voidrelease()Release a retained data connection.final voidretain()Prevents the data connection from being closed.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.hazelcast.dataconnection.DataConnection
destroy, listResources, options, resourceTypes
-
Constructor Details
-
DataConnectionBase
-
-
Method Details
-
getName
Description copied from interface:DataConnectionReturns the name of this data connection as specified in theDataConnectionConfigor theCREATE DATA CONNECTIONcommand.- Specified by:
getNamein interfaceDataConnection- Returns:
- the name of this DataConnection
-
retain
public final void retain()Description copied from interface:DataConnectionPrevents the data connection from being closed. It is useful when the processor wants to avoid the data connection from being closed while it is obtaining connections from it. Multiple threads can retain the same DataConnection concurrently.Note that the DataConnection also isn't closed until all shared connections obtained from it are returned. This feature, together with the lock allows the processor to avoid concurrent close while it is using the connection.
- Specified by:
retainin interfaceDataConnection
-
release
public final void release()Description copied from interface:DataConnectionRelease a retained data connection. Must be called after everyDataConnection.retain()call, otherwise the data connection will leak.- Specified by:
releasein interfaceDataConnection
-
getConfig
Description copied from interface:DataConnectionReturns the configuration of this DataConnection.- Specified by:
getConfigin interfaceDataConnection
-