org.jboss.resource.connectionmanager
Class JBossManagedConnectionPool

java.lang.Object
  extended byorg.jboss.mx.util.JBossNotificationBroadcasterSupport (src) 
      extended byorg.jboss.system.ServiceMBeanSupport (src) 
          extended byorg.jboss.resource.connectionmanager.JBossManagedConnectionPool
All Implemented Interfaces:
java.util.EventListener, MBeanRegistration (src) , NotificationBroadcaster (src) , NotificationEmitter (src) , NotificationListener (src) , Service (src) , ServiceMBean (src)

public class JBossManagedConnectionPool
extends ServiceMBeanSupport (src)
implements NotificationListener (src)

The JBossManagedConnectionPool mbean configures and supplies pooling of JBossConnectionEventListeners to the BaseConnectionManager2 mbean.

It may be replaced by any mbean with a readable ManagedConnectionPool attribute of type ManagedConnectionPool. Normal pooling parameters are supplied, and the criteria to distinguish ManagedConnections is set in the Criteria attribute.


Nested Class Summary
static class JBossManagedConnectionPool.BasePool (src)
          The base pool implementation
static class JBossManagedConnectionPool.OnePool (src)
          One pool
static class JBossManagedConnectionPool.PoolByCri (src)
          Pool by connection request information
static class JBossManagedConnectionPool.PoolBySubject (src)
          Pool by subject
static class JBossManagedConnectionPool.PoolBySubjectAndCri (src)
          Pooling by subject and connection request information
 
Field Summary
 
Fields inherited from class org.jboss.system.ServiceMBeanSupport (src)
log, server, SERVICE_CONTROLLER_SIG, serviceName
 
Fields inherited from interface org.jboss.system.ServiceMBean (src)
CREATE_EVENT, CREATED, DESTROY_EVENT, DESTROYED, FAILED, REGISTERED, START_EVENT, STARTED, STARTING, states, STOP_EVENT, STOPPED, STOPPING, UNREGISTERED
 
Constructor Summary
JBossManagedConnectionPool()
          Default managed JBossManagedConnectionPool constructor for mbeans.
 
Method Summary
 void flush()
          The flush method puts all currently checked out connections on a list to be destroyed when returned and disposes of all current pooled connections.
 long getAvailableConnectionCount()
          Get number of available free connections
 int getBlockingTimeoutMillis()
          The BlockingTimeoutMillis attribute indicates the maximum time to block while waiting for a connection before throwing an exception.
 int getConnectionCount()
          Retrieve the connection count.
 int getConnectionCreatedCount()
          Retrieve the connection created count.
 int getConnectionDestroyedCount()
          Retrieve the destrooyed count.
 java.lang.String getCriteria()
          The Criteria attribute indicates if Subject (from security domain) or app supplied parameters (such as from getConnection(user, pw)) are used to distinguish connections in the pool.
 long getIdleTimeout()
          Get the IdleTimeout value.
 long getIdleTimeoutMinutes()
          The IdleTimeoutMinutes attribute indicates the maximum time a connection may be idle before being closed.
 long getInUseConnectionCount()
          Get number of connections currently in use
 ObjectName (src) getManagedConnectionFactoryName()
          ManagedConnectionFactoryName holds the ObjectName of the mbean that represents the ManagedConnectionFactory.
 ManagedConnectionPool (src) getManagedConnectionPool()
          ManagedConnectionPool is a read only attribute returning the pool set up by this mbean.
 long getMaxConnectionsInUseCount()
           
 int getMaxSize()
          The MaxSize attribute indicates the maximum number of connections for a pool.
 int getMinSize()
          The MinSize attribute indicates the minimum number of connections this pool should hold.
 java.lang.String getName()
          Use the short class name as the default for the service name.
 boolean getNoTxSeparatePools()
          Separate pools for transactional use
 void handleNotification(Notification (src)  notification, java.lang.Object handback)
          Callback method from the broadcaster MBean this listener implementation is registered to.
 void setBlockingTimeoutMillis(int newBlockingTimeout)
          Set the BlockingTimeout value.
 void setCriteria(java.lang.String newCriteria)
          Set the Criteria value.
 void setIdleTimeout(long newIdleTimeout)
          Set the IdleTimeout value.
 void setIdleTimeoutMinutes(long newIdleTimeoutMinutes)
          Set the IdleTimeoutMinutes value.
 void setManagedConnectionFactoryName(ObjectName (src)  newManagedConnectionFactoryName)
          Set the ManagedConnectionFactoryName value.
 void setMaxSize(int newMaxSize)
          Set the MaxSize value.
 void setMinSize(int newMinSize)
          Set the MinSize value.
 void setNoTxSeparatePools(boolean value)
           
