Top Description Inners Fields Constructors Methods
org.glassfish.tyrus.client

public Class ClientManager

extends BaseContainer
implements WebSocketContainer
Class Inheritance
All Implemented Interfaces
jakarta.websocket.WebSocketContainer
Imports
java.io.IOException, java.net.URI, .URISyntaxException, java.util.Collections, .HashMap, .List, .Map, .Set, java.util.concurrent.AbstractExecutorService, .CountDownLatch, .ExecutionException, .ExecutorService, .Future, .TimeUnit, java.util.concurrent.atomic.AtomicInteger, java.util.logging.Logger, jakarta.websocket.ClientEndpoint, .ClientEndpointConfig, .CloseReason, .DeploymentException, .Endpoint, .Extension, .Session, .WebSocketContainer, org.glassfish.tyrus.client.exception.Exceptions, org.glassfish.tyrus.core.AnnotatedEndpoint, .BaseContainer, .ComponentProviderService, .DebugContext, .ErrorCollector, .ReflectionHelper, .TyrusEndpointWrapper, .TyrusFuture, .TyrusSession, .Utils, org.glassfish.tyrus.core.collection.SupplierWithEx, org.glassfish.tyrus.core.monitoring.EndpointEventListener, org.glassfish.tyrus.spi.ClientContainer, .ClientEngine

ClientManager implementation.
Authors
Stepan Kopriva, Pavel Bucek

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static interface
ClientManager.ClientActivityListener

A listener listening for events that indicate when a client has started to be active and when it stopped to be active.

private static interface
public static class
private static class
private static class
ClientManager.SameThreadExecutorService

Executor service which just executes provided Runnable in the very same thread.

Field Summary

Modifier and TypeField and Description
private final ClientManager.ClientActivityListener
private final ComponentProviderService
private final ClientContainer
private static final String
private volatile long
private volatile long
public static final String
private static final Logger
private volatile int
private volatile int
private final Map<String, Object>
public static final String
PROXY_HEADERS

Client-side user property to set additional proxy headers.
public static final String
PROXY_URI

Client-side user property to set proxy URI.
public static final String
public static final String
SSL_ENGINE_CONFIGURATOR

Property usable in getProperties() as a key for SSL configuration.
private final WebSocketContainer
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String
public static final String

Constructor Summary

AccessConstructor and Description
public
ClientManager()

Create new ClientManager instance.

private
ClientManager(String containerProviderClassName, WebSocketContainer webSocketContainer)

Method Summary

Modifier and TypeMethod and Description
public Future<Session>

Returns:

Future for the Session created if the connection is successful.
asyncConnectToServer
(Class<?>
the annotated websocket client endpoint.
annotatedEndpointClass
,
URI
the complete path to the server endpoint.
path
)

Non-blocking version of WebSocketContainer#connectToServer(Class, java.net.URI).

public Future<Session>

Returns:

the Session created if the connection is successful.
asyncConnectToServer
(Class<? extends Endpoint>
the programmatic client endpoint class Endpoint.
endpointClass
,
ClientEndpointConfig
the configuration used to configure the programmatic endpoint.
cec
,
URI
the complete path to the server endpoint.
path
)

Non-blocking version of WebSocketContainer#connectToServer(Class, jakarta.websocket.ClientEndpointConfig, java.net.URI).

public Future<Session>

Returns:

the Session created if the connection is successful.
asyncConnectToServer
(Endpoint
the programmatic client endpoint instance Endpoint.
endpointInstance
,
ClientEndpointConfig
the configuration used to configure the programmatic endpoint.
cec
,
URI
the complete path to the server endpoint.
path
)

Non-blocking version of WebSocketContainer#connectToServer(jakarta.websocket.Endpoint, jakarta.websocket.ClientEndpointConfig, java.net.URI).

public Future<Session>

Returns:

the Session created if the connection is successful.
asyncConnectToServer
(Object
the annotated websocket client endpoint instance.
obj
,
URI
the complete path to the server endpoint.
path
)

Non-blocking version of WebSocketContainer#connectToServer(Object, java.net.URI).

public Session
connectToServer(final Class<T>
the annotated websocket client endpoint.
annotatedEndpointClass
,
final URI
the complete path to the server endpoint.
path
)

Implements jakarta.websocket.WebSocketContainer.connectToServer.

Connect the supplied annotated endpoint to its server.

public Session
connectToServer(final Class<? extends Endpoint>
the programmatic client endpoint class Endpoint.
endpointClass
,
final ClientEndpointConfig
the configuration used to configure the programmatic endpoint.
cec
,
final URI
the complete path to the server endpoint.
path
)

