public abstract class AbstractChannel extends Object implements Channel
Channel implementation. This class is a pure implementation
detail, the fact that it exposes some functionality like access to the socket
channel is because the current Channel implementations need the SocketChannel.| Modifier and Type | Field and Description |
|---|---|
protected SocketChannel |
socketChannel |
| Constructor and Description |
|---|
AbstractChannel(SocketChannel socketChannel,
boolean clientMode) |
| Modifier and Type | Method and Description |
|---|---|
void |
addCloseListener(ChannelCloseListener listener)
Adds a ChannelCloseListener.
|
ConcurrentMap |
attributeMap()
Returns the attribute map.
|
void |
close()
Closes the Channel.
|
void |
closeInbound()
Closes inbound.
|
void |
closeOutbound()
Closes outbound.
|
boolean |
isClientMode()
Checks if this side is the Channel is in client mode or server mode.
|
boolean |
isClosed()
Checks if this Channel is closed.
|
SocketAddress |
localSocketAddress() |
protected void |
onClose()
Template method that is called when the socket channel closed.
|
int |
read(ByteBuffer dst)
This method will be removed from the Channel in the near future.
|
SocketAddress |
remoteSocketAddress() |
Socket |
socket() |
SocketChannel |
socketChannel() |
int |
write(ByteBuffer src)
This method will be removed from the Channel in the near future.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitflush, lastReadTimeMillis, lastWriteTimeMillis, writeprotected final SocketChannel socketChannel
public AbstractChannel(SocketChannel socketChannel, boolean clientMode)
public boolean isClientMode()
ChannelisClientMode in interface ChannelSSLEngine.getUseClientMode()public ConcurrentMap attributeMap()
ChannelattributeMap in interface Channelpublic Socket socket()
socket in interface ChannelThis method will be removed from the interface. Only an explicit cast to NioChannel
will expose the Socket.
It is very important that the socket isn't closed directly; but one goes through the
{@link #close()} method so that interal administration of the channel is in sync with
that of the socket.public SocketChannel socketChannel()
public SocketAddress remoteSocketAddress()
remoteSocketAddress in interface Channelpublic SocketAddress localSocketAddress()
localSocketAddress in interface Channelpublic int read(ByteBuffer dst) throws IOException
Channelread in interface ChannelIOExceptionSocketChannel.read(ByteBuffer)public int write(ByteBuffer src) throws IOException
Channelwrite in interface ChannelIOExceptionSocketChannel.write(ByteBuffer)public void closeInbound()
throws IOException
ChannelNot thread safe. Should be called in channel reader thread.
Method will be removed once the TLS integration doesn't rely on subclassing this channel.closeInbound in interface ChannelIOExceptionpublic void closeOutbound()
throws IOException
ChannelNot thread safe. Should be called in channel writer thread.
Method will be removed once the TLS integration doesn't rely on subclassing this channel.closeOutbound in interface ChannelIOExceptionpublic boolean isClosed()
Channelpublic void close()
throws IOException
Channelclose in interface Channelclose in interface Closeableclose in interface AutoCloseableIOExceptionprotected void onClose()
throws IOException
socketChannel is closed.
It will be called only once.IOExceptionpublic void addCloseListener(ChannelCloseListener listener)
ChanneladdCloseListener in interface Channellistener - the listener to register.Copyright © 2018 Hazelcast, Inc.. All Rights Reserved.