public final class FragmentationDuplexConnection extends Object implements DuplexConnection
DuplexConnection implementation that fragments and reassembles Frames.Disposable.Composite, Disposable.Swap| Constructor and Description |
|---|
FragmentationDuplexConnection(ByteBufAllocator byteBufAllocator,
DuplexConnection delegate,
int maxFragmentSize)
Creates a new instance.
|
FragmentationDuplexConnection(DuplexConnection delegate,
int maxFragmentSize)
Creates a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
double |
availability() |
void |
dispose() |
boolean |
isDisposed() |
Mono<Void> |
onClose()
Returns a
Publisher that completes when this RSocket is closed. |
Flux<Frame> |
receive()
Returns a stream of all
Frames received on this connection. |
Mono<Void> |
send(org.reactivestreams.Publisher<Frame> frames)
Sends the source of
Frames on this connection and returns the Publisher
representing the result of this send. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitsendOnepublic FragmentationDuplexConnection(DuplexConnection delegate, int maxFragmentSize)
delegate - the DuplexConnection to decoratemaxFragmentSize - the maximum fragment sizeNullPointerException - if delegate is nullIllegalArgumentException - if maxFragmentSize is not positivepublic FragmentationDuplexConnection(ByteBufAllocator byteBufAllocator, DuplexConnection delegate, int maxFragmentSize)
byteBufAllocator - the ByteBufAllocator to usedelegate - the DuplexConnection to decoratemaxFragmentSize - the maximum fragment size. A value of 0 indicates that frames should not
be fragmented.NullPointerException - if byteBufAllocator or delegate are nullIllegalArgumentException - if maxFragmentSize is not positivepublic double availability()
availability in interface Availabilityavailability in interface DuplexConnectionpublic void dispose()
dispose in interface Disposablepublic boolean isDisposed()
isDisposed in interface Disposablepublic Mono<Void> onClose()
CloseablePublisher that completes when this RSocket is closed. A RSocket can be closed by explicitly calling Disposable.dispose() or when the underlying
transport connection is closed.public Flux<Frame> receive()
DuplexConnectionFrames received on this connection.
Publisher MUST never emit a completion event (Subscriber.onComplete().
Publisher can error with various transport errors. If the underlying physical
connection is closed by the peer, then the returned stream from here MUST emit an
ClosedChannelException.
Publisher is not required to support multiple concurrent subscriptions.
RSocket will never have multiple subscriptions to this source. Implementations MUST
emit an IllegalStateException for subsequent concurrent subscriptions, if they do not
support multiple concurrent subscriptions.receive in interface DuplexConnectionFrames received.public Mono<Void> send(org.reactivestreams.Publisher<Frame> frames)
DuplexConnectionFrames on this connection and returns the Publisher
representing the result of this send.
Publisher mustsend in interface DuplexConnectionframes - Stream of Frames to send on the connection.Publisher that completes when all the frames are written on the connection
successfully and errors when it fails.