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.LogOutput
append
(com.fishlib.base.log.LogOutput logOutput) boolean
Mark this client as subscribing.void
Mark subscription as complete.Get the list of delayed commands and null out the internal list.io.deephaven.shadow.core.com.google.protobuf.ByteString
Create the list of delayed command if they do not already exist.long
io.deephaven.shadow.core.com.google.protobuf.ByteString
getUuid()
gnu.trove.set.TLongSet
boolean
isCookieValid
(io.deephaven.shadow.core.com.google.protobuf.ByteString cookie) boolean
Check if this client has subscribed and the subscription has not been cancelled.boolean
Check if subscription is already in progress.void
Safely complete the subscription.void
Safely end the subscription with an error.void
Send a command immediately on the observer.void
sendOrEnqueueCommand
(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.void
setCookie
(io.deephaven.shadow.core.com.google.protobuf.ByteString cookie) void
setObserver
(io.deephaven.shadow.core.io.grpc.stub.ServerCallStreamObserver<SubscribeResponse> responseObserver) Set the observer for the stream.void
setVisibleQueries
(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:
append
in 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.
-