org.jboss.resource.connectionmanager
Class JBossManagedConnectionPool

java.lang.Object
  extended by org.jboss.mx.util.JBossNotificationBroadcasterSupport
      extended by org.jboss.system.ServiceMBeanSupport
          extended by org.jboss.resource.connectionmanager.JBossManagedConnectionPool
All Implemented Interfaces:
EventListener, javax.management.MBeanRegistration, javax.management.NotificationBroadcaster, javax.management.NotificationEmitter, javax.management.NotificationListener, JBossManagedConnectionPoolMBean, org.jboss.system.Service, org.jboss.system.ServiceMBean

public class JBossManagedConnectionPool
extends org.jboss.system.ServiceMBeanSupport
implements JBossManagedConnectionPoolMBean, javax.management.NotificationListener

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.

Version:
$Revision: 1.31.2.11 $
Author:
David Jencks, Adrian Brock

Nested Class Summary
static class JBossManagedConnectionPool.BasePool
          The base pool implementation
static class JBossManagedConnectionPool.OnePool
          One pool
static class JBossManagedConnectionPool.PoolByCri
          Pool by connection request information
static class JBossManagedConnectionPool.PoolBySubject
          Pool by subject
static class JBossManagedConnectionPool.PoolBySubjectAndCri
          Pooling by subject and connection request information
static class JBossManagedConnectionPool.SubPoolContext
           
 
Field Summary
 
Fields inherited from class org.jboss.system.ServiceMBeanSupport
log, server, SERVICE_CONTROLLER_SIG, serviceName
 
Fields inherited from interface org.jboss.resource.connectionmanager.JBossManagedConnectionPoolMBean
OBJECT_NAME
 
Fields inherited from interface org.jboss.system.ServiceMBean
CREATE_EVENT, CREATED, DESTROY_EVENT, DESTROYED, FAILED, REGISTERED, START_EVENT, STARTED, STARTING, states, STOP_EVENT, STOPPED, STOPPING, UNREGISTERED
 
Constructor Summary
JBossManagedConnectionPool()
           
 
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.
 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
 javax.management.ObjectName getManagedConnectionFactoryName()
          ManagedConnectionFactoryName holds the ObjectName of the mbean that represents the ManagedConnectionFactory.
 ManagedConnectionPool 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.
 String getName()
           
 boolean getNoTxSeparatePools()
          Separate pools for transactional use
 void handleNotification(javax.management.Notification notification, Object handback)
           
 void setBlockingTimeoutMillis(int newBlockingTimeout)
          Set the BlockingTimeout value.
 void setCriteria(String newCriteria)
          Set the Criteria value.
 void setIdleTimeout(long newIdleTimeout)
          Set the IdleTimeout value.
 void setIdleTimeoutMinutes(long newIdleTimeoutMinutes)
          Set the IdleTimeoutMinutes value.
 void setManagedConnectionFactoryName(javax.management.ObjectName 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()
           
protected  void stopService()
           
 
Methods inherited from class org.jboss.system.ServiceMBeanSupport
create, createService, destroy, destroyService, getDeploymentInfo, 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
addNotificationListener, getNotificationInfo, handleNotification, nextNotificationSequenceNumber, removeNotificationListener, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jboss.system.ServiceMBean
getState, getStateString, jbossInternalLifecycle
 
Methods inherited from interface org.jboss.system.Service
create, destroy, start, stop
 

Constructor Detail

JBossManagedConnectionPool

public JBossManagedConnectionPool()
Method Detail

getManagedConnectionPool

public ManagedConnectionPool getManagedConnectionPool()
Description copied from interface: JBossManagedConnectionPoolMBean
ManagedConnectionPool is a read only attribute returning the pool set up by this mbean.

Specified by:
getManagedConnectionPool in interface JBossManagedConnectionPoolMBean
Returns:
the ManagedConnectionPool implementing the pool configured by this mbean.

getManagedConnectionFactoryName

public javax.management.ObjectName getManagedConnectionFactoryName()
Description copied from interface: JBossManagedConnectionPoolMBean
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.

Specified by:
getManagedConnectionFactoryName in interface JBossManagedConnectionPoolMBean
Returns:
the ManagedConnectionFactoryName value.

setManagedConnectionFactoryName

public void setManagedConnectionFactoryName(javax.management.ObjectName newManagedConnectionFactoryName)
Description copied from interface: JBossManagedConnectionPoolMBean
Set the ManagedConnectionFactoryName value.

Specified by:
setManagedConnectionFactoryName in interface JBossManagedConnectionPoolMBean
Parameters:
newManagedConnectionFactoryName - The new ManagedConnectionFactoryName value.

getAvailableConnectionCount

public long getAvailableConnectionCount()
Description copied from interface: JBossManagedConnectionPoolMBean
Get number of available free connections

Specified by:
getAvailableConnectionCount in interface JBossManagedConnectionPoolMBean
Returns:
number of available connections

getMaxConnectionsInUseCount

public long getMaxConnectionsInUseCount()
Specified by:
getMaxConnectionsInUseCount in interface JBossManagedConnectionPoolMBean

getInUseConnectionCount

public long getInUseConnectionCount()
Description copied from interface: JBossManagedConnectionPoolMBean
Get number of connections currently in use

Specified by:
getInUseConnectionCount in interface JBossManagedConnectionPoolMBean
Returns:
number of connections currently in use

getMinSize

public int getMinSize()
Description copied from interface: JBossManagedConnectionPoolMBean
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.

Specified by:
getMinSize in interface JBossManagedConnectionPoolMBean
Returns:
the MinSize value.

setMinSize

public void setMinSize(int newMinSize)
Description copied from interface: JBossManagedConnectionPoolMBean
Set the MinSize value.

Specified by:
setMinSize in interface JBossManagedConnectionPoolMBean
Parameters:
newMinSize - The new MinSize value.

getMaxSize

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

Specified by:
getMaxSize in interface JBossManagedConnectionPoolMBean
Returns:
the MaxSize value.

setMaxSize

public void setMaxSize(int newMaxSize)
Description copied from interface: JBossManagedConnectionPoolMBean
Set the MaxSize value.

Specified by:
setMaxSize in interface JBossManagedConnectionPoolMBean
Parameters:
newMaxSize - The new MaxSize value.

getBlockingTimeoutMillis

public int getBlockingTimeoutMillis()
Description copied from interface: JBossManagedConnectionPoolMBean
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.

Specified by:
getBlockingTimeoutMillis in interface JBossManagedConnectionPoolMBean
Returns:
the BlockingTimeout value.

setBlockingTimeoutMillis

public void setBlockingTimeoutMillis(int newBlockingTimeout)
Description copied from interface: JBossManagedConnectionPoolMBean
Set the BlockingTimeout value.

Specified by:
setBlockingTimeoutMillis in interface JBossManagedConnectionPoolMBean
Parameters:
newBlockingTimeout - The new BlockingTimeout value.

getIdleTimeoutMinutes

public long getIdleTimeoutMinutes()
Description copied from interface: JBossManagedConnectionPoolMBean
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.

Specified by:
getIdleTimeoutMinutes in interface JBossManagedConnectionPoolMBean
Returns:
the IdleTimeoutMinutes value.

setIdleTimeoutMinutes

public void setIdleTimeoutMinutes(long newIdleTimeoutMinutes)
Description copied from interface: JBossManagedConnectionPoolMBean
Set the IdleTimeoutMinutes value.

Specified by:
setIdleTimeoutMinutes in interface JBossManagedConnectionPoolMBean
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 String getCriteria()
Description copied from interface: JBossManagedConnectionPoolMBean
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)

