KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > sapia > soto > hibernate > CallStack


1 package org.sapia.soto.hibernate;
2
3
4 /**
5  * @author Yanick Duchesne
6  * <dl>
7  * <dt><b>Copyright:</b><dd>Copyright &#169; 2002-2003 <a HREF="http://www.sapia-oss.org">Sapia Open Source Software</a>. All Rights Reserved.</dd></dt>
8  * <dt><b>License:</b><dd>Read the license.txt file of the jar or visit the
9  * <a HREF="http://www.sapia-oss.org/license.html">license page</a> at the Sapia OSS web site</dd></dt>
10  * </dl>
11  */

12 class CallStack {
13   private Level _level;
14   private int _count;
15
16   CallStack() {
17   }
18
19   void acquire(Level lvl) {
20     if (_level.getLevel() != Level.WRITE.getLevel()) {
21       _level = lvl;
22     }
23
24     _count++;
25   }
26
27   Level getLevel() {
28     return _level;
29   }
30
31   boolean release() {
32     _count--;
33
34     return _count <= 0;
35   }
36 }
37
Popular Tags