protected  void startService()
          Sub-classes should override this method to provide custum 'start' logic.
protected  void stopService()
          Sub-classes should override this method to provide custum 'stop' logic.
 
Methods inherited from class org.jboss.system.ServiceMBeanSupport (src)
create, createService, destroy, destroyService, getLog, getNextNotificationSequenceNumber, getObjectName, getServer, getServiceName, getState, getStateString, jbossInternalCreate, jbossInternalDescription, jbossInternalDestroy, jbossInternalLifecycle, jbossInternalStart, jbossInternalStop, postDeregister, postRegister, preDeregister, preRegister, start, stop
 
Methods inherited from class org.jboss.mx.util.JBossNotificationBroadcasterSupport (src)
addNotificationListener, getNotificationInfo, handleNotification, removeNotificationListener, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JBossManagedConnectionPool

public JBossManagedConnectionPool()
Default managed JBossManagedConnectionPool constructor for mbeans.

Method Detail

getManagedConnectionPool

public ManagedConnectionPool (src)  getManagedConnectionPool()
ManagedConnectionPool is a read only attribute returning the pool set up by this mbean.

Returns:
the ManagedConnectionPool implementing the pool configured by this mbean.

getManagedConnectionFactoryName

public ObjectName (src)  getManagedConnectionFactoryName()
ManagedConnectionFactoryName holds the ObjectName of the mbean that represents the ManagedConnectionFactory. Normally this can be an embedded mbean in a depends element rather than a separate mbean reference.

Returns:
the ManagedConnectionFactoryName value.

setManagedConnectionFactoryName

public void setManagedConnectionFactoryName(ObjectName (src)  newManagedConnectionFactoryName)
Set the ManagedConnectionFactoryName value.

Parameters:
newManagedConnectionFactoryName - The new ManagedConnectionFactoryName value.

getAvailableConnectionCount

public long getAvailableConnectionCount()
Get number of available free connections

Returns:
number of available connections

getMaxConnectionsInUseCount

public long getMaxConnectionsInUseCount()
Returns:
max number of connections ever used

getInUseConnectionCount

public long getInUseConnectionCount()
Get number of connections currently in use

Returns:
number of connections currently in use

getMinSize

public int getMinSize()
The MinSize attribute indicates the minimum number of connections this pool should hold. These are not created until a Subject is known from a request for a connection. MinSize connections will be created for each sub-pool.

Returns:
the MinSize value.

setMinSize

public void setMinSize(int newMinSize)
Set the MinSize value.

Parameters:
newMinSize - The new MinSize value.

getMaxSize

public int getMaxSize()
The MaxSize attribute indicates the maximum number of connections for a pool. No more than MaxSize connections will be created in each sub-pool.

Returns:
the MaxSize value.

setMaxSize

public void setMaxSize(int newMaxSize)
Set the MaxSize value.

Parameters:
newMaxSize - The new MaxSize value.

getBlockingTimeoutMillis

public int getBlockingTimeoutMillis()
The BlockingTimeoutMillis attribute indicates the maximum time to block while waiting for a connection before throwing an exception. Note that this blocks only while waiting for a permit for a connection, and will never throw an exception if creating a new connection takes an inordinately long time.

