Class BaseGrpcClient<V>

  • Type Parameters:
    V - the type of value this client contains
    Direct Known Subclasses:
    AsyncNamedCacheClient

    public abstract class BaseGrpcClient<V>
    extends Object
    A base class for gRPC clients.
    Since:
    23.03
    Author:
    Jonathan Knight 2023.02.02
    • Field Detail

      • f_sScopeName

        protected final String f_sScopeName
        The scope name to use for requests.
      • f_sName

        protected final String f_sName
        The cache name.
      • f_serializer

        protected final com.tangosol.io.Serializer f_serializer
        The Serializer to use.
      • f_sFormat

        protected final String f_sFormat
        The serialization format.
      • m_fReleased

        protected volatile boolean m_fReleased
        A flag indicating whether this client has been released.
      • m_fDestroyed

        protected volatile boolean m_fDestroyed
        A flag indicating whether this client has been destroyed.
      • f_executor

        protected final Executor f_executor
        The Executor to use to dispatch events.
      • f_dispatcher

        protected final com.tangosol.net.events.EventDispatcher f_dispatcher
        The event dispatcher for this cache.
    • Method Detail

      • isReleased

        public boolean isReleased()
        Return true if the cache has been released.
        Returns:
        true if the cache has been released
      • isDestroyed

        public boolean isDestroyed()
        Return true if the cache has been destroyed.
        Returns:
        true if the cache has been destroyed
      • isActiveInternal

        public boolean isActiveInternal()
        Helper method for cache active checks.
        Returns:
        true if the cache is still active
      • createSerializer

        protected static com.tangosol.io.Serializer createSerializer​(String sFormat)
        Obtain the default Serializer to be used by the cache.
        Returns:
        the default Serializer to be used by the cache
      • getDefaultSerializerFormat

        protected static String getDefaultSerializerFormat()
        Return the default serialization format.

        The default format will be Java serialization unless the coherence.pof.enabled property is set when it will be POF.

        Returns:
        the default serialization format
      • createDefaultExecutor

        protected static Executor createDefaultExecutor()
        Obtain the default Executor to be used by the cache.
        Returns:
        the default Executor to be used by the cache
      • toBytesValue

        protected com.google.protobuf.BytesValue toBytesValue​(Object obj)
        A utility method to serialize an Object to BytesValue.
        Parameters:
        obj - the object to convert to BytesValue.
        Returns:
        the BytesValue for the specified object
      • toByteString

        protected com.google.protobuf.ByteString toByteString​(Object obj)
        A utility method to serialize an Object to ByteString.
        Parameters:
        obj - the object to convert to ByteString.
        Returns:
        the ByteString for the specified object
      • valueFromOptionalValue

        protected V valueFromOptionalValue​(OptionalValue optional,
                                           V defaultValue)
        A utility method to deserialize an OptionalValue to an Object.

        If no value is present in the OptionalValue then the default value is returned.

        Parameters:
        optional - the OptionalValue to deserialize an Object.
        defaultValue - the value to return if the {link @OptionalValue} does not contain a value
        Returns:
        an object from the specified BytesValue
      • valueFromBytesValue

        protected V valueFromBytesValue​(com.google.protobuf.BytesValue bv)
        A utility method to deserialize a BytesValue to an Object.
        Parameters:
        bv - the BytesValue to deserialize an Object.
        Returns:
        an object from the specified BytesValue
      • fromBytesValue

        protected <T> T fromBytesValue​(com.google.protobuf.BytesValue bytes)
        A utility method to deserialize a BytesValue to an Object.
        Parameters:
        bytes - the BytesValue to deserialize an Object.
        Returns:
        an object from the specified BytesValue
      • fromByteString

        protected <T> T fromByteString​(com.google.protobuf.ByteString bytes)
        A utility method to deserialize a ByteString to an Object.
        Parameters:
        bytes - the ByteString to deserialize an Object.
        Returns:
        an object from the specified ByteString