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 Summary
Modifier and TypeMethodDescriptioncom.fishlib.base.log.LogOutputappend(com.fishlib.base.log.LogOutput logOutput) booleanMark this client as subscribing.voidMark subscription as complete.Get the list of delayed commands and null out the internal list.io.deephaven.shadow.core.com.google.protobuf.ByteStringCreate the list of delayed command if they do not already exist.longio.deephaven.shadow.core.com.google.protobuf.ByteStringgetUuid()gnu.trove.set.TLongSetbooleanisCookieValid(io.deephaven.shadow.core.com.google.protobuf.ByteString cookie) booleanCheck if this client has subscribed and the subscription has not been cancelled.booleanCheck if subscription is already in progress.voidSafely complete the subscription.voidSafely end the subscription with an error.voidSend a command immediately on the observer.voidsendOrEnqueueCommand(SubscribeResponse event, Runnable onSubscriptionLostError, Consumer<Throwable> onUnexpectedError) Send a command immediately if the client is fully subscribed, otherwise enqueue it to be sent when the subscription is complete.voidsetCookie(io.deephaven.shadow.core.com.google.protobuf.ByteString cookie) voidsetObserver(io.deephaven.shadow.core.io.grpc.stub.ServerCallStreamObserver<SubscribeResponse> responseObserver) Set the observer for the stream.voidsetVisibleQueries(gnu.trove.set.TLongSet visibleQueries) toString()void
-
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
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
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
-
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. -
sendCommandImmediate
Send a command immediately on the observer.- Parameters:
event- the event to send- Throws:
NotSubscribedException- if this client was not actually subscribedio.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:
appendin interfacecom.fishlib.base.log.LogOutputAppendable
-
toString
-
safelyCompleteSubscription
public void safelyCompleteSubscription()Safely complete the subscription. If the subscription was healthy, we will justStreamObserver.onCompleted()complete} it. Any exceptions that occur during this will be ignored. -
safelyEndStreamWithError
Safely end the subscription with an error. If the subscription was healthy, we will callStreamObserver.onError(Throwable)it. Any exceptions that occur during this will be ignored.- Parameters:
error- The error to end the stream with.
-