Class DataConnectionBase

java.lang.Object
com.hazelcast.dataconnection.DataConnectionBase
All Implemented Interfaces:
DataConnection
Direct Known Subclasses:
HazelcastDataConnection, KafkaDataConnection, MongoDataConnection

public abstract class DataConnectionBase extends Object implements DataConnection
Base class for DataConnection implementations. Provides a ReferenceCounter. When the ref count gets to 0, calls the DataConnection.destroy() method.
Since:
5.3
  • Constructor Details

  • Method Details

    • getName

      @Nonnull public final String getName()
      Description copied from interface: DataConnection
      Returns the name of this data connection as specified in the DataConnectionConfig or the CREATE DATA CONNECTION command.
      Specified by:
      getName in interface DataConnection
      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 interface DataConnection
    • release

      public final void release()
      Description copied from interface: DataConnection
      Release a retained data connection. Must be called after every DataConnection.retain() call, otherwise the data connection will leak.
      Specified by:
      release in interface DataConnection
    • getConfig

      @Nonnull public final DataConnectionConfig getConfig()
      Description copied from interface: DataConnection
      Returns the configuration of this DataConnection.
      Specified by:
      getConfig in interface DataConnection