Returns:
the BlockingTimeout value.

setBlockingTimeoutMillis

public void setBlockingTimeoutMillis(int newBlockingTimeout)
Set the BlockingTimeout value.

Parameters:
newBlockingTimeout - The new BlockingTimeout value.

getIdleTimeoutMinutes

public long getIdleTimeoutMinutes()
The IdleTimeoutMinutes attribute indicates the maximum time a connection may be idle before being closed. The actual maximum time depends also on the IdleRemover scan time, which is 1/2 the smallest IdleTimeout of any pool.

Returns:
the IdleTimeoutMinutes value.

setIdleTimeoutMinutes

public void setIdleTimeoutMinutes(long newIdleTimeoutMinutes)
Set the IdleTimeoutMinutes value.

Parameters:
newIdleTimeoutMinutes - The new IdleTimeoutMinutes value.

getIdleTimeout

public long getIdleTimeout()
Get the IdleTimeout value.

Returns:
the IdleTimeout value.

setIdleTimeout

public void setIdleTimeout(long newIdleTimeout)
Set the IdleTimeout value.

Parameters:
newIdleTimeout - The new IdleTimeout value.

getCriteria

public java.lang.String getCriteria()
The Criteria attribute indicates if Subject (from security domain) or app supplied parameters (such as from getConnection(user, pw)) are used to distinguish connections in the pool. Choices are ByContainerAndApplication (use both), ByContainer (use Subject), ByApplication (use app supplied params only), ByNothing (all connections are equivalent, usually if adapter supports reauthentication)

Returns:
the Criteria value.

setCriteria

public void setCriteria(java.lang.String newCriteria)
Set the Criteria value.

Parameters:
newCriteria - The new Criteria value.

getNoTxSeparatePools

public boolean getNoTxSeparatePools()
Separate pools for transactional use

Returns:
true when connections should have different pools for transactional and non-transaction use.

setNoTxSeparatePools

public void setNoTxSeparatePools(boolean value)

flush

public void flush()
The flush method puts all currently checked out connections on a list to be destroyed when returned and disposes of all current pooled connections.


getConnectionCount

public int getConnectionCount()
Retrieve the connection count.

Returns:
the connection count

getConnectionCreatedCount

public int getConnectionCreatedCount()
Retrieve the connection created count.

Returns:
the connection created count

getConnectionDestroyedCount

public int getConnectionDestroyedCount()
Retrieve the destrooyed count.

Returns:
the destroyed count

getName

public java.lang.String getName()
Description copied from class: ServiceMBeanSupport (src)
Use the short class name as the default for the service name.

Specified by:
getName in interface ServiceMBean (src)
Overrides:
getName in class ServiceMBeanSupport (src)

startService

protected void startService()
                     throws java.lang.Exception
Description copied from class: ServiceMBeanSupport (src)
Sub-classes should override this method to provide custum 'start' logic.

This method is empty, and is provided for convenience when concrete service classes do not need to perform anything specific for this state change.

Overrides:
startService in class ServiceMBeanSupport (src)
Throws:
java.lang.Exception

stopService

protected void stopService()
                    throws java.lang.Exception
Description copied from class: ServiceMBeanSupport (src)
Sub-classes should override this method to provide custum 'stop' logic.

This method is empty, and is provided for convenience when concrete service classes do not need to perform anything specific for this state change.

Overrides:
stopService in class ServiceMBeanSupport (src)
Throws:
java.lang.Exception

handleNotification

public void handleNotification(Notification (src)  notification,
                               java.lang.Object handback)
Description copied from interface: NotificationListener (src)
Callback method from the broadcaster MBean this listener implementation is registered to.

Specified by:
handleNotification in interface NotificationListener (src)
Parameters:
notification - the notification object
handback - the handback object given to the broadcaster upon listener registration