001: /*
002: * JBoss, Home of Professional Open Source.
003: * Copyright 2006, Red Hat Middleware LLC, and individual contributors
004: * as indicated by the @author tags. See the copyright.txt file in the
005: * distribution for a full listing of individual contributors.
006: *
007: * This is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU Lesser General Public License as
009: * published by the Free Software Foundation; either version 2.1 of
010: * the License, or (at your option) any later version.
011: *
012: * This software is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of
014: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
015: * Lesser General Public License for more details.
016: *
017: * You should have received a copy of the GNU Lesser General Public
018: * License along with this software; if not, write to the Free
019: * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020: * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
021: */
022: package org.jboss.resource.connectionmanager;
023:
024: import javax.resource.ResourceException;
025: import javax.resource.spi.ConnectionRequestInfo;
026: import javax.resource.spi.ManagedConnectionFactory;
027: import javax.security.auth.Subject;
028: import javax.transaction.Transaction;
029:
030: /**
031: * A managed connection pool
032: *
033: * @author <a href="mailto:d_jencks@users.sourceforge.net">David Jencks</a>
034: * @author <a href="mailto:weston.price@jboss.org>Weston Price</a>
035: *
036: * @version $Revision: 57747 $
037: */
038: public interface ManagedConnectionPool {
039: /**
040: * Retrieve the managed connection factory for this pool
041: *
042: * @return the managed connection factory
043: */
044: ManagedConnectionFactory getManagedConnectionFactory();
045:
046: /**
047: * Set the connection listener factory
048: *
049: * @param clf the connection event listener factory
050: */
051: void setConnectionListenerFactory(ConnectionListenerFactory clf);
052:
053: /**
054: * Get a connection
055: *
056: * @param trackByTransaction for transaction stickiness
057: * @param subject the subject for connection
058: * @param cri the connection request information
059: * @return a connection event listener wrapping the connection
060: * @throws ResourceException for any error
061: */
062: ConnectionListener getConnection(Transaction trackByTransaction,
063: Subject subject, ConnectionRequestInfo cri)
064: throws ResourceException;
065:
066: /**
067: * Return a connection
068: *
069: * @param cl the connection event listener wrapping the connection
070: * @param kill whether to destroy the managed connection
071: * @throws ResourceException for any error
072: */
073: void returnConnection(ConnectionListener cl, boolean kill)
074: throws ResourceException;
075:
076: /**
077: * @return the connection count
078: */
079: int getConnectionCount();
080:
081: /**
082: * @return the connections in use count
083: */
084: int getInUseConnectionCount();
085:
086: /**
087: * @return the connections created count
088: */
089: int getConnectionCreatedCount();
090:
091: /**
092: * @return the connections destroyed count
093: */
094: int getConnectionDestroyedCount();
095:
096: /**
097: * shutdown the pool
098: */
099: void shutdown();
100:
101: /**
102: * @return the available connections
103: */
104: long getAvailableConnectionCount();
105:
106: /**
107: * @return the available connections
108: */
109: int getMaxConnectionsInUseCount();
110:
111: /**
112: * flush the pool
113: */
114: void flush();
115:
116: }
|