KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > versant > core > jdbc > logging > JdbcPoolEvent


1
2 /*
3  * Copyright (c) 1998 - 2005 Versant Corporation
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v1.0
6  * which accompanies this distribution, and is available at
7  * http://www.eclipse.org/legal/epl-v10.html
8  *
9  * Contributors:
10  * Versant Corporation - initial API and implementation
11  */

12 package com.versant.core.jdbc.logging;
13
14 /**
15  * Event logged for connection pool operations.
16  */

17 public class JdbcPoolEvent extends JdbcLogEvent {
18
19     private int connectionID;
20     private int maxActive;
21     private int active;
22     private int maxIdle;
23     private int idle;
24     private boolean highPriority;
25     private boolean autoCommit;
26
27     public JdbcPoolEvent(long txId, int type, boolean highPriority) {
28         super(txId, type, null);
29         this.highPriority = highPriority;
30     }
31
32     public void update(int maxActive, int active, int maxIdle, int idle) {
33         updateTotalMs();
34         this.maxActive = maxActive;
35         this.active = active;
36         this.maxIdle = maxIdle;
37         this.idle = idle;
38     }
39
40     public String JavaDoc getDescription() {
41         if (maxActive == 0) return "Busy ...";
42         if (descr == null) {
43             descr = "active " + active + "/" + maxActive +
44                     " idle " + 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 }
90
Popular Tags