final class EndpointImpl extends AbstractHandleableCloseable<Endpoint> implements Endpoint
| Modifier and Type | Class and Description |
|---|---|
private class |
EndpointImpl.ConnectionCloseHandler |
private class |
EndpointImpl.ConnectionProviderContextImpl |
(package private) class |
EndpointImpl.LocalConnectionContext |
private class |
EndpointImpl.MapRegistration<T> |
private static class |
EndpointImpl.RegisteredServiceImpl |
private class |
EndpointImpl.TrackingExecutor |
(package private) static class |
EndpointImpl.UserAndRealm |
Endpoint.ListenerFlagHandleableCloseable.Key| Modifier and Type | Field and Description |
|---|---|
private static RemotingPermission |
ADD_CONNECTION_PROVIDER_PERM |
private Attachments |
attachments |
private static int |
CLOSED_FLAG |
private static RemotingPermission |
CONNECT_PERM |
private EndpointImpl.ConnectionCloseHandler |
connectionCloseHandler |
private java.lang.Object |
connectionLock |
private ConnectionProviderContext |
connectionProviderContext |
private java.util.concurrent.ConcurrentMap<java.lang.String,ConnectionProvider> |
connectionProviders |
private java.util.Set<ConnectionImpl> |
connections |
private static int |
COUNT_MASK |
private static EndpointImpl.UserAndRealm |
EMPTY |
private static java.lang.String |
FQCN |
private static RemotingPermission |
GET_CONNECTION_PROVIDER_INTERFACE_PERM |
private static org.jboss.logging.Logger |
log |
private java.lang.String |
name
The name of this endpoint.
|
private org.xnio.OptionMap |
optionMap |
private boolean |
ourWorker |
private static RemotingPermission |
REGISTER_SERVICE_PERM |
private java.util.concurrent.ConcurrentMap<java.lang.String,EndpointImpl.RegisteredServiceImpl> |
registeredServices |
private CloseHandler<java.lang.Object> |
resourceCloseHandler |
private int |
resourceCount |
private static java.util.concurrent.atomic.AtomicIntegerFieldUpdater<EndpointImpl> |
resourceCountUpdater |
private static java.nio.charset.Charset |
UTF_8 |
private static java.util.regex.Pattern |
VALID_SERVICE_PATTERN |
private org.xnio.XnioWorker |
worker |
private org.xnio.Xnio |
xnio |
| Modifier | Constructor and Description |
|---|---|
private |
EndpointImpl(org.xnio.XnioWorker xnioWorker,
boolean ourWorker,
java.lang.String name,
org.xnio.OptionMap optionMap) |
| Modifier and Type | Method and Description |
|---|---|
Registration |
addConnectionProvider(java.lang.String uriScheme,
ConnectionProviderFactory providerFactory,
org.xnio.OptionMap optionMap)
Register a connection provider for a URI scheme.
|
protected void |
closeAction()
Called exactly once when the
close() method is invoked; the actual close operation should take place here. |
protected void |
closeComplete()
Call when close is complete.
|
private void |
closeTick1(java.lang.Object c) |
org.xnio.IoFuture<Connection> |
connect(java.lang.String protocol,
java.net.SocketAddress bindAddress,
java.net.SocketAddress destination)
Open a connection with a peer.
|
org.xnio.IoFuture<Connection> |
connect(java.lang.String protocol,
java.net.SocketAddress bindAddress,
java.net.SocketAddress destination,
org.xnio.OptionMap connectOptions)
Open a connection with a peer.
|
org.xnio.IoFuture<Connection> |
connect(java.lang.String protocol,
java.net.SocketAddress bindAddress,
java.net.SocketAddress destination,
org.xnio.OptionMap connectOptions,
javax.security.auth.callback.CallbackHandler callbackHandler)
Open a connection with a peer.
|
org.xnio.IoFuture<Connection> |
connect(java.lang.String protocol,
java.net.SocketAddress bindAddress,
java.net.SocketAddress destination,
org.xnio.OptionMap connectOptions,
javax.security.auth.callback.CallbackHandler callbackHandler,
javax.net.ssl.SSLContext sslContext)
Open a connection with a peer.
|
org.xnio.IoFuture<Connection> |
connect(java.lang.String protocol,
java.net.SocketAddress bindAddress,
java.net.SocketAddress destination,
org.xnio.OptionMap connectOptions,
javax.security.auth.callback.CallbackHandler callbackHandler,
org.xnio.ssl.XnioSsl xnioSsl)
Open a connection with a peer.
|
org.xnio.IoFuture<Connection> |
connect(java.lang.String protocol,
java.net.SocketAddress bindAddress,
java.net.SocketAddress destination,
org.xnio.OptionMap connectOptions,
java.lang.String userName,
java.lang.String realmName,
char[] password)
Open a connection with a peer.
|
org.xnio.IoFuture<Connection> |
connect(java.lang.String protocol,
java.net.SocketAddress bindAddress,
java.net.SocketAddress destination,
org.xnio.OptionMap connectOptions,
java.lang.String userName,
java.lang.String realmName,
char[] password,
javax.net.ssl.SSLContext sslContext)
Open a connection with a peer.
|
org.xnio.IoFuture<Connection> |
connect(java.lang.String protocol,
java.net.SocketAddress bindAddress,
java.net.SocketAddress destination,
org.xnio.OptionMap connectOptions,
java.lang.String userName,
java.lang.String realmName,
char[] password,
org.xnio.ssl.XnioSsl xnioSsl)
Open a connection with a peer.
|
org.xnio.IoFuture<Connection> |
connect(java.net.URI destination)
Open a connection with a peer.
|
org.xnio.IoFuture<Connection> |
connect(java.net.URI destination,
org.xnio.OptionMap connectOptions)
Open a connection with a peer.
|
org.xnio.IoFuture<Connection> |
connect(java.net.URI destination,
org.xnio.OptionMap connectOptions,
javax.security.auth.callback.CallbackHandler callbackHandler)
Open a connection with a peer.
|
org.xnio.IoFuture<Connection> |
connect(java.net.URI destination,
org.xnio.OptionMap connectOptions,
javax.security.auth.callback.CallbackHandler callbackHandler,
javax.net.ssl.SSLContext sslContext)
Open a connection with a peer.
|
org.xnio.IoFuture<Connection> |
connect(java.net.URI destination,
org.xnio.OptionMap connectOptions,
javax.security.auth.callback.CallbackHandler callbackHandler,
org.xnio.ssl.XnioSsl xnioSsl)
Open a connection with a peer.
|
org.xnio.IoFuture<Connection> |
connect(java.net.URI destination,
org.xnio.OptionMap connectOptions,
java.lang.String userName,
java.lang.String realmName,
char[] password)
Open a connection with a peer.
|
org.xnio.IoFuture<Connection> |
connect(java.net.URI destination,
org.xnio.OptionMap connectOptions,
java.lang.String userName,
java.lang.String realmName,
char[] password,
javax.net.ssl.SSLContext sslContext)
Open a connection with a peer.
|
org.xnio.IoFuture<Connection> |
connect(java.net.URI destination,
org.xnio.OptionMap connectOptions,
java.lang.String userName,
java.lang.String realmName,
char[] password,
org.xnio.ssl.XnioSsl xnioSsl)
Open a connection with a peer.
|
(package private) static EndpointImpl |
construct(org.xnio.XnioWorker xnioWorker,
boolean ourWorker,
java.lang.String name,
org.xnio.OptionMap optionMap) |
private org.xnio.IoFuture<Connection> |
doConnect(java.lang.String scheme,
java.net.SocketAddress bindAddress,
java.net.SocketAddress destination,
org.xnio.OptionMap connectOptions,
javax.security.auth.callback.CallbackHandler callbackHandler,
org.xnio.ssl.XnioSsl xnioSsl) |
private org.xnio.IoFuture<Connection> |
doConnect(java.net.URI uri,
org.xnio.OptionMap connectOptions,
javax.security.auth.callback.CallbackHandler callbackHandler,
org.xnio.ssl.XnioSsl xnioSsl) |
(package private) void |
executorUntick(java.lang.Object opened) |
private void |
finishPhase1() |
Attachments |
getAttachments()
Get the attachments for this entity.
|
<T> T |
getConnectionProviderInterface(java.lang.String uriScheme,
java.lang.Class<T> expectedType)
Get the interface for a connection provider.
|
java.util.concurrent.Executor |
getExecutor()
Get the executor to use for handler invocation.
|
java.lang.String |
getName()
Get the name of this endpoint.
|
private EndpointImpl.UserAndRealm |
getUserAndRealm(java.net.URI uri) |
org.xnio.XnioWorker |
getXnioWorker()
Get the XNIO worker configured for this endpoint.
|
(package private) boolean |
isCloseFlagSet() |
boolean |
isValidUriScheme(java.lang.String uriScheme)
Determine whether the given URI scheme is valid for this endpoint.
|
Registration |
registerService(java.lang.String serviceType,
OpenListener openListener,
org.xnio.OptionMap optionMap)
Register a new service.
|
(package private) void |
resourceUntick(java.lang.Object opened) |
java.lang.String |
toString() |
private static java.lang.String |
uriDecode(java.lang.String encoded) |
addCloseHandler, awaitClosed, awaitClosedUninterruptibly, checkOpen, close, closeAsync, closeFailed, finalize, isOpenclone, equals, getClass, hashCode, notify, notifyAll, wait, wait, waitaddCloseHandler, awaitClosed, awaitClosedUninterruptibly, close, closeAsyncprivate static final org.jboss.logging.Logger log
private static final RemotingPermission REGISTER_SERVICE_PERM
private static final RemotingPermission CONNECT_PERM
private static final RemotingPermission ADD_CONNECTION_PROVIDER_PERM
private static final RemotingPermission GET_CONNECTION_PROVIDER_INTERFACE_PERM
private static final int CLOSED_FLAG
private static final int COUNT_MASK
private static final java.lang.String FQCN
private final java.util.Set<ConnectionImpl> connections
private final Attachments attachments
private final java.util.concurrent.ConcurrentMap<java.lang.String,ConnectionProvider> connectionProviders
private final java.util.concurrent.ConcurrentMap<java.lang.String,EndpointImpl.RegisteredServiceImpl> registeredServices
private final org.xnio.Xnio xnio
private final org.xnio.XnioWorker worker
private final java.lang.Object connectionLock
private static final java.util.concurrent.atomic.AtomicIntegerFieldUpdater<EndpointImpl> resourceCountUpdater
private volatile int resourceCount
private static final java.util.regex.Pattern VALID_SERVICE_PATTERN
private final java.lang.String name
private final org.xnio.OptionMap optionMap
private final ConnectionProviderContext connectionProviderContext
private final CloseHandler<java.lang.Object> resourceCloseHandler
private final EndpointImpl.ConnectionCloseHandler connectionCloseHandler
private final boolean ourWorker
private static final java.nio.charset.Charset UTF_8
private static final EndpointImpl.UserAndRealm EMPTY
private EndpointImpl(org.xnio.XnioWorker xnioWorker,
boolean ourWorker,
java.lang.String name,
org.xnio.OptionMap optionMap)
throws java.io.IOException
java.io.IOExceptionstatic EndpointImpl construct(org.xnio.XnioWorker xnioWorker, boolean ourWorker, java.lang.String name, org.xnio.OptionMap optionMap) throws java.io.IOException
java.io.IOExceptionpublic Attachments getAttachments()
AttachablegetAttachments in interface Attachablepublic java.lang.String getName()
Endpointpublic java.util.concurrent.Executor getExecutor()
AbstractHandleableCloseablegetExecutor in class AbstractHandleableCloseable<Endpoint>protected void closeComplete()
AbstractHandleableCloseablecloseComplete in class AbstractHandleableCloseable<Endpoint>private void closeTick1(java.lang.Object c)
private void finishPhase1()
void resourceUntick(java.lang.Object opened)
throws NotOpenException
NotOpenExceptionvoid executorUntick(java.lang.Object opened)
boolean isCloseFlagSet()
protected 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<Endpoint>RemotingException - if the close failedjava.io.IOExceptionpublic Registration registerService(java.lang.String serviceType, OpenListener openListener, org.xnio.OptionMap optionMap) throws ServiceRegistrationException
EndpointregisterService in interface EndpointserviceType - the service typeopenListener - the channel open listeneroptionMap - the option mapServiceRegistrationException - if the service could not be registeredprivate org.xnio.IoFuture<Connection> doConnect(java.net.URI uri, org.xnio.OptionMap connectOptions, javax.security.auth.callback.CallbackHandler callbackHandler, org.xnio.ssl.XnioSsl xnioSsl) throws java.io.IOException
java.io.IOExceptionprivate org.xnio.IoFuture<Connection> doConnect(java.lang.String scheme, java.net.SocketAddress bindAddress, java.net.SocketAddress destination, org.xnio.OptionMap connectOptions, javax.security.auth.callback.CallbackHandler callbackHandler, org.xnio.ssl.XnioSsl xnioSsl) throws java.io.IOException
java.io.IOExceptionpublic org.xnio.IoFuture<Connection> connect(java.net.URI destination) throws java.io.IOException
Endpointconnect EndpointPermission to invoke this method.public org.xnio.IoFuture<Connection> connect(java.net.URI destination, org.xnio.OptionMap connectOptions) throws java.io.IOException
Endpointconnect EndpointPermission to invoke this method.public org.xnio.IoFuture<Connection> connect(java.net.URI destination, org.xnio.OptionMap connectOptions, javax.security.auth.callback.CallbackHandler callbackHandler) throws java.io.IOException
Endpointconnect EndpointPermission to invoke this method.connect in interface Endpointdestination - the destinationconnectOptions - options to configure this connectioncallbackHandler - the local callback handler to use for authenticationjava.io.IOException - if an error occurs while starting the connect attemptpublic org.xnio.IoFuture<Connection> connect(java.net.URI destination, org.xnio.OptionMap connectOptions, javax.security.auth.callback.CallbackHandler callbackHandler, javax.net.ssl.SSLContext sslContext) throws java.io.IOException
Endpointconnect EndpointPermission to invoke this method.connect in interface Endpointdestination - the destinationconnectOptions - options to configure this connectioncallbackHandler - the local callback handler to use for authenticationsslContext - the SSL context to use for SSL connectionsjava.io.IOException - if an error occurs while starting the connect attemptpublic org.xnio.IoFuture<Connection> connect(java.net.URI destination, org.xnio.OptionMap connectOptions, javax.security.auth.callback.CallbackHandler callbackHandler, org.xnio.ssl.XnioSsl xnioSsl) throws java.io.IOException
Endpointconnect EndpointPermission to invoke this method.connect in interface Endpointdestination - the destinationconnectOptions - options to configure this connectioncallbackHandler - the local callback handler to use for authenticationxnioSsl - the SSL context to use for SSL connectionsjava.io.IOException - if an error occurs while starting the connect attemptpublic org.xnio.IoFuture<Connection> connect(java.net.URI destination, org.xnio.OptionMap connectOptions, java.lang.String userName, java.lang.String realmName, char[] password) throws java.io.IOException
Endpointconnect EndpointPermission to invoke this method.connect in interface Endpointdestination - the destinationconnectOptions - options to configure this connectionuserName - the user name to authenticate as, or null if it is unspecifiedrealmName - the user realm to authenticate with, or null if it is unspecifiedpassword - the password to send, or null if it is unspecifiedjava.io.IOException - if an error occurs while starting the connect attemptpublic org.xnio.IoFuture<Connection> connect(java.net.URI destination, org.xnio.OptionMap connectOptions, java.lang.String userName, java.lang.String realmName, char[] password, javax.net.ssl.SSLContext sslContext) throws java.io.IOException
Endpointconnect EndpointPermission to invoke this method.connect in interface Endpointdestination - the destinationconnectOptions - options to configure this connectionuserName - the user name to authenticate as, or null if it is unspecifiedrealmName - the user realm to authenticate with, or null if it is unspecifiedpassword - the password to send, or null if it is unspecifiedsslContext - the SSL context to use for SSL connectionsjava.io.IOException - if an error occurs while starting the connect attemptpublic org.xnio.IoFuture<Connection> connect(java.net.URI destination, org.xnio.OptionMap connectOptions, java.lang.String userName, java.lang.String realmName, char[] password, org.xnio.ssl.XnioSsl xnioSsl) throws java.io.IOException
Endpointconnect EndpointPermission to invoke this method.connect in interface Endpointdestination - the destinationconnectOptions - options to configure this connectionuserName - the user name to authenticate as, or null if it is unspecifiedrealmName - the user realm to authenticate with, or null if it is unspecifiedpassword - the password to send, or null if it is unspecifiedxnioSsl - the SSL context to use for SSL connectionsjava.io.IOException - if an error occurs while starting the connect attemptpublic org.xnio.IoFuture<Connection> connect(java.lang.String protocol, java.net.SocketAddress bindAddress, java.net.SocketAddress destination) throws java.io.IOException
Endpointconnect EndpointPermission to invoke this method.connect in interface Endpointprotocol - the protocol to use for connectionbindAddress - the address to bind to, or null to choose one automatically as neededdestination - the destination address, or null if the protocol is not a network protocoljava.io.IOException - if an error occurs while starting the connect attemptpublic org.xnio.IoFuture<Connection> connect(java.lang.String protocol, java.net.SocketAddress bindAddress, java.net.SocketAddress destination, org.xnio.OptionMap connectOptions) throws java.io.IOException
Endpointconnect EndpointPermission to invoke this method.connect in interface Endpointprotocol - the protocol to use for connectionbindAddress - the address to bind to, or null to choose one automatically as neededdestination - the destination address, or null if the protocol is not a network protocolconnectOptions - options to configure this connectionjava.io.IOException - if an error occurs while starting the connect attemptpublic org.xnio.IoFuture<Connection> connect(java.lang.String protocol, java.net.SocketAddress bindAddress, java.net.SocketAddress destination, org.xnio.OptionMap connectOptions, javax.security.auth.callback.CallbackHandler callbackHandler) throws java.io.IOException
Endpointconnect EndpointPermission to invoke this method.connect in interface Endpointprotocol - the protocol to use for connectionbindAddress - the address to bind to, or null to choose one automatically as neededdestination - the destination address, or null if the protocol is not a network protocolconnectOptions - options to configure this connectioncallbackHandler - the local callback handler to use for authenticationjava.io.IOException - if an error occurs while starting the connect attemptpublic org.xnio.IoFuture<Connection> connect(java.lang.String protocol, java.net.SocketAddress bindAddress, java.net.SocketAddress destination, org.xnio.OptionMap connectOptions, javax.security.auth.callback.CallbackHandler callbackHandler, javax.net.ssl.SSLContext sslContext) throws java.io.IOException
Endpointconnect EndpointPermission to invoke this method.connect in interface Endpointprotocol - the protocol to use for connectionbindAddress - the address to bind to, or null to choose one automatically as neededdestination - the destination address, or null if the protocol is not a network protocolconnectOptions - options to configure this connectioncallbackHandler - the local callback handler to use for authenticationsslContext - the SSL context to use for SSL connectionsjava.io.IOException - if an error occurs while starting the connect attemptpublic org.xnio.IoFuture<Connection> connect(java.lang.String protocol, java.net.SocketAddress bindAddress, java.net.SocketAddress destination, org.xnio.OptionMap connectOptions, javax.security.auth.callback.CallbackHandler callbackHandler, org.xnio.ssl.XnioSsl xnioSsl) throws java.io.IOException
Endpointconnect EndpointPermission to invoke this method.connect in interface Endpointprotocol - the protocol to use for connectionbindAddress - the address to bind to, or null to choose one automatically as neededdestination - the destination address, or null if the protocol is not a network protocolconnectOptions - options to configure this connectioncallbackHandler - the local callback handler to use for authenticationxnioSsl - the SSL context to use for SSL connectionsjava.io.IOException - if an error occurs while starting the connect attemptpublic org.xnio.IoFuture<Connection> connect(java.lang.String protocol, java.net.SocketAddress bindAddress, java.net.SocketAddress destination, org.xnio.OptionMap connectOptions, java.lang.String userName, java.lang.String realmName, char[] password) throws java.io.IOException
Endpointconnect EndpointPermission to invoke this method.connect in interface Endpointprotocol - the protocol to use for connectionbindAddress - the address to bind to, or null to choose one automatically as neededdestination - the destination address, or null if the protocol is not a network protocolconnectOptions - options to configure this connectionuserName - the user name to authenticate as, or null if it is unspecifiedrealmName - the user realm to authenticate with, or null if it is unspecifiedpassword - the password to send, or null if it is unspecifiedjava.io.IOException - if an error occurs while starting the connect attemptpublic org.xnio.IoFuture<Connection> connect(java.lang.String protocol, java.net.SocketAddress bindAddress, java.net.SocketAddress destination, org.xnio.OptionMap connectOptions, java.lang.String userName, java.lang.String realmName, char[] password, javax.net.ssl.SSLContext sslContext) throws java.io.IOException
Endpointconnect EndpointPermission to invoke this method.connect in interface Endpointprotocol - the protocol to use for connectionbindAddress - the address to bind to, or null to choose one automatically as neededdestination - the destination address, or null if the protocol is not a network protocolconnectOptions - options to configure this connectionuserName - the user name to authenticate as, or null if it is unspecifiedrealmName - the user realm to authenticate with, or null if it is unspecifiedpassword - the password to send, or null if it is unspecifiedsslContext - the SSL context to use for SSL connectionsjava.io.IOException - if an error occurs while starting the connect attemptpublic org.xnio.IoFuture<Connection> connect(java.lang.String protocol, java.net.SocketAddress bindAddress, java.net.SocketAddress destination, org.xnio.OptionMap connectOptions, java.lang.String userName, java.lang.String realmName, char[] password, org.xnio.ssl.XnioSsl xnioSsl) throws java.io.IOException
Endpointconnect EndpointPermission to invoke this method.connect in interface Endpointprotocol - the protocol to use for connectionbindAddress - the address to bind to, or null to choose one automatically as neededdestination - the destination address, or null if the protocol is not a network protocolconnectOptions - options to configure this connectionuserName - the user name to authenticate as, or null if it is unspecifiedrealmName - the user realm to authenticate with, or null if it is unspecifiedpassword - the password to send, or null if it is unspecifiedxnioSsl - the SSL context to use for SSL connectionsjava.io.IOException - if an error occurs while starting the connect attemptpublic Registration addConnectionProvider(java.lang.String uriScheme, ConnectionProviderFactory providerFactory, org.xnio.OptionMap optionMap) throws java.io.IOException
EndpointaddConnectionProvider EndpointPermission to invoke this method.addConnectionProvider in interface EndpointuriScheme - the URI schemeproviderFactory - the provider factoryoptionMap - the configuration options for the connection providerjava.io.IOException - if the provider failed to initializepublic <T> T getConnectionProviderInterface(java.lang.String uriScheme,
java.lang.Class<T> expectedType)
throws UnknownURISchemeException,
java.lang.ClassCastException
EndpointgetConnectionProviderInterface EndpointPermission to invoke this method.getConnectionProviderInterface in interface EndpointT - the expected type of the interfaceuriScheme - the URI scheme of the registered connection providerexpectedType - the expected type of the interfaceUnknownURISchemeException - if the given URI scheme is not registeredjava.lang.ClassCastException - if the interface type does not match the expected typepublic boolean isValidUriScheme(java.lang.String uriScheme)
EndpointisValidUriScheme in interface EndpointuriScheme - the URI schemetrue if the URI scheme is valid at the time this method is calledpublic org.xnio.XnioWorker getXnioWorker()
EndpointgetXnioWorker in interface Endpointpublic java.lang.String toString()
toString in class java.lang.Objectprivate static java.lang.String uriDecode(java.lang.String encoded)
private EndpointImpl.UserAndRealm getUserAndRealm(java.net.URI uri)