KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sleepycat > je > latch > LatchStats


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

8
9 package com.sleepycat.je.latch;
10
11 import java.io.Serializable JavaDoc;
12
13 /**
14  * A class that provides interesting stats about a particular latch.
15  */

16 public class LatchStats implements Cloneable JavaDoc, Serializable JavaDoc {
17
18     public int nAcquiresNoWaiters = 0;
19
20     /**
21      * Number of times acquire() was called when the latch was already owned by
22      * the caller.
23      */

24     public int nAcquiresSelfOwned = 0;
25
26     /**
27      * Number of times acquire() was called with allowNesting=true when the
28      * latch was already owned by the caller for shared access.
29      */

30     public int nAcquiresUpgrade = 0;
31
32     /**
33      * Number of times acquire() was called when the latch was already owned by
34      * the some other thread.
35      */

36     public int nAcquiresWithContention = 0;
37
38     /**
39      * Number of times acquireNoWait() was called when the latch was
40      * successfully acquired.
41      */

42     public int nAcquireNoWaitSuccessful = 0;
43
44     /**
45      * Number of unsuccessful acquireNoWait() calls.
46      */

47     public int nAcquireNoWaitUnsuccessful = 0;
48
49     /**
50      * Number of times acquireShared() was called when the latch was
51      * successfully acquired.
52      */

53     public int nAcquireSharedSuccessful = 0;
54
55     /**
56      * Numbed of calls to release();
57      */

58     public int nReleases = 0;
59
60     public String JavaDoc toString() {
61         StringBuffer JavaDoc sb = new StringBuffer JavaDoc();
62         sb.append("nAcquiresNoWaiters=").
63         append(nAcquiresNoWaiters).append('\n');
64         sb.append("nAcquiresSelfOwned=").
65         append(nAcquiresSelfOwned).append('\n');
66         sb.append("nAcquiresUpgrade=").
67         append(nAcquiresUpgrade).append('\n');
68         sb.append("nAcquiresWithContention=").
69         append(nAcquiresWithContention).append('\n');
70         sb.append("nAcquiresNoWaitSuccessful=").
71         append(nAcquireNoWaitSuccessful).append('\n');
72         sb.append("nAcquiresNoWaitUnSuccessful=").
73         append(nAcquireNoWaitUnsuccessful).append('\n');
74         sb.append("nAcquiresSharedSuccessful=").
75         append(nAcquireSharedSuccessful).append('\n');
76         return sb.toString();
77     }
78
79     public Object JavaDoc clone()
80         throws CloneNotSupportedException JavaDoc {
81         return super.clone();
82     }
83 }
84
Popular Tags