Class DefaultEndpoint

    • Field Detail

      • channel

        protected volatile Channel channel
    • Constructor Detail

      • DefaultEndpoint

        public DefaultEndpoint​(ClientOptions clientOptions,
                               ClientResources clientResources)
        Create a new DefaultEndpoint.
        Parameters:
        clientOptions - client options for this connection, must not be null.
        clientResources - client resources for this connection, must not be null.
    • Method Detail

      • setConnectionFacade

        public void setConnectionFacade​(ConnectionFacade connectionFacade)
        Description copied from interface: RedisChannelWriter
        Set the corresponding connection facade in order to notify it about channel active/inactive state.
        Specified by:
        setConnectionFacade in interface RedisChannelWriter
        Parameters:
        connectionFacade - the connection facade (external connection object)
      • write

        public <K,​V,​T> RedisCommand<K,​V,​T> write​(RedisCommand<K,​V,​T> command)
        Description copied from interface: RedisChannelWriter
        Write a command on the channel. The command may be changed/wrapped during write and the written instance is returned after the call.
        Specified by:
        write in interface RedisChannelWriter
        T - result type
        Parameters:
        command - the Redis command.
        Returns:
        the written Redis command.
      • write

        public <K,​V> Collection<RedisCommand<K,​V,​?>> write​(Collection<? extends RedisCommand<K,​V,​?>> commands)
        Description copied from interface: RedisChannelWriter
        Write multiple commands on the channel. The commands may be changed/wrapped during write and the written instance is returned after the call.
        Specified by:
        write in interface RedisChannelWriter
        Type Parameters:
        K - key type
        V - value type
        Parameters:
        commands - the Redis commands.
        Returns:
        the written redis command
      • writeToBuffer

        protected <C extends RedisCommand<?,​?,​T>,​T> void writeToBuffer​(C command)
      • notifyChannelActive

        public void notifyChannelActive​(Channel channel)
        Description copied from interface: Endpoint
        Notify about channel activation.
        Specified by:
        notifyChannelActive in interface Endpoint
        Parameters:
        channel - the channel
      • notifyChannelInactive

        public void notifyChannelInactive​(Channel channel)
        Description copied from interface: Endpoint
        Notify about channel deactivation.
        Specified by:
        notifyChannelInactive in interface Endpoint
        Parameters:
        channel - the channel
      • notifyException

        public void notifyException​(Throwable t)
        Description copied from interface: Endpoint
        Notify about an exception occured in channel/command processing
        Specified by:
        notifyException in interface Endpoint
        Parameters:
        t - the Exception
      • flushCommands

        public void flushCommands()
        Description copied from interface: RedisChannelWriter
        Flush pending commands. This commands forces a flush on the channel and can be used to buffer ("pipeline") commands to achieve batching. No-op if channel is not connected.
        Specified by:
        flushCommands in interface RedisChannelWriter
      • disconnect

        public void disconnect()
        Disconnect the channel.
      • reset

        public void reset()
        Reset the writer state. Queued commands will be canceled and the internal state will be reset. This is useful when the internal state machine gets out of sync with the connection.
        Specified by:
        reset in interface RedisChannelWriter
      • initialState

        public void initialState()
        Reset the command-handler to the initial not-connected state.
        Specified by:
        initialState in interface Endpoint
      • notifyDrainQueuedCommands

        public void notifyDrainQueuedCommands​(io.lettuce.core.protocol.HasQueuedCommands queuedCommands)
        Description copied from interface: Endpoint
        Signal the endpoint to drain queued commands from the queue holder.
        Specified by:
        notifyDrainQueuedCommands in interface Endpoint
        Parameters:
        queuedCommands - the queue holder.
      • isClosed

        public boolean isClosed()
      • doExclusive

        protected <T> T doExclusive​(Supplier<T> supplier)
        Execute a Supplier callback guarded by an exclusive lock.
        Type Parameters:
        T -
        Parameters:
        supplier -
        Returns:
      • logPrefix

        protected String logPrefix()
      • getId

        public String getId()
        Specified by:
        getId in interface Endpoint
        Returns:
        the endpoint Id.