KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sleepycat > je > txn > WriteLockInfo


1 /*-
2  * See the file LICENSE for redistribution information.
3  *
4  * Copyright (c) 2002,2006 Oracle. All rights reserved.
5  *
6  * $Id: WriteLockInfo.java,v 1.14 2006/11/03 19:30:46 cwl Exp $
7  */

8
9 package com.sleepycat.je.txn;
10
11 import com.sleepycat.je.utilint.DbLsn;
12
13 /*
14  * Lock and abort LSN kept for each write locked node. Allows us to log with
15  * the correct abort LSN.
16  */

17 public class WriteLockInfo {
18     /* Write lock for node. */
19     Lock lock;
20
21     /*
22      * The original LSN. This is stored in the LN log entry. May be null if
23      * the node was created by this transaction.
24      */

25     long abortLsn = DbLsn.NULL_LSN;
26
27     /*
28      * The original setting of the knownDeleted flag. It parallels abortLsn.
29      */

30     boolean abortKnownDeleted;
31
32     /*
33      * Size of the original log entry, or zero if abortLsn is NULL_LSN or if
34      * the size is not known.
35      */

36     int abortLogSize;
37
38     /*
39      * True if the node has never been locked before. Used so we can determine
40      * when to set abortLsn.
41      */

42     boolean neverLocked;
43
44     /*
45      * True if the node was created this transaction.
46      */

47     boolean createdThisTxn;
48
49     static final WriteLockInfo basicWriteLockInfo =
50     new WriteLockInfo();
51
52     WriteLockInfo(Lock lock) {
53     this.lock = lock;
54     abortLsn = DbLsn.NULL_LSN;
55     abortKnownDeleted = false;
56     neverLocked = true;
57     createdThisTxn = false;
58     }
59
60     /* public for Sizeof program. */
61     public WriteLockInfo() {
62     this.lock = null;
63     abortLsn = DbLsn.NULL_LSN;
64     abortKnownDeleted = true;
65     neverLocked = true;
66     createdThisTxn = false;
67     }
68
69     public boolean getAbortKnownDeleted() {
70     return abortKnownDeleted;
71     }
72
73     public long getAbortLsn() {
74     return abortLsn;
75     }
76
77     public void setAbortLogSize(int logSize) {
78         abortLogSize = logSize;
79     }
80 }
81
Popular Tags