public final class FragmentationDuplexConnection extends Object implements DuplexConnection
DuplexConnection
implementation that fragments and reassembles Frame
s.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
Frame s received on this connection. |
Mono<Void> |
send(org.reactivestreams.Publisher<Frame> frames)
Sends the source of
Frame s on this connection and returns the Publisher
representing the result of this send. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
sendOne
public FragmentationDuplexConnection(DuplexConnection delegate, int maxFragmentSize)
delegate
- the DuplexConnection
to decoratemaxFragmentSize
- the maximum fragment sizeNullPointerException
- if delegate
is null
IllegalArgumentException
- if maxFragmentSize
is not positive
public 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 null
IllegalArgumentException
- if maxFragmentSize
is not positive
public double availability()
availability
in interface Availability
availability
in interface DuplexConnection
public void dispose()
dispose
in interface Disposable
public boolean isDisposed()
isDisposed
in interface Disposable
public Mono<Void> onClose()
Closeable
Publisher
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()
DuplexConnection
Frame
s 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 DuplexConnection
Frame
s received.public Mono<Void> send(org.reactivestreams.Publisher<Frame> frames)
DuplexConnection
Frame
s on this connection and returns the Publisher
representing the result of this send.
Publisher
mustsend
in interface DuplexConnection
frames
- Stream of Frame
s to send on the connection.Publisher
that completes when all the frames are written on the connection
successfully and errors when it fails.