Avaya Conferencing Provider API

com.avaya.conferencing.api.acp.control
Class ConnectionContext

java.lang.Object
  extended by com.avaya.conferencing.api.acp.control.ConnectionContext

public final class ConnectionContext
extends java.lang.Object

Provides control over how connections can create worker threads and event notification threads. Most consumers of this API will not require direct interaction with this class, as the default behaviours are generally sufficient.

The JavaEE specification allows JavaEE application servers to restrict the ability of applications to manage threads. If an application needs background threads, the JavaEE specification envisions that developers would either implement resource adapters to handle these background threads. When a resource adapter is deployed to a JavaEE container, the container provides the resource adapter with a WorkManager, which is essentially an ExecutorService that is managed by the JavaEE container.

At the time of development of this API, most JavaEE application servers do not enforce the restrictions on creating threads. This class allows the API to be used if it is deployed to a JavaEE application server that does restrict the creation of threads.

A Connection typically requires threads for two purposes:

By default, Executors.newCachedThreadPool() will be used to create the ExecutorServices used for both worker and notification tasks. Closing a Connection will result in calls to ExecutorService.shutdown() for all ExecutorServices requested by the Connection. Additionally, the Connection may also call ExecutorService.shutdownNow() for any worker ExecutorServices in order to ensure that the Connection is closed. The connection cannot call the ExecutorService.shutdownNow() for the notification ExecutorService as this would interfer with the consumer of the API.

Since:
5.1.0.0.59

Method Summary
 boolean awaitDisposed(long timeout, java.util.concurrent.TimeUnit unit)
          Method awaitDisposed ...
 void dispose()
          Disposes all connections established with this context.
 Connection getConnection(java.lang.String connectionUrl, java.lang.String username, char[] password)
          Returns the required connection.
 java.lang.ClassLoader getContextClassLoader()
          Getter for property 'contextClassLoader'.
 ExecutorServiceFactory getNotifyFactory()
          Getter for property 'notifyFactory'.
 ExecutorServiceFactory getWorkerFactory()
          Getter for property 'factory'.
 boolean isDisposed()
          Getter for property 'disposed'.
 boolean isDisposing()
          Getter for property 'disposing'.
 void setNotifyFactory(ExecutorServiceFactory notifyFactory)
          Setter for property 'notifyFactory'.
 void setWorkerFactory(ExecutorServiceFactory workerFactory)
          Setter for property 'factory'.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getContextClassLoader

public java.lang.ClassLoader getContextClassLoader()
Getter for property 'contextClassLoader'.

Returns:
Value for property 'contextClassLoader'.
Since:
5.1.0.0.59

getNotifyFactory

public ExecutorServiceFactory getNotifyFactory()
Getter for property 'notifyFactory'.

Returns:
Value for property 'notifyFactory'.
Since:
5.1.0.0.59

setNotifyFactory

public void setNotifyFactory(ExecutorServiceFactory notifyFactory)
Setter for property 'notifyFactory'.

Parameters:
notifyFactory - Value to set for property 'notifyFactory'.
Since:
5.1.0.0.59

getWorkerFactory

public ExecutorServiceFactory getWorkerFactory()
Getter for property 'factory'.

Returns:
Value for property 'factory'.
Since:
5.1.0.0.59

setWorkerFactory

public void setWorkerFactory(ExecutorServiceFactory workerFactory)
Setter for property 'factory'.

Parameters:
workerFactory - Value to set for property 'factory'.
Since:
5.1.0.0.59

awaitDisposed

public boolean awaitDisposed(long timeout,
                             java.util.concurrent.TimeUnit unit)
                      throws java.lang.InterruptedException
Method awaitDisposed ...

Parameters:
timeout - of type long
unit - of type TimeUnit
Returns:
boolean
Throws:
java.lang.InterruptedException - when
Since:
5.1.0.0.59

dispose

public void dispose()
Disposes all connections established with this context.

Since:
5.1.0.0.59

getConnection

public Connection getConnection(java.lang.String connectionUrl,
                                java.lang.String username,
                                char[] password)
                         throws java.net.MalformedURLException,
                                java.io.IOException
Returns the required connection.

Parameters:
connectionUrl - The connection URI.
username - The username to connect with.
password - The password to connect with.
Returns:
The connection.
Throws:
java.net.MalformedURLException - If the URI is malformed or if the protocol is not supported.
java.io.IOException - If there was an IOException trying to establish the connection.
Since:
5.1.0.0.59

isDisposing

public boolean isDisposing()
Getter for property 'disposing'.

Returns:
Value for property 'disposing'.
Since:
5.1.0.0.59

isDisposed

public boolean isDisposed()
Getter for property 'disposed'.

Returns:
Value for property 'disposed'.
Since:
5.1.0.0.59

Avaya Conferencing Provider API

Copyright © 2008-2009 Avaya. All Rights Reserved.