Implements jakarta.websocket.WebSocketContainer.connectToServer.

Connect the supplied programmatic endpoint to its server with the given configuration.

public Session
connectToServer(final Endpoint
the programmatic client endpoint instance Endpoint.
endpointInstance
,
final ClientEndpointConfig
the configuration used to configure the programmatic endpoint.
cec
,
final URI
the complete path to the server endpoint.
path
)

Implements jakarta.websocket.WebSocketContainer.connectToServer.

Connect the supplied programmatic client endpoint instance to its server with the given configuration.

public Session
connectToServer(final Object
the annotated websocket client endpoint instance.
obj
,
final URI
the complete path to the server endpoint.
path
)

Implements jakarta.websocket.WebSocketContainer.connectToServer.

Connect the supplied annotated endpoint instance to its server.

pack-priv Future<Session>

Returns:

Future which will return Session instance when available.
connectToServer
(final Object
the endpoint.
o
,
final ClientEndpointConfig
of the endpoint.
configuration
,
final String
to which the client will connect.
url
,
boolean
if true connect will be executed synchronously, if false connect will be executed asynchronously.
synchronous
)

Connects client endpoint o to the specified url.

public static ClientManager

Returns:

created client manager.
createClient
()

Create new ClientManager instance.

public static ClientManager

Returns:

created client manager.
createClient
(WebSocketContainer
websocket container.
webSocketContainer
)

Create new ClientManager instance on top of provided WebSocketContainer instance.

public static ClientManager

Returns:

new ClientManager instance.
createClient
(String
classname of container provider. It will be loaded using context class loader.
containerProviderClassName
)

Create new ClientManager instance.

public static ClientManager

Returns:

new ClientManager instance.
createClient
(String
classname of container provider. It will be loaded using context class loader.
containerProviderClassName
,
WebSocketContainer
websocket container.
webSocketContainer
)

Create new ClientManager instance on top of provided WebSocketContainer instance.

public long
getDefaultAsyncSendTimeout()

Implements jakarta.websocket.WebSocketContainer.getDefaultAsyncSendTimeout.

Return the number of milliseconds the implementation will timeout attempting to send a websocket message for all RemoteEndpoints associated with this container.

public int
getDefaultMaxBinaryMessageBufferSize()

Implements jakarta.websocket.WebSocketContainer.getDefaultMaxBinaryMessageBufferSize.

Returns the default maximum size of incoming binary message that this container will buffer.

public long
getDefaultMaxSessionIdleTimeout()

Implements jakarta.websocket.WebSocketContainer.getDefaultMaxSessionIdleTimeout.

Return the default time in milliseconds after which any web socket sessions in this container will be closed if it has been inactive.

public int
getDefaultMaxTextMessageBufferSize()

Implements jakarta.websocket.WebSocketContainer.getDefaultMaxTextMessageBufferSize.

Returns the default maximum size of incoming text message that this container will buffer.

private int
public Set<Extension>
getInstalledExtensions()

Implements jakarta.websocket.WebSocketContainer.getInstalledExtensions.

Return the set of Extensions installed in the container.

public Map<String, Object>

Returns:

map containing container properties.
getProperties
()

Container properties.

public void
setAsyncSendTimeout(long
the timeout in milliseconds; use zero or negative value for no timeout
timeoutmillis
)

Implements jakarta.websocket.WebSocketContainer.setAsyncSendTimeout.

Sets the number of milliseconds the implementation will timeout attempting to send a websocket message for all RemoteEndpoints associated with this container.

public void
setDefaultMaxBinaryMessageBufferSize(int
the maximum size of binary message in number of bytes.
i
)

Implements jakarta.websocket.WebSocketContainer.setDefaultMaxBinaryMessageBufferSize.

Sets the default maximum size of incoming binary message that this container will buffer.

public void
setDefaultMaxSessionIdleTimeout(long
the maximum time in milliseconds; use zero or negative value for no timeout
defaultMaxSessionIdleTimeout
)

Implements jakarta.websocket.WebSocketContainer.setDefaultMaxSessionIdleTimeout.

Sets the default time in milliseconds after which any web socket sessions in this container will be closed if it has been inactive.

public void
setDefaultMaxTextMessageBufferSize(int
the maximum size of text message in number of bytes.
i
)

Implements jakarta.websocket.WebSocketContainer.setDefaultMaxTextMessageBufferSize.

Sets the maximum size of incoming text message that this container will buffer.

private Session
Inherited from org.glassfish.tyrus.core.BaseContainer:
getExecutorServicegetScheduledExecutorServiceshutdownshutdown