Top Fields Constructors Methods
io.rsocket.resume

public Class ServerRSocketSession

extends Object
implements RSocketSession, ResumeStateHolder, CoreSubscriber<Long>
Class Inheritance
All Implemented Interfaces
reactor.core.CoreSubscriber, org.reactivestreams.Subscriber, io.rsocket.resume.ResumeStateHolder, io.rsocket.resume.RSocketSession, reactor.core.Disposable
Imports
io.netty.buffer.ByteBuf, .ByteBufAllocator, io.netty.util.CharsetUtil, io.rsocket.DuplexConnection, io.rsocket.exceptions.ConnectionErrorException, .RejectedResumeException, io.rsocket.frame.ResumeFrameCodec, .ResumeOkFrameCodec, io.rsocket.keepalive.KeepAliveSupport, java.time.Duration, java.util.Queue, java.util.concurrent.atomic.AtomicIntegerFieldUpdater, .AtomicReferenceFieldUpdater, org.reactivestreams.Subscription, org.slf4j.Logger, .LoggerFactory, reactor.core.CoreSubscriber, reactor.core.publisher.Mono, .Operators, reactor.util.concurrent.Queues

Field Summary

Modifier and TypeField and Description
pack-priv final ByteBufAllocator
pack-priv final boolean
pack-priv final Queue<Runnable>
connectionsQueue

All incoming connections with the Resume intent are enqueued in this queue.

pack-priv KeepAliveSupport
private static final Logger
pack-priv final ResumableDuplexConnection
pack-priv final ResumableFramesStore
pack-priv final Duration
pack-priv volatile Subscription
s

pack-priv static final AtomicReferenceFieldUpdater<ServerRSocketSession, Subscription>
S

pack-priv final String
pack-priv volatile int
pack-priv static final AtomicIntegerFieldUpdater<ServerRSocketSession>

Constructor Summary

AccessConstructor and Description
public
ServerRSocketSession(ByteBuf session, ResumableDuplexConnection resumableDuplexConnection, DuplexConnection initialDuplexConnection, ResumableFramesStore resumableFramesStore, Duration resumeSessionDuration, boolean cleanupStoreOnKeepAlive)

Method Summary

Modifier and TypeMethod and Description
public void
dispose()

Implements reactor.core.Disposable.dispose.

Cancel or dispose the underlying task or resource.
pack-priv void
doResume(long remotePos, long remoteImpliedPos, DuplexConnection nextDuplexConnection)

public long
public boolean
isDisposed()

Overrides default reactor.core.Disposable.isDisposed.

Optionally return true when the resource or task is disposed.
public void
onComplete()

Implements org.reactivestreams.Subscriber.onComplete.

Successful terminal state.
public void
onError(Throwable
the throwable signaled
t
)

Implements org.reactivestreams.Subscriber.onError.

Failed terminal state.
public void
public void
onNext(Long
the element signaled
aLong
)

Implements org.reactivestreams.Subscriber.onNext.

Data notification sent by the Publisher in response to requests to Subscription#request(long).
public void
onSubscribe(Subscription
the Subscription that allows requesting data via Subscription#request(long)
s
)

Implements reactor.core.CoreSubscriber.onSubscribe.

Implementors should initialize any state used by onNext(Object) before calling Subscription#request(long).
public void
resumeWith(ByteBuf resumeFrame, DuplexConnection nextDuplexConnection)

public void
pack-priv boolean
pack-priv void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

allocatorback to summary
pack-priv final ByteBufAllocator allocator
cleanupStoreOnKeepAliveback to summary
pack-priv final boolean cleanupStoreOnKeepAlive
connectionsQueueback to summary
pack-priv final Queue<Runnable> connectionsQueue

All incoming connections with the Resume intent are enqueued in this queue. Such an approach ensure that the new connection will affect the resumption state anyhow until the previous (active) connection is finally closed

