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 ILogger |
logger |
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.
|
protected void |
close0()
Template method that is called when the Channel is closed.
|
void |
connect(InetSocketAddress address,
int timeoutMillis)
Connects the channel.
|
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 |
notifyCloseListeners() |
protected void |
onConnect()
Template method that can be implemented when the
connect(InetSocketAddress, int)
has completed. |
SocketAddress |
remoteSocketAddress() |
Socket |
socket() |
SocketChannel |
socketChannel() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitbytesRead, bytesWritten, inboundPipeline, lastReadTimeMillis, lastWriteTimeMillis, options, outboundPipeline, start, writeprotected final SocketChannel socketChannel
protected final ILogger logger
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 void connect(InetSocketAddress address, int timeoutMillis) throws IOException
Channelconnect in interface Channeladdress - the address to connect to.timeoutMillis - the timeout in millis, or 0 if waiting indefinitely.IOException - if connecting fails.protected void onConnect()
connect(InetSocketAddress, int)
has completed.public boolean isClosed()
Channelpublic void close()
throws IOException
Channelclose in interface Channelclose in interface Closeableclose in interface AutoCloseableIOExceptionprotected void close0()
throws IOException
IOExceptionpublic void addCloseListener(ChannelCloseListener listener)
ChanneladdCloseListener in interface Channellistener - the listener to register.protected final void notifyCloseListeners()
Copyright © 2021 Hazelcast, Inc.. All Rights Reserved.