public final class ConnectionImpl<R,W> extends Connection<R,W>
Connection delegating all ChannelOperations methods to
DefaultChannelOperations.CONNECTION_ATTRIBUTE_KEY, markAwarePipelineFLUSH_ON_EACH_BYTES, FLUSH_ON_EACH_FILE_REGION, FLUSH_ON_EACH_STRING, FLUSH_ONLY_ON_READ_COMPLETE| Modifier and Type | Method and Description |
|---|---|
<RR,WW> Connection<RR,WW> |
addChannelHandlerAfter(io.netty.util.concurrent.EventExecutorGroup group,
java.lang.String baseName,
java.lang.String name,
io.netty.channel.ChannelHandler handler)
Adds a
ChannelHandler to ChannelPipeline for this connection. |
<RR,WW> Connection<RR,WW> |
addChannelHandlerAfter(java.lang.String baseName,
java.lang.String name,
io.netty.channel.ChannelHandler handler)
Adds a
ChannelHandler to ChannelPipeline for this connection. |
<RR,WW> Connection<RR,WW> |
addChannelHandlerBefore(io.netty.util.concurrent.EventExecutorGroup group,
java.lang.String baseName,
java.lang.String name,
io.netty.channel.ChannelHandler handler)
Adds a
ChannelHandler to ChannelPipeline for this connection. |
<RR,WW> Connection<RR,WW> |
addChannelHandlerBefore(java.lang.String baseName,
java.lang.String name,
io.netty.channel.ChannelHandler handler)
Adds a
ChannelHandler to ChannelPipeline for this connection. |
<RR,WW> Connection<RR,WW> |
addChannelHandlerFirst(io.netty.util.concurrent.EventExecutorGroup group,
java.lang.String name,
io.netty.channel.ChannelHandler handler)
Adds a
ChannelHandler to ChannelPipeline for this connection. |
<RR,WW> Connection<RR,WW> |
addChannelHandlerFirst(java.lang.String name,
io.netty.channel.ChannelHandler handler)
Adds a
ChannelHandler to ChannelPipeline for this connection. |
<RR,WW> Connection<RR,WW> |
addChannelHandlerLast(io.netty.util.concurrent.EventExecutorGroup group,
java.lang.String name,
io.netty.channel.ChannelHandler handler)
Adds a
ChannelHandler to ChannelPipeline for this connection. |
<RR,WW> Connection<RR,WW> |
addChannelHandlerLast(java.lang.String name,
io.netty.channel.ChannelHandler handler)
Adds a
ChannelHandler to ChannelPipeline for this connection. |
protected <RR,WW> Connection<RR,WW> |
cast() |
rx.Observable<java.lang.Void> |
close()
Flushes any pending writes and closes the connection.
|
rx.Observable<java.lang.Void> |
close(boolean flush)
Closes this channel after flushing all pending writes.
|
rx.Observable<java.lang.Void> |
closeListener()
Returns an
Observable that completes when this connection is closed. |
void |
closeNow()
Closes the connection immediately.
|
void |
flush()
Flushes any pending writes on this connection by calling
Channel.flush(). |
static <R,W> ConnectionImpl<R,W> |
fromChannel(io.netty.channel.Channel nettyChannel) |
<RR,WW> Connection<RR,WW> |
pipelineConfigurator(rx.functions.Action1<io.netty.channel.ChannelPipeline> pipelineConfigurator)
Configures the
ChannelPipeline for this channel, using the passed pipelineConfigurator. |
<RR> Connection<RR,W> |
transformRead(rx.Observable.Transformer<R,RR> transformer)
Transforms this connection's input stream using the passed
transformer to create a new
Connection instance. |
<WW> Connection<R,WW> |
transformWrite(AllocatingTransformer<WW,W> transformer)
Transforms this connection to enable writing a different object type.
|
rx.Observable<java.lang.Void> |
write(rx.Observable<W> msgs)
On subscription of the returned
Observable, writes the passed message stream on the underneath channel. |
rx.Observable<java.lang.Void> |
write(rx.Observable<W> msgs,
rx.functions.Func1<W,java.lang.Boolean> flushSelector)
On subscription of the returned
Observable, writes the passed message stream on the underneath channel
and flushes the channel, everytime, flushSelector returns true . |
rx.Observable<java.lang.Void> |
writeAndFlushOnEach(rx.Observable<W> msgs)
On subscription of the returned
Observable, writes the passed message stream on the underneath channel
and flushes the channel, on every write. |
rx.Observable<java.lang.Void> |
writeBytes(rx.Observable<byte[]> msgs)
On subscription of the returned
Observable, writes the passed message stream on the underneath channel. |
rx.Observable<java.lang.Void> |
writeBytes(rx.Observable<byte[]> msgs,
rx.functions.Func1<byte[],java.lang.Boolean> flushSelector)
On subscription of the returned
Observable, writes the passed message stream on the underneath channel
and flushes the channel, everytime, flushSelector returns true . |
rx.Observable<java.lang.Void> |
writeBytesAndFlushOnEach(rx.Observable<byte[]> msgs)
On subscription of the returned
Observable, writes the passed message stream on the underneath channel
and flushes the channel, on every write. |
rx.Observable<java.lang.Void> |
writeFileRegion(rx.Observable<io.netty.channel.FileRegion> msgs)
On subscription of the returned
Observable, writes the passed message stream on the underneath channel. |
rx.Observable<java.lang.Void> |
writeFileRegion(rx.Observable<io.netty.channel.FileRegion> msgs,
rx.functions.Func1<io.netty.channel.FileRegion,java.lang.Boolean> flushSelector)
On subscription of the returned
Observable, writes the passed message stream on the underneath channel
and flushes the channel, everytime, flushSelector returns true . |
rx.Observable<java.lang.Void> |
writeFileRegionAndFlushOnEach(rx.Observable<io.netty.channel.FileRegion> msgs)
On subscription of the returned
Observable, writes the passed message stream on the underneath channel
and flushes the channel, on every write. |
rx.Observable<java.lang.Void> |
writeString(rx.Observable<java.lang.String> msgs)
On subscription of the returned
Observable, writes the passed message stream on the underneath channel. |
rx.Observable<java.lang.Void> |
writeString(rx.Observable<java.lang.String> msgs,
rx.functions.Func1<java.lang.String,java.lang.Boolean> flushSelector)
On subscription of the returned
Observable, writes the passed message stream on the underneath channel
and flushes the channel, everytime, flushSelector returns true . |
rx.Observable<java.lang.Void> |
writeStringAndFlushOnEach(rx.Observable<java.lang.String> msgs)
On subscription of the returned
Observable, writes the passed message stream on the underneath channel
and flushes the channel, on every write. |
connectCloseToChannelClose, getChannelPipeline, getInput, getResettableChannelPipeline, ignoreInput, unsafeNettyChannelpublic rx.Observable<java.lang.Void> write(rx.Observable<W> msgs)
ChannelOperationsObservable, writes the passed message stream on the underneath channel.
Observablemsgs - Stream of messages to write.Observable representing the result of this write. Every subscription to this Observable
will replay the write on the channel.public rx.Observable<java.lang.Void> write(rx.Observable<W> msgs, rx.functions.Func1<W,java.lang.Boolean> flushSelector)
ChannelOperationsObservable, writes the passed message stream on the underneath channel
and flushes the channel, everytime, flushSelector returns true . Any writes issued before
subscribing, will also be flushed. However, the returned Observable will not capture the result of those
writes, i.e. if the other writes, fail and this write does not, the returned Observable will not fail.msgs - Message stream to write.flushSelector - A Func1 which is invoked for every item emitted from msgs. Channel is
flushed, iff this function returns, true.Observable representing the result of this write. Every
subscription to this Observable will write the passed messages and flush all pending writes, when the
flushSelector returns truepublic rx.Observable<java.lang.Void> writeAndFlushOnEach(rx.Observable<W> msgs)
ChannelOperationsObservable, writes the passed message stream on the underneath channel
and flushes the channel, on every write. Any writes issued before subscribing, will also be flushed. However, the
returned Observable will not capture the result of those writes, i.e. if the other writes, fail and this
write does not, the returned Observable will not fail.msgs - Message stream to write.Observable representing the result of this write. Every
subscription to this Observable will write the passed messages and flush all pending writes, on every
write.public rx.Observable<java.lang.Void> writeString(rx.Observable<java.lang.String> msgs)
ChannelOperationsObservable, writes the passed message stream on the underneath channel.
Observablemsgs - Stream of messages to write.Observable representing the result of this write. Every subscription to this Observable
will replay the write on the channel.public rx.Observable<java.lang.Void> writeString(rx.Observable<java.lang.String> msgs,
rx.functions.Func1<java.lang.String,java.lang.Boolean> flushSelector)
ChannelOperationsObservable, writes the passed message stream on the underneath channel
and flushes the channel, everytime, flushSelector returns true . Any writes issued before
subscribing, will also be flushed. However, the returned Observable will not capture the result of those
writes, i.e. if the other writes, fail and this write does not, the returned Observable will not fail.msgs - Message stream to write.flushSelector - A Func1 which is invoked for every item emitted from msgs. Channel is
flushed, iff this function returns, true.Observable representing the result of this write. Every
subscription to this Observable will write the passed messages and flush all pending writes, when the
flushSelector returns truepublic rx.Observable<java.lang.Void> writeStringAndFlushOnEach(rx.Observable<java.lang.String> msgs)
ChannelOperationsObservable, writes the passed message stream on the underneath channel
and flushes the channel, on every write. Any writes issued before subscribing, will also be flushed. However, the
returned Observable will not capture the result of those writes, i.e. if the other writes, fail and this
write does not, the returned Observable will not fail.msgs - Message stream to write.Observable representing the result of this write. Every
subscription to this Observable will write the passed messages and flush all pending writes, on every
write.public rx.Observable<java.lang.Void> writeBytes(rx.Observable<byte[]> msgs)
ChannelOperationsObservable, writes the passed message stream on the underneath channel.
Observablemsgs - Stream of messages to write.Observable representing the result of this write. Every subscription to this Observable
will replay the write on the channel.public rx.Observable<java.lang.Void> writeBytes(rx.Observable<byte[]> msgs,
rx.functions.Func1<byte[],java.lang.Boolean> flushSelector)
ChannelOperationsObservable, writes the passed message stream on the underneath channel
and flushes the channel, everytime, flushSelector returns true . Any writes issued before
subscribing, will also be flushed. However, the returned Observable will not capture the result of those
writes, i.e. if the other writes, fail and this write does not, the returned Observable will not fail.msgs - Message stream to write.flushSelector - A Func1 which is invoked for every item emitted from msgs. Channel is
flushed, iff this function returns, true.Observable representing the result of this write. Every
subscription to this Observable will write the passed messages and flush all pending writes, when the
flushSelector returns truepublic rx.Observable<java.lang.Void> writeBytesAndFlushOnEach(rx.Observable<byte[]> msgs)
ChannelOperationsObservable, writes the passed message stream on the underneath channel
and flushes the channel, on every write. Any writes issued before subscribing, will also be flushed. However, the
returned Observable will not capture the result of those writes, i.e. if the other writes, fail and this
write does not, the returned Observable will not fail.msgs - Message stream to write.Observable representing the result of this write. Every
subscription to this Observable will write the passed messages and flush all pending writes, on every
write.public rx.Observable<java.lang.Void> writeFileRegion(rx.Observable<io.netty.channel.FileRegion> msgs)
ChannelOperationsObservable, writes the passed message stream on the underneath channel.
Observablemsgs - Stream of messages to write.Observable representing the result of this write. Every subscription to this Observable
will replay the write on the channel.public rx.Observable<java.lang.Void> writeFileRegion(rx.Observable<io.netty.channel.FileRegion> msgs,
rx.functions.Func1<io.netty.channel.FileRegion,java.lang.Boolean> flushSelector)
ChannelOperationsObservable, writes the passed message stream on the underneath channel
and flushes the channel, everytime, flushSelector returns true . Any writes issued before
subscribing, will also be flushed. However, the returned Observable will not capture the result of those
writes, i.e. if the other writes, fail and this write does not, the returned Observable will not fail.msgs - Message stream to write.flushSelector - A Func1 which is invoked for every item emitted from msgs. Channel is
flushed, iff this function returns, true.Observable representing the result of this write. Every
subscription to this Observable will write the passed messages and flush all pending writes, when the
flushSelector returns truepublic rx.Observable<java.lang.Void> writeFileRegionAndFlushOnEach(rx.Observable<io.netty.channel.FileRegion> msgs)
ChannelOperationsObservable, writes the passed message stream on the underneath channel
and flushes the channel, on every write. Any writes issued before subscribing, will also be flushed. However, the
returned Observable will not capture the result of those writes, i.e. if the other writes, fail and this
write does not, the returned Observable will not fail.msgs - Message stream to write.Observable representing the result of this write. Every
subscription to this Observable will write the passed messages and flush all pending writes, on every
write.public void flush()
ChannelOperationsChannel.flush(). This can be used for
implementing any custom flusing strategies that otherwise can not be implemented by methods like
ChannelOperations.write(Observable, Func1).public rx.Observable<java.lang.Void> close()
ChannelOperationsclose(true)Observable representing the result of close.public rx.Observable<java.lang.Void> close(boolean flush)
ChannelOperationsObservable representing the result of close and flush.public void closeNow()
ChannelOperationsChannelOperations.close() and subscribing to the returned
Observablepublic rx.Observable<java.lang.Void> closeListener()
ChannelOperationsObservable that completes when this connection is closed.Observable that completes when this connection is closed.public static <R,W> ConnectionImpl<R,W> fromChannel(io.netty.channel.Channel nettyChannel)
public <RR,WW> Connection<RR,WW> addChannelHandlerFirst(java.lang.String name, io.netty.channel.ChannelHandler handler)
ConnectionChannelHandler to ChannelPipeline for this connection. The specified handler is added at
the first position of the pipeline as specified by ChannelPipeline.addFirst(String, ChannelHandler)
For better flexibility of pipeline modification, the method Connection.pipelineConfigurator(Action1) will be
more convenient.addChannelHandlerFirst in class Connection<R,W>name - Name of the handler.handler - Handler instance to add.this.public <RR,WW> Connection<RR,WW> addChannelHandlerFirst(io.netty.util.concurrent.EventExecutorGroup group, java.lang.String name, io.netty.channel.ChannelHandler handler)
ConnectionChannelHandler to ChannelPipeline for this connection. The specified handler is added at
the first position of the pipeline as specified by
ChannelPipeline.addFirst(EventExecutorGroup, String, ChannelHandler)
For better flexibility of pipeline modification, the method Connection.pipelineConfigurator(Action1) will be
more convenient.addChannelHandlerFirst in class Connection<R,W>group - the EventExecutorGroup which will be used to execute the ChannelHandler methodsname - the name of the handler to appendhandler - Handler instance to add.this.public <RR,WW> Connection<RR,WW> addChannelHandlerLast(java.lang.String name, io.netty.channel.ChannelHandler handler)
ConnectionChannelHandler to ChannelPipeline for this connection. The specified handler is added at
the last position of the pipeline as specified by ChannelPipeline.addLast(String, ChannelHandler)
For better flexibility of pipeline modification, the method Connection.pipelineConfigurator(Action1) will be
more convenient.addChannelHandlerLast in class Connection<R,W>name - Name of the handler.handler - Handler instance to add.this.public <RR,WW> Connection<RR,WW> addChannelHandlerLast(io.netty.util.concurrent.EventExecutorGroup group, java.lang.String name, io.netty.channel.ChannelHandler handler)
ConnectionChannelHandler to ChannelPipeline for this connection. The specified handler is added at
the last position of the pipeline as specified by
ChannelPipeline.addLast(EventExecutorGroup, String, ChannelHandler)
For better flexibility of pipeline modification, the method Connection.pipelineConfigurator(Action1) will be
more convenient.addChannelHandlerLast in class Connection<R,W>group - the EventExecutorGroup which will be used to execute the ChannelHandler methodsname - the name of the handler to appendhandler - Handler instance to add.this.public <RR,WW> Connection<RR,WW> addChannelHandlerBefore(java.lang.String baseName, java.lang.String name, io.netty.channel.ChannelHandler handler)
ConnectionChannelHandler to ChannelPipeline for this connection. The specified
handler is added before an existing handler with the passed baseName in the pipeline as specified by
ChannelPipeline.addBefore(String, String, ChannelHandler)
For better flexibility of pipeline modification, the method Connection.pipelineConfigurator(Action1) will be
more convenient.addChannelHandlerBefore in class Connection<R,W>baseName - the name of the existing handlername - Name of the handler.handler - Handler instance to add.this.public <RR,WW> Connection<RR,WW> addChannelHandlerBefore(io.netty.util.concurrent.EventExecutorGroup group, java.lang.String baseName, java.lang.String name, io.netty.channel.ChannelHandler handler)
ConnectionChannelHandler to ChannelPipeline for this connection. The specified
handler is added before an existing handler with the passed baseName in the pipeline as specified by
ChannelPipeline.addBefore(EventExecutorGroup, String, String, ChannelHandler)
For better flexibility of pipeline modification, the method Connection.pipelineConfigurator(Action1) will be
more convenient.addChannelHandlerBefore in class Connection<R,W>group - the EventExecutorGroup which will be used to execute the ChannelHandler
methodsbaseName - the name of the existing handlername - the name of the handler to appendhandler - Handler instance to add.this.public <RR,WW> Connection<RR,WW> addChannelHandlerAfter(java.lang.String baseName, java.lang.String name, io.netty.channel.ChannelHandler handler)
ConnectionChannelHandler to ChannelPipeline for this connection. The specified
handler is added after an existing handler with the passed baseName in the pipeline as specified by
ChannelPipeline.addAfter(String, String, ChannelHandler)
For better flexibility of pipeline modification, the method Connection.pipelineConfigurator(Action1) will be
more convenient.addChannelHandlerAfter in class Connection<R,W>baseName - the name of the existing handlername - Name of the handler.handler - Handler instance to add.this.public <RR,WW> Connection<RR,WW> addChannelHandlerAfter(io.netty.util.concurrent.EventExecutorGroup group, java.lang.String baseName, java.lang.String name, io.netty.channel.ChannelHandler handler)
ConnectionChannelHandler to ChannelPipeline for this connection. The specified
handler is added after an existing handler with the passed baseName in the pipeline as specified by
ChannelPipeline.addAfter(EventExecutorGroup, String, String, ChannelHandler)
For better flexibility of pipeline modification, the method Connection.pipelineConfigurator(Action1) will be
more convenient.addChannelHandlerAfter in class Connection<R,W>group - the EventExecutorGroup which will be used to execute the ChannelHandler methodsbaseName - the name of the existing handlername - the name of the handler to appendhandler - Handler instance to add.this.public <RR,WW> Connection<RR,WW> pipelineConfigurator(rx.functions.Action1<io.netty.channel.ChannelPipeline> pipelineConfigurator)
ConnectionChannelPipeline for this channel, using the passed pipelineConfigurator.pipelineConfigurator in class Connection<R,W>pipelineConfigurator - Action to configure ChannelPipeline.this.public <RR> Connection<RR,W> transformRead(rx.Observable.Transformer<R,RR> transformer)
Connectiontransformer to create a new
Connection instance.transformRead in class Connection<R,W>RR - New type of the input stream.transformer - Transformer to transform the input stream.public <WW> Connection<R,WW> transformWrite(AllocatingTransformer<WW,W> transformer)
ConnectiontransformWrite in interface ChannelOperations<W>transformWrite in class Connection<R,W>WW - New object types to be written to the connection.transformer - Transformer to transform objects written to the channel.protected <RR,WW> Connection<RR,WW> cast()