Mercurial > hg > blitz_condensed
comparison src/org/dancres/blitz/notify/QueueEvent.java @ 0:3dc0c5604566
Initial checkin of blitz 2.0 fcs - no installer yet.
author | Dan Creswell <dan.creswell@gmail.com> |
---|---|
date | Sat, 21 Mar 2009 11:00:06 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:3dc0c5604566 |
---|---|
1 package org.dancres.blitz.notify; | |
2 | |
3 import org.dancres.blitz.txn.TxnState; | |
4 import org.dancres.blitz.mangler.MangledEntry; | |
5 import org.dancres.blitz.oid.OID; | |
6 | |
7 /** | |
8 <p>The event types break down into two classes - those that represent | |
9 an invisible/visible transition and those that represent an | |
10 unavailable/available transition. Here's a summary in table form:</p> | |
11 | |
12 <table summary="Visibility and Availability Transitions" border="0" cellspacing="2" cellpadding="1"> | |
13 <tr align="center" valign="middle"><th></th><th>Invisible/Visible</th><th>Unavailable/Available</th> | |
14 </tr> | |
15 <tr align="center" valign="middle"><th>ENTRY_WRITE</th> | |
16 <td>X</td> | |
17 <td>X</td> | |
18 </tr> | |
19 <tr align="center" valign="middle"><th>ENTRY_WRITTEN</th> | |
20 <td>X</td> | |
21 <td>X</td> | |
22 </tr> | |
23 <tr align="center" valign="middle"><th>ENTRY_VISIBLE</th> | |
24 <td>X</td> | |
25 <td>X</td> | |
26 </tr> | |
27 <tr align="center" valign="middle"><th>ENTRY_NOT_CONFLICTED</th> | |
28 <td>O</td> | |
29 <td>X</td> | |
30 </tr> | |
31 </table> | |
32 | |
33 @see org.dancres.blitz.notify.EventQueue | |
34 */ | |
35 public class QueueEvent { | |
36 /** | |
37 Context object is null | |
38 */ | |
39 public static final int TRANSACTION_ENDED = 1; | |
40 | |
41 /** | |
42 Context object is a MangledEntry plus OID - | |
43 this event is triggered when a transaction initially writes a new Entry | |
44 */ | |
45 public static final int ENTRY_WRITE = 2; | |
46 | |
47 /** | |
48 Context object is a MangledEntry plus OID - | |
49 this event is triggered when a transaction commits a write. | |
50 */ | |
51 public static final int ENTRY_WRITTEN = 3; | |
52 | |
53 /** | |
54 Context object is a MangledEntry plus OID - this event is triggered in | |
55 the case where a take has been aborted and thus an Entry has been deemed | |
56 visible again. | |
57 */ | |
58 public static final int ENTRY_VISIBLE = 4; | |
59 | |
60 /** | |
61 Context object is a MangledEntry plus OID - this event is triggered in | |
62 the case where an Entry was previously conflicted with a collection of | |
63 read locks and has since been made available for a take again. | |
64 Note, if the Entry was write locked, we don't generate this event | |
65 as it'll result from the ENTRY_WRITTEN event. Note also we don't | |
66 generate this event if the Entry is marked as taken/deleted (obviously) | |
67 */ | |
68 public static final int ENTRY_NOT_CONFLICTED = 5; | |
69 | |
70 private int theType; | |
71 private TxnState theTxn; | |
72 private Context theContext; | |
73 | |
74 public QueueEvent(int aType, TxnState aTxn, Context aContext) { | |
75 theType = aType; | |
76 theTxn = aTxn; | |
77 theContext = aContext; | |
78 } | |
79 | |
80 public int getType() { | |
81 return theType; | |
82 } | |
83 | |
84 public TxnState getTxn() { | |
85 return theTxn; | |
86 } | |
87 | |
88 public Context getContext() { | |
89 return theContext; | |
90 } | |
91 | |
92 public static class Context { | |
93 private MangledEntry _entry; | |
94 private OID _oid; | |
95 | |
96 public Context(MangledEntry anEntry, OID anOID) { | |
97 _oid = anOID; | |
98 _entry = anEntry; | |
99 } | |
100 | |
101 public MangledEntry getEntry() { | |
102 return _entry; | |
103 } | |
104 | |
105 public OID getOID() { | |
106 return _oid; | |
107 } | |
108 } | |
109 } |