public abstract class ReactorPeer<IN,OUT,CONN extends ChannelStream<IN,OUT>> extends Object
A Peer is network component with start and shutdown capabilities. On Start it will require a ReactorChannelHandler
to process the incoming ReactorChannel
, regardless of being a server or a client.
Modifier and Type | Field and Description |
---|---|
protected AtomicBoolean |
started |
Modifier | Constructor and Description |
---|---|
protected |
ReactorPeer(Environment defaultEnv,
Dispatcher defaultDispatcher,
Codec<Buffer,IN,OUT> codec) |
protected |
ReactorPeer(Environment defaultEnv,
Dispatcher defaultDispatcher,
Codec<Buffer,IN,OUT> codec,
long prefetch) |
Modifier and Type | Method and Description |
---|---|
protected abstract Promise<Void> |
doShutdown() |
protected abstract Promise<Void> |
doStart(ReactorChannelHandler<IN,OUT,CONN> handler) |
Codec<Buffer,IN,OUT> |
getDefaultCodec()
Get the
Codec in use. |
Dispatcher |
getDefaultDispatcher() |
Environment |
getDefaultEnvironment()
Get the default environment for all Channel
|
long |
getDefaultPrefetchSize()
Get the default batch read/write size
|
Promise<Void> |
shutdown()
Shutdown this Peer and complete the returned
Promise when shut
down. |
Promise<Void> |
start(ReactorChannelHandler<IN,OUT,CONN> handler)
Start this Peer.
|
protected final AtomicBoolean started
protected ReactorPeer(Environment defaultEnv, Dispatcher defaultDispatcher, Codec<Buffer,IN,OUT> codec)
protected ReactorPeer(Environment defaultEnv, Dispatcher defaultDispatcher, Codec<Buffer,IN,OUT> codec, long prefetch)
public final Promise<Void> start(ReactorChannelHandler<IN,OUT,CONN> handler)
Promise
that will be complete when the ReactorPeer
is startedpublic final Promise<Void> shutdown()
Promise
when shut
down.Promise
that will be complete when the ReactorPeer
is shutdownpublic final Dispatcher getDefaultDispatcher()
public final Codec<Buffer,IN,OUT> getDefaultCodec()
Codec
in use.public final Environment getDefaultEnvironment()
public final long getDefaultPrefetchSize()
Copyright © 2017. All rights reserved.