KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > logicalcobwebs > proxool > ConnectionInfoIF


1 /*
2  * This software is released under a licence similar to the Apache Software Licence.
3  * See org.logicalcobwebs.proxool.package.html for details.
4  * The latest version is available at http://proxool.sourceforge.net
5  */

6 package org.logicalcobwebs.proxool;
7
8 import java.util.Date JavaDoc;
9
10
11 /**
12  * Provides information about an individual connection. You can get a collection
13  * of these from {@link ProxoolFacade#getConnectionInfos ProxoolFacade}. You
14  * get back information about all the connections in a particular pool.
15  *
16  * <pre>
17  * String alias = "myPool";
18  * Iterator i = ProxoolFacade.getConnectionInfos(alias).iterator();
19  * while (i.hasNext()) {
20  * ConnectionInfoIF c = (ConnectionInfoIF)i.next();
21  * ...
22  * }
23  * </pre>
24  *
25  * @version $Revision: 1.12 $, $Date: 2005/10/07 08:18:23 $
26  * @author billhorsman
27  * @author $Author: billhorsman $ (current maintainer)
28  */

29 public interface ConnectionInfoIF extends Comparable JavaDoc {
30
31     /**
32      * Default - treat as normal
33      * @see #getMark
34      */

35     static final int MARK_FOR_USE = 0;
36
37     /**
38      * The next time this connection is made available we should expire it.
39      * @see #getMark
40      */

41     static final int MARK_FOR_EXPIRY = 1;
42
43     /**
44      * This is the start and end state of every connection
45      * @see #getStatus
46      */

47     static final int STATUS_NULL = 0;
48
49     /**
50      * The connection is available for use
51      * @see #getStatus
52      */

53     static final int STATUS_AVAILABLE = 1;
54
55     /**
56      * The connection is in use
57      * @see #getStatus
58      */

59     static final int STATUS_ACTIVE = 2;
60
61     /**
62      * The connection is in use by the house keeping thread
63      * @see #getStatus
64      */

65     static final int STATUS_OFFLINE = 3;
66
67     /**
68      * The time that this connection was created.
69      * The number of milliseconds
70      * since midnight, January 1, 1970 UTC.
71      */

72     long getBirthTime();
73
74     /**
75      * Like {@link #getBirthTime} but in Date format
76      * @return birthDate
77      */

78     Date JavaDoc getBirthDate();
79
80     /**
81      * The age in millseconds since this connection was built
82      */

83     long getAge();
84
85     /**
86      * A unique ID for this connection
87      */

88     long getId();
89
90     /**
91      * Sometimes we want do something to a connection but can't because it is still
92      * active and we don't want to disrupt its use. So we mark it instead and when it
93      * stops being active we can perform the necessary operation.
94      *
95      * The only thing we do at the moment is {@link #MARK_FOR_EXPIRY expire} the
96      * connection (if it is too old for instance). And this will happen if the
97      * housekeeper decides it should but the connection is still active.
98      */

99     int getMark();
100
101     /**
102      * The status of the connection. Can be either:
103      * {@link #STATUS_NULL null},
104      * {@link #STATUS_AVAILABLE available},
105      * {@link #STATUS_ACTIVE active} or
106      * {@link #STATUS_OFFLINE offline}.
107      */

108     int getStatus();
109
110     /**
111      * When this connection was last given out. The number of milliseconds
112      * since midnight, January 1, 1970 UTC.
113      */

114     long getTimeLastStartActive();
115
116     /**
117      * When this connection was last given back (or zero if it is still active).
118      * The number of milliseconds
119      * since midnight, January 1, 1970 UTC.
120      */

121     long getTimeLastStopActive();
122
123     /**
124      * The name of the thread that asked for this connection.
125      */

126     String JavaDoc getRequester();
127
128     /**
129      * The hashcode (in hex) of the ProxyConnection object. This
130      * uniquely identifies this proxy connection.
131      * @return proxyHashcode
132      */

133     String JavaDoc getProxyHashcode();
134
135     /**
136      * The hashcode (in hex) of the delegate connection object. This
137      * uniquely identifies the underlying connection.
138      * @return delegateHashcode
139      */

140     String JavaDoc getDelegateHashcode();
141
142     /**
143      * The URL that this connection is using (the definition
144      * might have changed since this connection was built).
145      * @return delegateUrl
146      */

147     String JavaDoc getDelegateUrl();
148
149     /**
150      * A log of the last SQL used on this connection. Only populated
151      * if {@link org.logicalcobwebs.proxool.ConnectionPoolDefinitionIF#isTrace()}
152      * is enabled.
153      * @return the most recent SQL to be used
154      */

155     String JavaDoc[] getSqlCalls();
156     
157 }
158
159 /*
160  Revision history:
161  $Log: ConnectionInfoIF.java,v $
162  Revision 1.12 2005/10/07 08:18:23 billhorsman
163  New sqlCalls gives list of SQL calls rather than just he most recent (for when a connection makes more than one call before being returned to the pool)
164
165  Revision 1.11 2005/09/26 10:01:31 billhorsman
166  Added lastSqlCall when trace is on.
167
168  Revision 1.10 2003/10/30 00:05:50 billhorsman
169  now implements Comparable (using ID)
170
171  Revision 1.9 2003/03/03 11:11:57 billhorsman
172  fixed licence
173
174  Revision 1.8 2003/02/12 12:28:27 billhorsman
175  added url, proxyHashcode and delegateHashcode to
176  ConnectionInfoIF
177
178  Revision 1.7 2003/01/31 11:38:57 billhorsman
179  birthDate now stored as Date not long
180
181  Revision 1.6 2003/01/27 18:26:35 billhorsman
182  refactoring of ProxyConnection and ProxyStatement to
183  make it easier to write JDK 1.2 patch
184
185  Revision 1.5 2003/01/15 00:12:13 billhorsman
186  doc
187
188  Revision 1.4 2002/12/15 19:21:42 chr32
189  Changed @linkplain to @link (to preserve JavaDoc for 1.2/1.3 users).
190
191  Revision 1.3 2002/10/25 16:00:19 billhorsman
192  added better class javadoc
193
194  Revision 1.2 2002/09/18 13:48:56 billhorsman
195  checkstyle and doc
196
197  Revision 1.1.1.1 2002/09/13 08:12:32 billhorsman
198  new
199
200  Revision 1.3 2002/06/28 11:19:47 billhorsman
201  improved doc
202
203 */

204
Popular Tags