KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sleepycat > je > TransactionStats


1 /*-
2  * See the file LICENSE for redistribution information.
3  *
4  * Copyright (c) 2000,2006 Oracle. All rights reserved.
5  *
6  * $Id: TransactionStats.java,v 1.27 2006/10/30 21:14:12 bostic Exp $
7  */

8
9 package com.sleepycat.je;
10
11 import java.io.Serializable JavaDoc;
12 import java.util.Date JavaDoc;
13
14 /**
15  * Javadoc for this public class is generated
16  * via the doc templates in the doc_src directory.
17  */

18 public class TransactionStats implements Serializable JavaDoc {
19
20     /**
21      * The time the last completed checkpoint finished (as the number
22      * of seconds since the Epoch, returned by the IEEE/ANSI Std
23      * 1003.1 (POSIX) time interface).
24      */

25     private long lastCheckpointTime;
26
27     /**
28      * The last transaction ID allocated.
29      */

30     private long lastTxnId;
31
32     /**
33      * The number of transactions that are currently active.
34      */

35     private int nActive;
36
37     /**
38      * The number of transactions that have begun.
39      */

40     private int nBegins;
41
42     /**
43      * The number of transactions that have aborted.
44      */

45     private int nAborts;
46
47     /**
48      * The number of transactions that have committed.
49      */

50     private int nCommits;
51
52     /**
53      * The number of XA transactions that have aborted.
54      */

55     private int nXAAborts;
56
57     /**
58      * The number of XA transactions that have been prepared.
59      */

60     private int nXAPrepares;
61
62     /**
63      * The number of XA transactions that have committed.
64      */

65     private int nXACommits;
66
67     /**
68      * The array of active transactions. Each element of the array is
69      * an object of type TransactionStats.Active.
70      */

71     private Active activeTxns[];
72
73     /**
74      * Internal use only.
75      */

76     public TransactionStats() {
77     }
78
79     /**
80      * The Active class represents an active transaction.
81      */

82     public static class Active implements Serializable JavaDoc {
83     /**
84      * The transaction ID of the transaction.
85      */

86     private long txnId;
87
88     /**
89      * The transaction ID of the parent transaction (or 0, if no parent).
90      */

91     private long parentId;
92
93         /**
94          * The transaction name, including the thread name if available.
95          */

96         private String JavaDoc name;
97
98         /**
99          * Javadoc for this public method is generated via
100          * the doc templates in the doc_src directory.
101          */

102         public long getId() {
103             return txnId;
104         }
105
106         /**
107          * Javadoc for this public method is generated via
108          * the doc templates in the doc_src directory.
109          */

110         public long getParentId() {
111             return parentId;
112         }
113
114         /**
115          * Javadoc for this public method is generated via
116          * the doc templates in the doc_src directory.
117          */

118         public String JavaDoc getName() {
119             return name;
120         }
121
122     /**
123      * Internal use only.
124      */

125         public Active(String JavaDoc name, long txnId, long parentId) {
126             this.name = name;
127             this.txnId = txnId;
128             this.parentId = parentId;
129         }
130
131     public String JavaDoc toString() {
132         return "txnId = " + txnId + " txnName = " + name;
133     }
134     }
135
136     /**
137      * Javadoc for this public method is generated via
138      * the doc templates in the doc_src directory.
139      */

140     public Active[] getActiveTxns() {
141         return activeTxns;
142     }
143
144     /**
145      * Javadoc for this public method is generated via
146      * the doc templates in the doc_src directory.
147      */

148     public long getLastCheckpointTime() {
149         return lastCheckpointTime;
150     }
151
152     /**
153      * Javadoc for this public method is generated via
154      * the doc templates in the doc_src directory.
155      */

156     public long getLastTxnId() {
157         return lastTxnId;
158     }
159
160     /**
161      * Javadoc for this public method is generated via
162      * the doc templates in the doc_src directory.
163      */

164     public int getNAborts() {
165         return nAborts;
166     }
167
168     /**
169      * Javadoc for this public method is generated via
170      * the doc templates in the doc_src directory.
171      */

172     public int getNXAAborts() {
173         return nXAAborts;
174     }
175
176     /**
177      * Javadoc for this public method is generated via
178      * the doc templates in the doc_src directory.
179      */

180     public int getNXAPrepares() {
181         return nXAPrepares;
182     }
183
184     /**
185      * Javadoc for this public method is generated via
186      * the doc templates in the doc_src directory.
187      */

188     public int getNActive() {
189         return nActive;
190     }
191
192     /**
193      * Javadoc for this public method is generated via
194      * the doc templates in the doc_src directory.
195      */

196     public int getNBegins() {
197         return nBegins;
198     }
199
200     /**
201      * Javadoc for this public method is generated via
202      * the doc templates in the doc_src directory.
203      */

204     public int getNCommits() {
205         return nCommits;
206     }
207
208     /**
209      * Javadoc for this public method is generated via
210      * the doc templates in the doc_src directory.
211      */

212     public int getNXACommits() {
213         return nXACommits;
214     }
215
216     /**
217      * Internal use only.
218      */

219     public void setActiveTxns(Active[] actives) {
220         activeTxns = actives;
221     }
222
223     /**
224      * Internal use only.
225      */

226     public void setLastCheckpointTime(long l) {
227         lastCheckpointTime = l;
228     }
229
230     /**
231      * Internal use only.
232      */

233     public void setLastTxnId(long val) {
234         lastTxnId = val;
235     }
236
237     /**
238      * Internal use only.
239      */

240     public void setNAborts(int val) {
241         nAborts = val;
242     }
243
244     /**
245      * Internal use only.
246      */

247     public void setNXAAborts(int val) {
248         nXAAborts = val;
249     }
250
251     /**
252      * Internal use only.
253      */

254     public void setNActive(int val) {
255         nActive = val;
256     }
257
258     /**
259      * Internal use only.
260      */

261     public void setNBegins(int val) {
262         nBegins = val;
263     }
264
265     /**
266      * Internal use only.
267      */

268     public void setNCommits(int val) {
269         nCommits = val;
270     }
271
272     /**
273      * Internal use only.
274      */

275     public void setNXACommits(int val) {
276         nXACommits = val;
277     }
278
279     /**
280      * Internal use only.
281      */

282     public void setNXAPrepares(int val) {
283         nXAPrepares = val;
284     }
285
286     /**
287      * Javadoc for this public method is generated via
288      * the doc templates in the doc_src directory.
289      */

290     public String JavaDoc toString() {
291         StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
292         sb.append("nBegins=").append(nBegins).append('\n');
293         sb.append("nAborts=").append(nAborts).append('\n');
294         sb.append("nCommits=").append(nCommits).append('\n');
295         sb.append("nXAPrepares=").append(nXAPrepares).append('\n');
296         sb.append("nXAAborts=").append(nXAAborts).append('\n');
297         sb.append("nXACommits=").append(nXACommits).append('\n');
298         sb.append("nActive=").append(nActive).append('\n');
299         sb.append("activeTxns=[");
300         if (activeTxns != null) {
301             for (int i = 0; i < activeTxns.length; i += 1) {
302                 sb.append(" ").append(activeTxns[i]).append('\n');
303             }
304         }
305         sb.append("]\n");
306         sb.append("lastTxnId=").append(lastTxnId).append('\n');
307         sb.append("lastCheckpointTime=").
308            append(new Date JavaDoc(lastCheckpointTime)).append('\n');
309         return sb.toString();
310     }
311 }
312
Popular Tags