Mercurial > hg > blitz_condensed
annotate src/org/dancres/blitz/EntryTxnOp.java @ 34:6f68e94c1fb8 default tip
Add CondensedStats monitoring utility, equivalent to vmstat
author | Dominic Cleal <dominic-cleal@cdo2.com> |
---|---|
date | Thu, 05 Aug 2010 11:07:25 +0100 |
parents | 3dc0c5604566 |
children |
rev | line source |
---|---|
0
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
1 package org.dancres.blitz; |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
2 |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
3 import java.io.IOException; |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
4 |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
5 import org.dancres.blitz.mangler.MangledEntry; |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
6 |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
7 import org.dancres.blitz.entry.OpInfo; |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
8 |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
9 import org.dancres.blitz.txn.TxnOp; |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
10 import org.dancres.blitz.txn.TxnState; |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
11 |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
12 import org.dancres.blitz.txnlock.*; |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
13 |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
14 import org.dancres.blitz.notify.QueueEvent; |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
15 import org.dancres.blitz.notify.EventQueue; |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
16 |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
17 /** |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
18 Each operation against an Entry is represented by an instance of this class. |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
19 These are stored in <code>TxnState</code> instances and constitute part of |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
20 the record of operations performed by a particular transaction. |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
21 |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
22 @see org.dancres.blitz.txn.TxnState |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
23 |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
24 @todo As postEvent happens before txnlock is released one can get |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
25 temporary conflicts which could be alleviated if txnlock was released first |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
26 but to do this would mean needing a snapshot of txnlock state from before |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
27 the release was performed. |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
28 */ |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
29 class EntryTxnOp implements TxnOp { |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
30 static final long serialVersionUID = -347168809827671347L; |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
31 |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
32 /** |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
33 Required when we figure out what lock type to assert. |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
34 Lock is transient because it's a memory only structure so we will |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
35 have to recover it if necessary. |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
36 */ |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
37 private int theOp; |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
38 private OpInfo theInfo; |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
39 |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
40 private transient TxnLock theTxnLock; |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
41 |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
42 EntryTxnOp(OpInfo anInfo) { |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
43 theInfo = anInfo; |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
44 } |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
45 |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
46 EntryTxnOp(int anOp, OpInfo anInfo, TxnLock aLock) { |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
47 theOp = anOp; |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
48 theInfo = anInfo; |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
49 theTxnLock = aLock; |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
50 } |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
51 |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
52 public void restore(TxnState aState) throws IOException { |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
53 if (theInfo.isDebugOp()) |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
54 return; |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
55 |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
56 theInfo.restore(); |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
57 |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
58 LockMgr myMgr = TxnLocks.getLockMgr(theInfo.getType()); |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
59 theTxnLock = myMgr.getLock(theInfo.getOID()); |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
60 |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
61 synchronized(theTxnLock) { |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
62 theTxnLock.acquire(aState, theOp, null, null, true); |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
63 } |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
64 } |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
65 |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
66 public void commit(TxnState aState) throws IOException { |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
67 if (theInfo.isDebugOp()) |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
68 return; |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
69 |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
70 MangledEntry myEntry = theInfo.commit(aState); |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
71 |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
72 postEvent(aState, myEntry, true); |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
73 |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
74 theTxnLock.release(aState, theOp); |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
75 } |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
76 |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
77 public void abort(TxnState aState) throws IOException { |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
78 if (theInfo.isDebugOp()) |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
79 return; |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
80 |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
81 MangledEntry myEntry = theInfo.abort(aState); |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
82 |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
83 postEvent(aState, myEntry, false); |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
84 |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
85 theTxnLock.release(aState, theOp); |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
86 } |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
87 |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
88 public String toString() { |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
89 return theInfo.toString(); |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
90 } |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
91 |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
92 private void postEvent(TxnState aState, MangledEntry anEntry, |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
93 boolean isCommit) { |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
94 |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
95 // No Entry means no Event - if Entry is present, we then need to |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
96 // figure out whether or not we generate an event based on commit/abort |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
97 // and the kind of operation |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
98 if (anEntry == null) |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
99 return; |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
100 |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
101 switch (theOp) { |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
102 case TxnLock.READ : { |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
103 if (theTxnLock.hasOnly(aState.getId(), TxnLock.READ)) { |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
104 // Entry still exists and we are the last outstanding |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
105 // read - which means we resolve a conflict |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
106 QueueEvent myEvent = |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
107 new QueueEvent(QueueEvent.ENTRY_NOT_CONFLICTED, aState, |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
108 new QueueEvent.Context(anEntry, |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
109 theInfo.getOID())); |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
110 |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
111 EventQueue.get().add(myEvent); |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
112 } |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
113 |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
114 break; |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
115 } |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
116 |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
117 case TxnLock.DELETE : { |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
118 if (!isCommit) { |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
119 // We're aborting a take, if we wrote this Entry |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
120 // we shouldn't generate an Event |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
121 if (!theTxnLock.hasWriter(aState.getId())) { |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
122 QueueEvent myEvent = |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
123 new QueueEvent(QueueEvent.ENTRY_VISIBLE, aState, |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
124 new QueueEvent.Context(anEntry, |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
125 theInfo.getOID())); |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
126 |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
127 EventQueue.get().add(myEvent); |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
128 } |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
129 } |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
130 break; |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
131 } |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
132 |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
133 /** |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
134 * If we've been doing a write, the Entry is pinned and cannot |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
135 * be flushed from cache thus even if it becomes lease expired |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
136 * it will be present in cache when we query it. |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
137 */ |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
138 case TxnLock.WRITE : { |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
139 if (isCommit) { |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
140 // If we're commiting a write, an Entry became visible |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
141 QueueEvent myEvent = |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
142 new QueueEvent(QueueEvent.ENTRY_WRITTEN, |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
143 aState, |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
144 new QueueEvent.Context(anEntry, theInfo.getOID())); |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
145 EventQueue.get().add(myEvent); |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
146 } |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
147 break; |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
148 } |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
149 } |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
150 } |
3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
Dan Creswell <dan.creswell@gmail.com>
parents:
diff
changeset
|
151 } |