KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > resource > connectionmanager > ManagedConnectionPool


1 /*
2 * JBoss, Home of Professional Open Source
3 * Copyright 2005, JBoss Inc., and individual contributors as indicated
4 * by the @authors tag. See the copyright.txt in the distribution for a
5 * full listing of individual contributors.
6 *
7 * This is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as
9 * published by the Free Software Foundation; either version 2.1 of
10 * the License, or (at your option) any later version.
11 *
12 * This software is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this software; if not, write to the Free
19 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
20 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
21 */

22 package org.jboss.resource.connectionmanager;
23
24 import javax.resource.ResourceException JavaDoc;
25 import javax.resource.spi.ConnectionRequestInfo JavaDoc;
26 import javax.resource.spi.ManagedConnectionFactory JavaDoc;
27 import javax.security.auth.Subject JavaDoc;
28 import javax.transaction.Transaction JavaDoc;
29
30 /**
31  * A managed connection pool
32  *
33  * @author <a HREF="mailto:d_jencks@users.sourceforge.net">David Jencks</a>
34  * @version $Revision: 37459 $
35  */

36 public interface ManagedConnectionPool
37 {
38    /**
39     * Retrieve the managed connection factory for this pool
40     *
41     * @return the managed connection factory
42     */

43    ManagedConnectionFactory JavaDoc getManagedConnectionFactory();
44
45    /**
46     * Set the connection listener factory
47     *
48     * @param clf the connection event listener factory
49     */

50    void setConnectionListenerFactory(ConnectionListenerFactory clf);
51
52    /**
53     * Get a connection
54     *
55     * @param trackByTransaction for transaction stickiness
56     * @param subject the subject for connection
57     * @param cri the connection request information
58     * @return a connection event listener wrapping the connection
59     * @throws ResourceException for any error
60     */

61    ConnectionListener getConnection(Transaction JavaDoc trackByTransaction, Subject JavaDoc subject, ConnectionRequestInfo JavaDoc cri)
62       throws ResourceException JavaDoc;
63
64    /**
65     * Return a connection
66     *
67     * @param cl the connection event listener wrapping the connection
68     * @param kill whether to destroy the managed connection
69     * @throws ResourceException for any error
70     */

71    void returnConnection(ConnectionListener cl, boolean kill)
72       throws ResourceException JavaDoc;
73
74    /**
75     * @return the connection count
76     */

77    int getConnectionCount ();
78
79    /**
80     * @return the connections in use count
81     */

82    int getInUseConnectionCount();
83
84    /**
85     * @return the connections created count
86     */

87    int getConnectionCreatedCount();
88
89    /**
90     * @return the connections destroyed count
91     */

92    int getConnectionDestroyedCount();
93
94    /**
95     * shutdown the pool
96     */

97    void shutdown();
98
99    /**
100     * @return the available connections
101     */

102    long getAvailableConnectionCount();
103
104    /**
105     * @return the available connections
106     */

107    int getMaxConnectionsInUseCount();
108
109    /**
110     * flush the pool
111     */

112    void flush();
113
114 }
115
Popular Tags