01: /*
02: * Copyright (c) 1998 - 2005 Versant Corporation
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * Versant Corporation - initial API and implementation
10: */
11: package com.versant.core.jdbc.logging;
12:
13: /**
14: * Event logged for connection pool operations.
15: */
16: public class JdbcPoolEvent extends JdbcLogEvent {
17:
18: private int connectionID;
19: private int maxActive;
20: private int active;
21: private int maxIdle;
22: private int idle;
23: private boolean highPriority;
24: private boolean autoCommit;
25:
26: public JdbcPoolEvent(long txId, int type, boolean highPriority) {
27: super (txId, type, null);
28: this .highPriority = highPriority;
29: }
30:
31: public void update(int maxActive, int active, int maxIdle, int idle) {
32: updateTotalMs();
33: this .maxActive = maxActive;
34: this .active = active;
35: this .maxIdle = maxIdle;
36: this .idle = idle;
37: }
38:
39: public String getDescription() {
40: if (maxActive == 0)
41: return "Busy ...";
42: if (descr == null) {
43: descr = "active " + active + "/" + maxActive + " idle "
44: + idle + "/" + maxIdle + (autoCommit ? " AC" : "");
45: }
46: return descr;
47: }
48:
49: public boolean isAutoCommit() {
50: return autoCommit;
51: }
52:
53: public void setAutoCommit(boolean autoCommit) {
54: this .autoCommit = autoCommit;
55: }
56:
57: public void setConnectionID(int connectionID) {
58: this .connectionID = connectionID;
59: }
60:
61: public int getConnectionID() {
62: return connectionID;
63: }
64:
65: public int getResourceID() {
66: return connectionID;
67: }
68:
69: public boolean isHighPriority() {
70: return highPriority;
71: }
72:
73: public int getMaxActive() {
74: return maxActive;
75: }
76:
77: public int getActive() {
78: return active;
79: }
80:
81: public int getMaxIdle() {
82: return maxIdle;
83: }
84:
85: public int getIdle() {
86: return idle;
87: }
88:
89: }
|