Package io.netty.channel.epoll
Class EpollDomainSocketChannel
- java.lang.Object
-
- io.netty.util.DefaultAttributeMap
-
- io.netty.channel.AbstractChannel
-
- io.netty.channel.epoll.AbstractEpollStreamChannel
-
- io.netty.channel.epoll.EpollDomainSocketChannel
-
- All Implemented Interfaces:
io.netty.channel.Channel,io.netty.channel.ChannelOutboundInvoker,io.netty.channel.socket.DuplexChannel,io.netty.channel.unix.DomainSocketChannel,io.netty.channel.unix.UnixChannel,io.netty.util.AttributeMap,Comparable<io.netty.channel.Channel>
public final class EpollDomainSocketChannel extends AbstractEpollStreamChannel implements io.netty.channel.unix.DomainSocketChannel
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class io.netty.channel.epoll.AbstractEpollStreamChannel
AbstractEpollStreamChannel.SpliceInTask
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanactiveprotected LinuxSocketsocket
-
Constructor Summary
Constructors Constructor Description EpollDomainSocketChannel()EpollDomainSocketChannel(int fd)EpollDomainSocketChannel(int fd, boolean active)EpollDomainSocketChannel(io.netty.channel.Channel parent, LinuxSocket fd)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static voidcheckResolvable(InetSocketAddress addr)EpollDomainSocketChannelConfigconfig()protected voiddoBeginRead()protected voiddoBind(SocketAddress localAddress)protected booleandoConnect(SocketAddress remoteAddress, SocketAddress localAddress)Connect to the remote peerprotected voiddoDeregister()protected voiddoDisconnect()protected intdoReadBytes(io.netty.buffer.ByteBuf byteBuf)Read bytes into the givenByteBufand return the amount.protected voiddoRegister(io.netty.channel.ChannelPromise promise)protected intdoWriteBytes(io.netty.channel.ChannelOutboundBuffer in, io.netty.buffer.ByteBuf buf)protected intdoWriteSingle(io.netty.channel.ChannelOutboundBuffer in)Attempt to write a single object.io.netty.channel.unix.FileDescriptorfd()protected ObjectfilterOutboundMessage(Object msg)booleanisActive()protected booleanisCompatible(io.netty.channel.EventLoop loop)booleanisOpen()io.netty.channel.unix.DomainSocketAddresslocalAddress()protected io.netty.channel.unix.DomainSocketAddresslocalAddress0()protected io.netty.buffer.ByteBufnewDirectBuffer(io.netty.buffer.ByteBuf buf)Returns an off-heap copy of the specifiedByteBuf, and releases the original one.protected io.netty.buffer.ByteBufnewDirectBuffer(Object holder, io.netty.buffer.ByteBuf buf)Returns an off-heap copy of the specifiedByteBuf, and releases the specified holder.protected io.netty.channel.epoll.AbstractEpollChannel.AbstractEpollUnsafenewUnsafe()io.netty.channel.unix.PeerCredentialspeerCredentials()Returns the unix credentials (uid, gid, pid) of the peer SO_PEERCREDprotected io.netty.channel.IoRegistrationregistration()io.netty.channel.unix.DomainSocketAddressremoteAddress()protected io.netty.channel.unix.DomainSocketAddressremoteAddress0()protected voidsetFlag(int flag)-
Methods inherited from class io.netty.channel.epoll.AbstractEpollStreamChannel
doClose, doShutdownOutput, doWrite, isInputShutdown, isOutputShutdown, isShutdown, metadata, shutdown, shutdown, shutdownInput, shutdownInput, shutdownOutput, shutdownOutput, spliceTo, spliceTo, spliceTo, spliceTo
-
Methods inherited from class io.netty.channel.AbstractChannel
closeFuture, compareTo, doRegister, equals, eventLoop, hashCode, id, invalidateLocalAddress, invalidateRemoteAddress, isRegistered, maxMessagesPerWrite, newChannelPipeline, newId, parent, pipeline, toString, unsafe, validateFileRegion, voidPromise
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface io.netty.channel.Channel
alloc, bind, bind, bytesBeforeUnwritable, bytesBeforeWritable, close, close, closeFuture, connect, connect, connect, connect, deregister, deregister, disconnect, disconnect, eventLoop, flush, getOption, id, isActive, isOpen, isRegistered, isWritable, metadata, newFailedFuture, newProgressivePromise, newPromise, newSucceededFuture, parent, pipeline, read, setOption, unsafe, voidPromise, write, write, writeAndFlush, writeAndFlush
-
Methods inherited from interface java.lang.Comparable
compareTo
-
-
-
-
Field Detail
-
socket
protected final LinuxSocket socket
-
active
protected volatile boolean active
-
-
Constructor Detail
-
EpollDomainSocketChannel
public EpollDomainSocketChannel()
-
EpollDomainSocketChannel
public EpollDomainSocketChannel(int fd)
-
EpollDomainSocketChannel
public EpollDomainSocketChannel(io.netty.channel.Channel parent, LinuxSocket fd)
-
EpollDomainSocketChannel
public EpollDomainSocketChannel(int fd, boolean active)
-
-
Method Detail
-
newUnsafe
protected io.netty.channel.epoll.AbstractEpollChannel.AbstractEpollUnsafe newUnsafe()
- Overrides:
newUnsafein classAbstractEpollStreamChannel
-
localAddress0
protected io.netty.channel.unix.DomainSocketAddress localAddress0()
-
remoteAddress0
protected io.netty.channel.unix.DomainSocketAddress remoteAddress0()
-
doBind
protected void doBind(SocketAddress localAddress) throws Exception
- Throws:
Exception
-
config
public EpollDomainSocketChannelConfig config()
- Specified by:
configin interfaceio.netty.channel.Channel- Specified by:
configin interfaceio.netty.channel.unix.DomainSocketChannel
-
doConnect
protected boolean doConnect(SocketAddress remoteAddress, SocketAddress localAddress) throws Exception
Connect to the remote peer- Throws:
Exception
-
remoteAddress
public io.netty.channel.unix.DomainSocketAddress remoteAddress()
- Specified by:
remoteAddressin interfaceio.netty.channel.Channel- Specified by:
remoteAddressin interfaceio.netty.channel.unix.DomainSocketChannel- Overrides:
remoteAddressin classio.netty.channel.AbstractChannel
-
localAddress
public io.netty.channel.unix.DomainSocketAddress localAddress()
- Specified by:
localAddressin interfaceio.netty.channel.Channel- Specified by:
localAddressin interfaceio.netty.channel.unix.DomainSocketChannel- Overrides:
localAddressin classio.netty.channel.AbstractChannel
-
doWriteSingle
protected int doWriteSingle(io.netty.channel.ChannelOutboundBuffer in) throws ExceptionDescription copied from class:AbstractEpollStreamChannelAttempt to write a single object.- Overrides:
doWriteSinglein classAbstractEpollStreamChannel- Parameters:
in- the collection which contains objects to write.- Returns:
- The value that should be decremented from the write quantum which starts at
ChannelConfig.getWriteSpinCount(). The typical use cases are as follows:- 0 - if no write was attempted. This is appropriate if an empty
ByteBuf(or other empty content) is encountered - 1 - if a single call to write data was made to the OS
ChannelUtils.WRITE_STATUS_SNDBUF_FULL- if an attempt to write data was made to the OS, but no data was accepted
- 0 - if no write was attempted. This is appropriate if an empty
- Throws:
Exception- If an I/O error occurs.
-
filterOutboundMessage
protected Object filterOutboundMessage(Object msg)
- Overrides:
filterOutboundMessagein classAbstractEpollStreamChannel
-
peerCredentials
public io.netty.channel.unix.PeerCredentials peerCredentials() throws IOExceptionReturns the unix credentials (uid, gid, pid) of the peer SO_PEERCRED- Throws:
IOException
-
setFlag
protected void setFlag(int flag) throws IOException- Throws:
IOException
-
registration
protected final io.netty.channel.IoRegistration registration()
-
fd
public final io.netty.channel.unix.FileDescriptor fd()
- Specified by:
fdin interfaceio.netty.channel.unix.UnixChannel
-
isActive
public boolean isActive()
- Specified by:
isActivein interfaceio.netty.channel.Channel
-
doDisconnect
protected void doDisconnect() throws Exception- Specified by:
doDisconnectin classio.netty.channel.AbstractChannel- Throws:
Exception
-
isOpen
public boolean isOpen()
- Specified by:
isOpenin interfaceio.netty.channel.Channel
-
doDeregister
protected void doDeregister() throws Exception- Overrides:
doDeregisterin classio.netty.channel.AbstractChannel- Throws:
Exception
-
isCompatible
protected boolean isCompatible(io.netty.channel.EventLoop loop)
- Specified by:
isCompatiblein classio.netty.channel.AbstractChannel
-
doBeginRead
protected void doBeginRead() throws Exception- Specified by:
doBeginReadin classio.netty.channel.AbstractChannel- Throws:
Exception
-
doRegister
protected void doRegister(io.netty.channel.ChannelPromise promise)
- Overrides:
doRegisterin classio.netty.channel.AbstractChannel
-
newDirectBuffer
protected final io.netty.buffer.ByteBuf newDirectBuffer(io.netty.buffer.ByteBuf buf)
Returns an off-heap copy of the specifiedByteBuf, and releases the original one.
-
newDirectBuffer
protected final io.netty.buffer.ByteBuf newDirectBuffer(Object holder, io.netty.buffer.ByteBuf buf)
Returns an off-heap copy of the specifiedByteBuf, and releases the specified holder. The caller must ensure that the holder releases the originalByteBufwhen the holder is released by this method.
-
checkResolvable
protected static void checkResolvable(InetSocketAddress addr)
-
doReadBytes
protected final int doReadBytes(io.netty.buffer.ByteBuf byteBuf) throws ExceptionRead bytes into the givenByteBufand return the amount.- Throws:
Exception
-
-