final class RemoteConnectionHandler extends AbstractHandleableCloseable<ConnectionHandler> implements ConnectionHandler
HandleableCloseable.Key| Modifier and Type | Field and Description |
|---|---|
private int |
behavior |
private IntIndexMap<RemoteConnectionChannel> |
channels
Channels.
|
private int |
channelState |
private static java.util.concurrent.atomic.AtomicIntegerFieldUpdater<RemoteConnectionHandler> |
channelStateUpdater |
private ConnectionHandlerContext |
connectionContext |
private static int |
INBOUND_CHANNELS_MASK |
private int |
maxInboundChannels |
private int |
maxOutboundChannels |
private static int |
ONE_INBOUND_CHANNEL |
private static int |
ONE_OUTBOUND_CHANNEL |
private static int |
OUTBOUND_CHANNELS_MASK |
private IntIndexMap<PendingChannel> |
pendingChannels
Pending channels.
|
private java.util.Collection<java.security.Principal> |
principals |
private static int |
RECEIVED_CLOSE_REQ
Received close request.
|
private RemoteConnection |
remoteConnection |
private java.lang.String |
remoteEndpointName |
private static int |
SENT_CLOSE_REQ
Sending close request, now shutting down the write side of all channels and refusing new channels.
|
private UserInfo |
userInfo |
| Constructor and Description |
|---|
RemoteConnectionHandler(ConnectionHandlerContext connectionContext,
RemoteConnection remoteConnection,
java.util.Collection<java.security.Principal> principals,
UserInfo userInfo,
int maxInboundChannels,
int maxOutboundChannels,
java.lang.String remoteEndpointName,
int behavior) |
| Modifier and Type | Method and Description |
|---|---|
(package private) RemoteConnectionChannel |
addChannel(RemoteConnectionChannel channel) |
private boolean |
casState(int oldState,
int newState) |
protected void |
closeAction()
Called exactly once when the
close() method is invoked; the actual close operation should take place here. |
private void |
closeAllChannels() |
protected void |
closeComplete()
Make this method visible.
|
private void |
closePendingChannels() |
(package private) void |
dumpState(java.lang.StringBuilder b) |
(package private) RemoteConnectionChannel |
getChannel(int id) |
(package private) ConnectionHandlerContext |
getConnectionContext() |
java.util.Collection<java.security.Principal> |
getPrincipals()
Get the authenticated principals for this connection.
|
java.lang.String |
getRemoteEndpointName()
Get the name of the remote endpoint.
|
javax.net.ssl.SSLSession |
getSslSession()
Get the underlying
SSLSession for this connection if one is established. |
UserInfo |
getUserInfo()
Get the authenticated UserInfo for this connection.
|
(package private) void |
handleChannelClosed(RemoteConnectionChannel channel)
A channel was closed, locally or remotely.
|
(package private) void |
handleConnectionClose()
The socket channel was closed with or without our consent.
|
(package private) void |
handleInboundChannelClosed() |
(package private) boolean |
handleInboundChannelOpen() |
(package private) void |
handleOutboundChannelClosed() |
(package private) void |
handleOutboundChannelOpen() |
private int |
incrementState(int count) |
(package private) boolean |
isFaultyMessageSize() |
(package private) boolean |
isMessageClose() |
org.xnio.Cancellable |
open(java.lang.String serviceType,
org.xnio.Result<Channel> result,
org.xnio.OptionMap optionMap)
Open a request handler.
|
(package private) void |
putChannel(RemoteConnectionChannel channel) |
(package private) void |
receiveCloseRequest()
The remote side requests a close of the whole channel.
|
(package private) PendingChannel |
removePendingChannel(int id) |
(package private) void |
sendCloseRequest() |
private void |
sendCloseRequestBody() |
(package private) static void |
sendCloseRequestBody(RemoteConnection remoteConnection) |
java.lang.String |
toString() |
addCloseHandler, awaitClosed, awaitClosedUninterruptibly, checkOpen, close, closeAsync, closeFailed, finalize, getExecutor, isOpenclone, equals, getClass, hashCode, notify, notifyAll, wait, wait, waitaddCloseHandler, awaitClosed, awaitClosedUninterruptibly, close, closeAsyncprivate final ConnectionHandlerContext connectionContext
private final RemoteConnection remoteConnection
private final IntIndexMap<RemoteConnectionChannel> channels
private final IntIndexMap<PendingChannel> pendingChannels
private final java.util.Collection<java.security.Principal> principals
private final UserInfo userInfo
private final int maxInboundChannels
private final int maxOutboundChannels
private final java.lang.String remoteEndpointName
private final int behavior
private volatile int channelState
private static final java.util.concurrent.atomic.AtomicIntegerFieldUpdater<RemoteConnectionHandler> channelStateUpdater
private static final int SENT_CLOSE_REQ
private static final int RECEIVED_CLOSE_REQ
private static final int OUTBOUND_CHANNELS_MASK
private static final int ONE_OUTBOUND_CHANNEL
private static final int INBOUND_CHANNELS_MASK
private static final int ONE_INBOUND_CHANNEL
RemoteConnectionHandler(ConnectionHandlerContext connectionContext, RemoteConnection remoteConnection, java.util.Collection<java.security.Principal> principals, UserInfo userInfo, int maxInboundChannels, int maxOutboundChannels, java.lang.String remoteEndpointName, int behavior)
void handleConnectionClose()
protected void closeComplete()
closeComplete in class AbstractHandleableCloseable<ConnectionHandler>void handleChannelClosed(RemoteConnectionChannel channel)
channel - the channel that was closedvoid handleInboundChannelClosed()
void handleOutboundChannelClosed()
boolean handleInboundChannelOpen()
void handleOutboundChannelOpen()
throws java.io.IOException
java.io.IOExceptionvoid receiveCloseRequest()
void sendCloseRequest()
private int incrementState(int count)
private boolean casState(int oldState,
int newState)
private void sendCloseRequestBody()
static void sendCloseRequestBody(RemoteConnection remoteConnection)
public org.xnio.Cancellable open(java.lang.String serviceType,
org.xnio.Result<Channel> result,
org.xnio.OptionMap optionMap)
ConnectionHandleropen in interface ConnectionHandlerserviceType - the service type stringresult - the result for the connected channeloptionMap - the options for this servicepublic java.util.Collection<java.security.Principal> getPrincipals()
ConnectionHandlergetPrincipals in interface ConnectionHandlerpublic UserInfo getUserInfo()
ConnectionHandlergetUserInfo in interface ConnectionHandlerpublic javax.net.ssl.SSLSession getSslSession()
ConnectionHandlerSSLSession for this connection if one is established.getSslSession in interface ConnectionHandlerSSLSession for the connection if one is established, otherwise returns null.public java.lang.String getRemoteEndpointName()
ConnectionHandlergetRemoteEndpointName in interface ConnectionHandlerprotected void closeAction()
throws java.io.IOException
AbstractHandleableCloseableclose() method is invoked; the actual close operation should take place here.
This method must call AbstractHandleableCloseable.closeComplete(), directly or indirectly, for the close operation to finish
(it may happen in another thread but it must happen).
This method should not expect the AbstractHandleableCloseable.closeComplete() call to be made from another thread from the same thread pool
that may cause AbstractHandleableCloseable.close(). As close will block, this can result in situations where all threads in the pool are
blocked on AbstractHandleableCloseable.close() method calls, which means the AbstractHandleableCloseable.closeComplete() will never be run.closeAction in class AbstractHandleableCloseable<ConnectionHandler>RemotingException - if the close failedjava.io.IOExceptionprivate void closePendingChannels()
private void closeAllChannels()
ConnectionHandlerContext getConnectionContext()
RemoteConnectionChannel addChannel(RemoteConnectionChannel channel)
RemoteConnectionChannel getChannel(int id)
PendingChannel removePendingChannel(int id)
void putChannel(RemoteConnectionChannel channel)
boolean isMessageClose()
boolean isFaultyMessageSize()
public java.lang.String toString()
toString in class java.lang.Objectvoid dumpState(java.lang.StringBuilder b)