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
-
Method Summary
Modifier and TypeMethodDescriptionfinal DataConnectionConfig
Returns the configuration of this DataConnection.final String
getName()
Returns the name of this data connection as specified in theDataConnectionConfig
or theCREATE DATA CONNECTION
command.final void
release()
Release a retained data connection.final void
retain()
Prevents the data connection from being closed.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.hazelcast.dataconnection.DataConnection
destroy, listResources, options, resourceTypes
-
Constructor Details
-
DataConnectionBase
-
-
Method Details
-
getName
Description copied from interface:DataConnection
Returns the name of this data connection as specified in theDataConnectionConfig
or theCREATE DATA CONNECTION
command.- Specified by:
getName
in interfaceDataConnection
- Returns:
- the name of this DataConnection
-
retain
public final void retain()Description copied from interface:DataConnection
Prevents 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:
retain
in interfaceDataConnection
-
release
public final void release()Description copied from interface:DataConnection
Release a retained data connection. Must be called after everyDataConnection.retain()
call, otherwise the data connection will leak.- Specified by:
release
in interfaceDataConnection
-
getConfig
Description copied from interface:DataConnection
Returns the configuration of this DataConnection.- Specified by:
getConfig
in interfaceDataConnection
-