Mercurial > hg > blitz_condensed
comparison src/org/dancres/blitz/notify/EventGenerator.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 net.jini.space.JavaSpace; | |
4 | |
5 import org.dancres.blitz.txn.TxnId; | |
6 | |
7 import org.dancres.blitz.mangler.MangledEntry; | |
8 | |
9 import org.dancres.blitz.oid.OID; | |
10 | |
11 /** | |
12 <p> Represents a single registration via notify. If it's transactional, | |
13 it will never be saved as it's considered temporary. If it's transactional | |
14 it will be saved to disk. In addition, it's state will be saved to the | |
15 log periodically (on a number of allocations basis) to preserve data | |
16 in case of a crash. <p> | |
17 | |
18 <p> This class uses notifyPreparer to do initial preparation of the | |
19 passed RemoteEventListener when constructed from scratch (i.e. it's a new | |
20 registration). It uses recoveredNotifyPreparer in those cases where it | |
21 has been de-serialized from storage and is about to be used for the first | |
22 time post a restart </p> | |
23 | |
24 <p> Instances of this object can be "tainted" for various reasons including | |
25 certain kinds of exception from the remote notify implementation, lease | |
26 expiry or transaction commit. Tainting prevents any further operations | |
27 against this instance such as event dispatch, logging changes to disk and | |
28 lease renewal. Tainting also results in cleanup for the registration being | |
29 scheduled.</p> | |
30 */ | |
31 public interface EventGenerator { | |
32 public void assign(OID anOID); | |
33 | |
34 public long getStartSeqNum(); | |
35 | |
36 public OID getId(); | |
37 | |
38 public boolean isPersistent(); | |
39 | |
40 public long getSourceId(); | |
41 | |
42 /** | |
43 Once an EventGenerator becomes tainted it will generate no more events | |
44 and schedule cleanup. | |
45 */ | |
46 public void taint(); | |
47 | |
48 /* ******************************************************************** | |
49 Event filtering starts here | |
50 **********************************************************************/ | |
51 | |
52 /** | |
53 Determines whether the passed QueueEvent is "visible" to this | |
54 EventGenerator. This is determind by checking transaction id's, expiry | |
55 and that the generator isn't "tainted" | |
56 */ | |
57 public boolean canSee(QueueEvent anEvent, long aTime); | |
58 | |
59 /** | |
60 * @return a handback to use in the send event or null indicating no match | |
61 */ | |
62 public boolean matches(MangledEntry anEntry); | |
63 | |
64 /* ******************************************************************** | |
65 Lease management starts here | |
66 **********************************************************************/ | |
67 | |
68 public boolean renew(long aTime); | |
69 | |
70 /* ******************************************************************** | |
71 Recovery starts here | |
72 **********************************************************************/ | |
73 | |
74 public void recover(long aSeqNum); | |
75 | |
76 /** | |
77 Jumps the sequence number by the RESTART_JUMP | |
78 */ | |
79 public long jumpSequenceNumber(); | |
80 | |
81 /** | |
82 Jumps the sequence number if it's not already at this minimum. | |
83 */ | |
84 public long jumpSequenceNumber(long aMin); | |
85 | |
86 | |
87 /* ******************************************************************** | |
88 Event Generation starts here | |
89 **********************************************************************/ | |
90 | |
91 /** | |
92 Dispatches a remote event to a client using the passed source. | |
93 */ | |
94 public void ping(QueueEvent anEvent, JavaSpace aSource); | |
95 | |
96 /* ******************************************************************** | |
97 State save/recovery starts here | |
98 **********************************************************************/ | |
99 | |
100 public EventGeneratorState getMemento(); | |
101 } |