Class ClientStateManager.ClientState

java.lang.Object
com.illumon.iris.controller.service.ClientStateManager.ClientState
All Implemented Interfaces:
com.fishlib.base.log.LogOutputAppendable
Enclosing class:
ClientStateManager

public static final class ClientStateManager.ClientState extends Object implements com.fishlib.base.log.LogOutputAppendable
  • Method Details

    • updateRefreshDeadline

      public void updateRefreshDeadline()
    • getRefreshDeadline

      public long getRefreshDeadline()
    • getVisibleQueries

      @NotNull public gnu.trove.set.TLongSet getVisibleQueries()
    • setVisibleQueries

      public void setVisibleQueries(gnu.trove.set.TLongSet visibleQueries)
    • beginSubscription

      public boolean beginSubscription()
      Mark this client as subscribing. The caller is required to own the lock on this object.
      Returns:
      true if subscription was already in progress.
    • isSubscriptionInProgress

      public boolean isSubscriptionInProgress()
      Check if subscription is already in progress.
      Returns:
      true if subscription was already in progress.
    • finishSubscription

      public void finishSubscription()
      Mark subscription as complete. The caller is required to own the lock on the object.
    • getAndResetDelayedCommands

      @Nullable public List<SubscribeResponse> getAndResetDelayedCommands()
      Get the list of delayed commands and null out the internal list. The caller is required to own the lock on the object.
      Returns:
      the delayed commands, or null if there are none.
    • getOrCreateDelayedCommands

      @NotNull public List<SubscribeResponse> getOrCreateDelayedCommands()
      Create the list of delayed command if they do not already exist. The caller is required to own the lock on the object.
      Returns:
      the list for delayed commands.
    • isSubscribed

      public boolean isSubscribed()
      Check if this client has subscribed and the subscription has not been cancelled. No synchronization is required to call this method.
      Returns:
      true if the subscription is active.
    • setObserver

      public void setObserver(@NotNull io.deephaven.shadow.core.io.grpc.stub.ServerCallStreamObserver<SubscribeResponse> responseObserver)
      Set the observer for the stream. The obeserver may not be null.
      Parameters:
      responseObserver - the observer for the stream.
    • setCookie

      public void setCookie(io.deephaven.shadow.core.com.google.protobuf.ByteString cookie)
    • getCurrentCookie

      public io.deephaven.shadow.core.com.google.protobuf.ByteString getCurrentCookie()
    • getUuid

      public io.deephaven.shadow.core.com.google.protobuf.ByteString getUuid()
    • isCookieValid

      public boolean isCookieValid(io.deephaven.shadow.core.com.google.protobuf.ByteString cookie)
    • getUserContext

      public UserContext getUserContext()
    • getClientId

      public ClientId getClientId()
    • sendOrEnqueueCommand

      public void sendOrEnqueueCommand(@NotNull SubscribeResponse event, @NotNull Runnable onSubscriptionLostError, @NotNull Consumer<Throwable> onUnexpectedError)
      Send a command immediately if the client is fully subscribed, otherwise enqueue it to be sent when the subscription is complete. This method never throws exceptions.
      Parameters:
      event - the event to send
      onSubscriptionLostError - Runnable to call if the subscription has a problem
      onUnexpectedError - Consumer to call if there is some other unexpected error.
    • sendCommandImmediate

      public void sendCommandImmediate(@NotNull SubscribeResponse event)
      Send a command immediately on the observer.
      Parameters:
      event - the event to send
      Throws:
      NotSubscribedException - if this client was not actually subscribed
      io.deephaven.shadow.core.io.grpc.StatusRuntimeException - if something is wrong with the gRPC call.
    • append

      public com.fishlib.base.log.LogOutput append(com.fishlib.base.log.LogOutput logOutput)
      Specified by:
      append in interface com.fishlib.base.log.LogOutputAppendable
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • safelyCompleteSubscription

      public void safelyCompleteSubscription()
      Safely complete the subscription. If the subscription was healthy, we will just StreamObserver.onCompleted() complete} it. Any exceptions that occur during this will be ignored.
    • safelyEndStreamWithError

      public void safelyEndStreamWithError(@NotNull Throwable error)
      Safely end the subscription with an error. If the subscription was healthy, we will call StreamObserver.onError(Throwable) it. Any exceptions that occur during this will be ignored.
      Parameters:
      error - The error to end the stream with.