keepAliveSupportback to summary
pack-priv KeepAliveSupport keepAliveSupport
loggerback to summary
private static final Logger logger
resumableConnectionback to summary
pack-priv final ResumableDuplexConnection resumableConnection
resumableFramesStoreback to summary
pack-priv final ResumableFramesStore resumableFramesStore
resumeSessionDurationback to summary
pack-priv final Duration resumeSessionDuration
sback to summary
pack-priv volatile Subscription s
Sback to summary
pack-priv static final AtomicReferenceFieldUpdater<ServerRSocketSession, Subscription> S
sessionback to summary
pack-priv final String session
wipback to summary
pack-priv volatile int wip
WIPback to summary
pack-priv static final AtomicIntegerFieldUpdater<ServerRSocketSession> WIP

Constructor Detail

ServerRSocketSessionback to summary
public ServerRSocketSession(ByteBuf session, ResumableDuplexConnection resumableDuplexConnection, DuplexConnection initialDuplexConnection, ResumableFramesStore resumableFramesStore, Duration resumeSessionDuration, boolean cleanupStoreOnKeepAlive)

Method Detail

disposeback to summary
public void dispose()

Implements reactor.core.Disposable.dispose.

Doc from reactor.core.Disposable.dispose.

Cancel or dispose the underlying task or resource.

Implementations are required to make this method idempotent.

Annotations
@Override
doResumeback to summary
pack-priv void doResume(long remotePos, long remoteImpliedPos, DuplexConnection nextDuplexConnection)
impliedPositionback to summary
public long impliedPosition()

Implements io.rsocket.resume.ResumeStateHolder.impliedPosition.

Annotations
@Override
isDisposedback to summary
public boolean isDisposed()

Overrides default reactor.core.Disposable.isDisposed.

Doc from reactor.core.Disposable.isDisposed.

Optionally return true when the resource or task is disposed.

Implementations are not required to track disposition and as such may never return true even when disposed. However, they MUST only return true when there's a guarantee the resource or task is disposed.

Returns:boolean

true when there's a guarantee the resource or task is disposed.

Annotations
@Override
onCompleteback to summary
public void onComplete()

Implements org.reactivestreams.Subscriber.onComplete.

Doc from org.reactivestreams.Subscriber.onComplete.

Successful terminal state.

No further events will be sent even if Subscription#request(long) is invoked again.

Annotations
@Override
onErrorback to summary
public void onError(Throwable t)

Implements org.reactivestreams.Subscriber.onError.

Doc from org.reactivestreams.Subscriber.onError.

Failed terminal state.

No further events will be sent even if Subscription#request(long) is invoked again.

Parameters
t:Throwable

the throwable signaled

Annotations
@Override
onImpliedPositionback to summary
public void onImpliedPosition(long remoteImpliedPos)

Implements io.rsocket.resume.ResumeStateHolder.onImpliedPosition.

Annotations
@Override
onNextback to summary
public void onNext(Long aLong)

Implements org.reactivestreams.Subscriber.onNext.

Doc from org.reactivestreams.Subscriber.onNext.

Data notification sent by the Publisher in response to requests to Subscription#request(long).

Parameters
aLong:Long

the element signaled

Annotations
@Override
onSubscribeback to summary
public void onSubscribe(Subscription s)

Implements reactor.core.CoreSubscriber.onSubscribe.

Doc from reactor.core.CoreSubscriber.onSubscribe.

Implementors should initialize any state used by onNext(Object) before calling Subscription#request(long). Should further onNext related state modification occur, thread-safety will be required.

Note that an invalid request <= 0 will not produce an onError and will simply be ignored or reported through a debug-enabled reactor.util.Logger. Invoked after calling Publisher#subscribe(Subscriber).

No data will start flowing until Subscription#request(long) is invoked.

It is the responsibility of this Subscriber instance to call Subscription#request(long) whenever more data is wanted.

The Publisher will send notifications only in response to Subscription#request(long).

Parameters
s:Subscription

Doc from org.reactivestreams.Subscriber.onSubscribe.

the Subscription that allows requesting data via Subscription#request(long)

Annotations
@Override
resumeWithback to summary
public void resumeWith(ByteBuf resumeFrame, DuplexConnection nextDuplexConnection)
setKeepAliveSupportback to summary
public void setKeepAliveSupport(KeepAliveSupport keepAliveSupport)

Implements io.rsocket.resume.RSocketSession.setKeepAliveSupport.

tryCancelSessionTimeoutback to summary
pack-priv boolean tryCancelSessionTimeout()
tryTimeoutSessionback to summary
pack-priv void tryTimeoutSession()