001: /*
002: * This software is released under a licence similar to the Apache Software Licence.
003: * See org.logicalcobwebs.proxool.package.html for details.
004: * The latest version is available at http://proxool.sourceforge.net
005: */
006: package org.logicalcobwebs.proxool;
007:
008: import org.logicalcobwebs.proxool.util.FastArrayList;
009:
010: import java.util.Date;
011: import java.util.List;
012:
013: /**
014: * Implementation of ConnectionInfoIF. Unlike ConnectionPool it is
015: * frozen and will not change. Used with a {@link org.logicalcobwebs.proxool.admin.SnapshotIF snapshot}
016: *
017: * @version $Revision: 1.8 $, $Date: 2005/10/07 08:18:23 $
018: * @author bill
019: * @author $Author: billhorsman $ (current maintainer)
020: * @since Proxool 0.7
021: */
022: class ConnectionInfo implements ConnectionInfoIF {
023:
024: private Date birthDate;
025:
026: private long age;
027:
028: private long id;
029:
030: private int mark;
031:
032: private int status;
033:
034: private long timeLastStartActive;
035:
036: private long timeLastStopActive;
037:
038: private String requester;
039:
040: private String delegateDriver;
041:
042: private String delegateUrl;
043:
044: private String proxyHashcode;
045:
046: private String delegateHashcode;
047:
048: private List sqlCalls = new FastArrayList();
049:
050: public Date getBirthDate() {
051: return birthDate;
052: }
053:
054: public long getBirthTime() {
055: return birthDate.getTime();
056: }
057:
058: public void setBirthDate(Date birthDate) {
059: this .birthDate = birthDate;
060: }
061:
062: public long getAge() {
063: return age;
064: }
065:
066: public void setAge(long age) {
067: this .age = age;
068: }
069:
070: public long getId() {
071: return id;
072: }
073:
074: public void setId(long id) {
075: this .id = id;
076: }
077:
078: public int getMark() {
079: return mark;
080: }
081:
082: public void setMark(int mark) {
083: this .mark = mark;
084: }
085:
086: public int getStatus() {
087: return status;
088: }
089:
090: public void setStatus(int status) {
091: this .status = status;
092: }
093:
094: public long getTimeLastStartActive() {
095: return timeLastStartActive;
096: }
097:
098: public void setTimeLastStartActive(long timeLastStartActive) {
099: this .timeLastStartActive = timeLastStartActive;
100: }
101:
102: public long getTimeLastStopActive() {
103: return timeLastStopActive;
104: }
105:
106: public void setTimeLastStopActive(long timeLastStopActive) {
107: this .timeLastStopActive = timeLastStopActive;
108: }
109:
110: public String getRequester() {
111: return requester;
112: }
113:
114: public void setRequester(String requester) {
115: this .requester = requester;
116: }
117:
118: public String getDelegateDriver() {
119: return delegateDriver;
120: }
121:
122: public void setDelegateDriver(String delegateDriver) {
123: this .delegateDriver = delegateDriver;
124: }
125:
126: public String getDelegateUrl() {
127: return delegateUrl;
128: }
129:
130: public void setDelegateUrl(String delegateUrl) {
131: this .delegateUrl = delegateUrl;
132: }
133:
134: public String getProxyHashcode() {
135: return proxyHashcode;
136: }
137:
138: public void setProxyHashcode(String proxyHashcode) {
139: this .proxyHashcode = proxyHashcode;
140: }
141:
142: public String getDelegateHashcode() {
143: return delegateHashcode;
144: }
145:
146: public void setDelegateHashcode(String delegateHashcode) {
147: this .delegateHashcode = delegateHashcode;
148: }
149:
150: /**
151: * Compares using {@link #getId()}
152: * @param o must be another {@link ConnectionInfoIF} implementation
153: * @return the comparison
154: * @see Comparable#compareTo(Object)
155: */
156: public int compareTo(Object o) {
157: return new Long(((ConnectionInfoIF) o).getId())
158: .compareTo(new Long(getId()));
159: }
160:
161: public String[] getSqlCalls() {
162: return (String[]) sqlCalls.toArray(new String[0]);
163: }
164:
165: public void addSqlCall(String sqlCall) {
166: this .sqlCalls.add(sqlCall);
167: }
168: }
169:
170: /*
171: Revision history:
172: $Log: ConnectionInfo.java,v $
173: Revision 1.8 2005/10/07 08:18:23 billhorsman
174: 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)
175:
176: Revision 1.7 2005/09/26 10:01:31 billhorsman
177: Added lastSqlCall when trace is on.
178:
179: Revision 1.6 2003/10/30 00:05:50 billhorsman
180: now implements Comparable (using ID)
181:
182: Revision 1.5 2003/03/03 11:11:56 billhorsman
183: fixed licence
184:
185: Revision 1.4 2003/02/19 23:46:09 billhorsman
186: renamed monitor package to admin
187:
188: Revision 1.3 2003/02/12 12:28:27 billhorsman
189: added url, proxyHashcode and delegateHashcode to
190: ConnectionInfoIF
191:
192: Revision 1.2 2003/01/31 16:53:15 billhorsman
193: checkstyle
194:
195: Revision 1.1 2003/01/31 11:47:14 billhorsman
196: new snapshot of connection info
197:
198: */
|