Specified by:
getCriteria in interface JBossManagedConnectionPoolMBean
Returns:
the Criteria value.

setCriteria

public void setCriteria(String newCriteria)
Description copied from interface: JBossManagedConnectionPoolMBean
Set the Criteria value.

Specified by:
setCriteria in interface JBossManagedConnectionPoolMBean
Parameters:
newCriteria - The new Criteria value.

getNoTxSeparatePools

public boolean getNoTxSeparatePools()
Description copied from interface: JBossManagedConnectionPoolMBean
Separate pools for transactional use

Specified by:
getNoTxSeparatePools in interface JBossManagedConnectionPoolMBean
Returns:
true when connections should have different pools for transactional and non-transaction use.

setNoTxSeparatePools

public void setNoTxSeparatePools(boolean value)
Specified by:
setNoTxSeparatePools in interface JBossManagedConnectionPoolMBean

flush

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

Specified by:
flush in interface JBossManagedConnectionPoolMBean

getConnectionCount

public int getConnectionCount()
Description copied from interface: JBossManagedConnectionPoolMBean
Retrieve the connection count.

Specified by:
getConnectionCount in interface JBossManagedConnectionPoolMBean
Returns:
the connection count

getConnectionCreatedCount

public int getConnectionCreatedCount()
Description copied from interface: JBossManagedConnectionPoolMBean
Retrieve the connection created count.

Specified by:
getConnectionCreatedCount in interface JBossManagedConnectionPoolMBean
Returns:
the connection created count

getConnectionDestroyedCount

public int getConnectionDestroyedCount()
Description copied from interface: JBossManagedConnectionPoolMBean
Retrieve the destrooyed count.

Specified by:
getConnectionDestroyedCount in interface JBossManagedConnectionPoolMBean
Returns:
the destroyed count

getName

public String getName()
Specified by:
getName in interface org.jboss.system.ServiceMBean
Overrides:
getName in class org.jboss.system.ServiceMBeanSupport

startService

protected void startService()
                     throws Exception
Overrides:
startService in class org.jboss.system.ServiceMBeanSupport
Throws:
Exception

stopService

protected void stopService()
                    throws Exception
Overrides:
stopService in class org.jboss.system.ServiceMBeanSupport
Throws:
Exception

handleNotification

public void handleNotification(javax.management.Notification notification,
                               Object handback)
Specified by:
handleNotification in interface javax.management.NotificationListener


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.