Package com.hazelcast.dataconnection
Class DataConnectionBase
- java.lang.Object
-
- com.hazelcast.dataconnection.DataConnectionBase
-
- All Implemented Interfaces:
DataConnection
- Direct Known Subclasses:
HazelcastDataConnection
,KafkaDataConnection
,MongoDataConnection
public abstract class DataConnectionBase extends java.lang.Object implements DataConnection
Base class forDataConnection
implementations. Provides aReferenceCounter
. When the ref count gets to 0, calls theDataConnection.destroy()
method.- Since:
- 5.3
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
DataConnectionBase(DataConnectionConfig config)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description DataConnectionConfig
getConfig()
Returns the configuration of this DataConnection.java.lang.String
getName()
Returns the name of this data connection as specified in theDataConnectionConfig
or theCREATE DATA CONNECTION
command.void
release()
Release a retained data connection.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 Detail
-
DataConnectionBase
protected DataConnectionBase(@Nonnull DataConnectionConfig config)
-
-
Method Detail
-
getName
@Nonnull public final java.lang.String 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
@Nonnull public final DataConnectionConfig getConfig()
Description copied from interface:DataConnection
Returns the configuration of this DataConnection.- Specified by:
getConfig
in interfaceDataConnection
-
-