comparison src/org/dancres/blitz/remote/txn/TxnMgrProxy.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.remote.txn;
2
3 import java.rmi.RemoteException;
4 import java.io.Serializable;
5
6 import net.jini.core.transaction.server.TransactionManager;
7 import net.jini.core.transaction.server.TransactionParticipant;
8 import net.jini.core.transaction.server.CrashCountException;
9 import net.jini.core.transaction.*;
10 import net.jini.core.lease.LeaseDeniedException;
11 import net.jini.id.Uuid;
12 import net.jini.id.ReferentUuids;
13 import net.jini.id.ReferentUuid;
14
15 /**
16 */
17 public class TxnMgrProxy implements TransactionManager,
18 Serializable, ReferentUuid {
19 private TransactionManager theStub;
20 private Uuid theUuid;
21
22 public TxnMgrProxy(TransactionManager aStub, Uuid aUuid) {
23 theStub = aStub;
24 theUuid = aUuid;
25 }
26
27 public Created create(long l) throws LeaseDeniedException, RemoteException {
28 return theStub.create(l);
29 }
30
31 public void join(long l, TransactionParticipant transactionParticipant, long l1)
32 throws UnknownTransactionException, CannotJoinException,
33 CrashCountException, RemoteException {
34
35 /*
36 Do nothing - this is a loopback transaction and join is never done
37 because we internally inject a transaction via the loopback txnmgr
38 on the server-side so we can simply return.
39 */
40 }
41
42 public int getState(long l) throws UnknownTransactionException, RemoteException {
43 /*
44 Do nothing - this is a loopback transaction and getState is only
45 done internally and will be routed via the stub which was injected
46 via the loopback txnmgr on the server-side
47 */
48
49 throw new RemoteException("Shouldn't ever be called - we're a loopback proxy");
50 }
51
52 public void commit(long l) throws UnknownTransactionException,
53 CannotCommitException, RemoteException {
54 theStub.commit(l);
55 }
56
57 public void commit(long l, long l1) throws UnknownTransactionException,
58 CannotCommitException, TimeoutExpiredException, RemoteException {
59 theStub.commit(l, l1);
60 }
61
62 public void abort(long l) throws UnknownTransactionException,
63 CannotAbortException, RemoteException {
64 theStub.abort(l);
65 }
66
67 public void abort(long l, long l1) throws UnknownTransactionException,
68 CannotAbortException, TimeoutExpiredException, RemoteException {
69 theStub.abort(l, l1);
70 }
71
72 public Uuid getReferentUuid() {
73 return theUuid;
74 }
75
76 public boolean equals(Object anObject) {
77 return ReferentUuids.compare(this, anObject);
78 }
79
80 public int hashCode() {
81 return theUuid.hashCode();
82 }
83
84 public String toString() {
85 return theStub.toString() + ", " + theUuid.toString();
86 }
87 }