Package org.drasyl.channel
Class DrasylChannel
java.lang.Object
io.netty.util.DefaultAttributeMap
io.netty.channel.AbstractChannel
org.drasyl.channel.DrasylChannel
- All Implemented Interfaces:
io.netty.channel.Channel
,io.netty.channel.ChannelOutboundInvoker
,io.netty.util.AttributeMap
,Comparable<io.netty.channel.Channel>
,IdentityChannel
@UnstableApi
public class DrasylChannel
extends io.netty.channel.AbstractChannel
implements IdentityChannel
A virtual
Channel
for peer communication.
(Currently) only compatible with NioEventLoop
.
Inspired by LocalChannel
.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class io.netty.channel.AbstractChannel
io.netty.channel.AbstractChannel.AbstractUnsafe
Nested classes/interfaces inherited from interface io.netty.channel.Channel
io.netty.channel.Channel.Unsafe
-
Method Summary
Modifier and TypeMethodDescriptionio.netty.channel.ChannelConfig
config()
protected void
protected void
doBind
(SocketAddress localAddress) protected void
doClose()
protected void
protected void
protected void
doWrite
(io.netty.channel.ChannelOutboundBuffer in) protected Object
void
This method start processing (if any) queued inbound messages.identity()
boolean
isActive()
protected boolean
isCompatible
(io.netty.channel.EventLoop loop) boolean
Returnstrue
if remote peer is reachable via a direct path.boolean
isOpen()
protected SocketAddress
io.netty.channel.ChannelMetadata
metadata()
protected io.netty.channel.AbstractChannel.AbstractUnsafe
parent()
void
This method places the messageo
in the queue for inbound messages to be read by this channel.protected SocketAddress
Methods inherited from class io.netty.channel.AbstractChannel
alloc, bind, bind, bytesBeforeUnwritable, bytesBeforeWritable, close, close, closeFuture, compareTo, connect, connect, connect, connect, deregister, deregister, disconnect, disconnect, doDeregister, doShutdownOutput, equals, eventLoop, flush, hashCode, id, invalidateLocalAddress, invalidateRemoteAddress, isRegistered, isWritable, localAddress, maxMessagesPerWrite, newChannelPipeline, newFailedFuture, newId, newProgressivePromise, newPromise, newSucceededFuture, pipeline, read, remoteAddress, toString, unsafe, validateFileRegion, voidPromise, write, write, writeAndFlush, writeAndFlush
Methods inherited from class io.netty.util.DefaultAttributeMap
attr, hasAttr
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface io.netty.util.AttributeMap
attr, hasAttr
-
Method Details
-
newUnsafe
protected io.netty.channel.AbstractChannel.AbstractUnsafe newUnsafe()- Specified by:
newUnsafe
in classio.netty.channel.AbstractChannel
-
isCompatible
protected boolean isCompatible(io.netty.channel.EventLoop loop) - Specified by:
isCompatible
in classio.netty.channel.AbstractChannel
-
identity
- Specified by:
identity
in interfaceIdentityChannel
-
localAddress0
- Specified by:
localAddress0
in classio.netty.channel.AbstractChannel
-
remoteAddress0
- Specified by:
remoteAddress0
in classio.netty.channel.AbstractChannel
-
doRegister
protected void doRegister()- Overrides:
doRegister
in classio.netty.channel.AbstractChannel
-
doBind
- Specified by:
doBind
in classio.netty.channel.AbstractChannel
-
doDisconnect
protected void doDisconnect()- Specified by:
doDisconnect
in classio.netty.channel.AbstractChannel
-
doClose
protected void doClose()- Specified by:
doClose
in classio.netty.channel.AbstractChannel
-
doBeginRead
protected void doBeginRead()- Specified by:
doBeginRead
in classio.netty.channel.AbstractChannel
-
queueRead
This method places the messageo
in the queue for inbound messages to be read by this channel. Queued messages are not processed untilfinishRead()
is called. -
finishRead
public void finishRead()This method start processing (if any) queued inbound messages. This method ensures that read/write order is respected. Therefore, if channel is currently writing, these writes are performed first and the reads are performed afterwards. -
parent
- Specified by:
parent
in interfaceio.netty.channel.Channel
- Overrides:
parent
in classio.netty.channel.AbstractChannel
-
doWrite
- Specified by:
doWrite
in classio.netty.channel.AbstractChannel
- Throws:
Exception
-
filterOutboundMessage
- Overrides:
filterOutboundMessage
in classio.netty.channel.AbstractChannel
- Throws:
Exception
-
config
public io.netty.channel.ChannelConfig config()- Specified by:
config
in interfaceio.netty.channel.Channel
-
isOpen
public boolean isOpen()- Specified by:
isOpen
in interfaceio.netty.channel.Channel
-
isActive
public boolean isActive()- Specified by:
isActive
in interfaceio.netty.channel.Channel
-
metadata
public io.netty.channel.ChannelMetadata metadata()- Specified by:
metadata
in interfaceio.netty.channel.Channel
-
isDirectPathPresent
public boolean isDirectPathPresent()Returnstrue
if remote peer is reachable via a direct path.- Returns:
true
if remote peer is reachable via a direct path.
-