public abstract class AbstractNetPeer<IN,OUT>
extends java.lang.Object
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractNetPeer(reactor.core.Environment env,
reactor.core.Reactor reactor,
reactor.io.encoding.Codec<reactor.io.Buffer,IN,OUT> codec,
java.util.Collection<reactor.function.Consumer<NetChannel<IN,OUT>>> consumers) |
| Modifier and Type | Method and Description |
|---|---|
reactor.core.composable.Promise<java.lang.Boolean> |
close() |
protected <C> void |
close(C channel)
Close the given channel.
|
void |
close(reactor.function.Consumer<java.lang.Boolean> onClose) |
protected abstract <C> NetChannel<IN,OUT> |
createChannel(C ioChannel)
Subclasses should implement this method and provide a
NetChannel object. |
protected void |
doClose(reactor.function.Consumer<java.lang.Boolean> onClose)
Subclasses should implement this method to perform the actual IO channel close.
|
protected void |
doCloseChannel(NetChannel<IN,OUT> channel)
Close the given channel.
|
protected reactor.event.registry.Registry<NetChannel<IN,OUT>> |
getChannels() |
protected reactor.io.encoding.Codec<reactor.io.Buffer,IN,OUT> |
getCodec()
Get the
Codec in use. |
protected java.util.Collection<reactor.function.Consumer<NetChannel<IN,OUT>>> |
getConsumers() |
protected reactor.core.Environment |
getEnvironment() |
protected reactor.core.Reactor |
getReactor() |
java.util.Iterator<NetChannel<IN,OUT>> |
iterator() |
protected void |
notifyClose(NetChannel<IN,OUT> channel)
Notify this peer's consumers that the given channel has been closed.
|
protected void |
notifyError(java.lang.Throwable error)
Notify this client's consumers than a global error has occurred.
|
protected void |
notifyOpen(NetChannel<IN,OUT> channel)
Notify this peer's consumers that the channel has been opened.
|
protected void |
notifyShutdown()
Notify this server's consumers that the server has stopped.
|
protected void |
notifyStart(java.lang.Runnable started)
Notify this server's consumers that the server has started.
|
protected <C> reactor.event.registry.Registration<? extends NetChannel<IN,OUT>> |
register(C ioChannel,
NetChannel<IN,OUT> netChannel)
Subclasses should register the given
NetChannel for later use. |
protected <C> NetChannel<IN,OUT> |
select(C ioChannel)
Find the
NetChannel for the given IO channel object. |
protected AbstractNetPeer(@Nonnull
reactor.core.Environment env,
@Nonnull
reactor.core.Reactor reactor,
@Nullable
reactor.io.encoding.Codec<reactor.io.Buffer,IN,OUT> codec,
@Nonnull
java.util.Collection<reactor.function.Consumer<NetChannel<IN,OUT>>> consumers)
public reactor.core.composable.Promise<java.lang.Boolean> close()
public void close(@Nullable
reactor.function.Consumer<java.lang.Boolean> onClose)
public java.util.Iterator<NetChannel<IN,OUT>> iterator()
protected <C> reactor.event.registry.Registration<? extends NetChannel<IN,OUT>> register(@Nonnull C ioChannel, @Nonnull NetChannel<IN,OUT> netChannel)
NetChannel for later use.C - The type of the channel object.ioChannel - The channel object.netChannel - The NetChannel.Registration of this channel in the Registry.protected <C> NetChannel<IN,OUT> select(@Nonnull C ioChannel)
NetChannel for the given IO channel object.C - The type of the channel object.ioChannel - The channel object.NetChannel associated with the given channel.protected <C> void close(@Nonnull
C channel)
C - The type of the channel object.channel - The channel object.protected abstract <C> NetChannel<IN,OUT> createChannel(C ioChannel)
NetChannel object.C - The type of the channel object.ioChannel - The IO channel object to associate with this NetChannel.NetChannel object.protected void notifyStart(java.lang.Runnable started)
protected void notifyError(@Nonnull
java.lang.Throwable error)
error - The error to notify.protected void notifyOpen(@Nonnull
NetChannel<IN,OUT> channel)
channel - The channel that was opened.protected void notifyClose(@Nonnull
NetChannel<IN,OUT> channel)
channel - The channel that was closed.protected void notifyShutdown()
@Nullable protected reactor.io.encoding.Codec<reactor.io.Buffer,IN,OUT> getCodec()
Codec in use.@Nonnull protected reactor.core.Environment getEnvironment()
@Nonnull protected reactor.core.Reactor getReactor()
@Nonnull protected java.util.Collection<reactor.function.Consumer<NetChannel<IN,OUT>>> getConsumers()
@Nonnull protected reactor.event.registry.Registry<NetChannel<IN,OUT>> getChannels()
protected void doClose(@Nullable
reactor.function.Consumer<java.lang.Boolean> onClose)
onClose - protected void doCloseChannel(NetChannel<IN,OUT> channel)
channel -