Mercurial > hg > blitz_condensed
diff src/org/dancres/blitz/remote/TxnGatewayImpl.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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/org/dancres/blitz/remote/TxnGatewayImpl.java Sat Mar 21 11:00:06 2009 +0000 @@ -0,0 +1,40 @@ +package org.dancres.blitz.remote; + +import java.rmi.RemoteException; + +import net.jini.core.transaction.UnknownTransactionException; +import net.jini.core.transaction.CannotJoinException; + +import net.jini.core.transaction.server.TransactionManager; +import net.jini.core.transaction.server.TransactionParticipant; +import net.jini.core.transaction.server.CrashCountException; + +import org.dancres.blitz.txn.TxnGateway; +import org.dancres.blitz.txn.TxnId; + +/** + "Glue" between the non-remote internals of Blitz and the outside (remote) + world. + */ +class TxnGatewayImpl implements TxnGateway { + private long theCrashCount = System.currentTimeMillis(); + private TransactionParticipant theParticipantStub; + + TxnGatewayImpl(TransactionParticipant aStub) { + theParticipantStub = aStub; + } + + public void join(TxnId anId) + throws UnknownTransactionException, CannotJoinException, + CrashCountException, RemoteException { + + anId.getManager().join(anId.getId(), theParticipantStub, + theCrashCount); + } + + public int getState(TxnId anId) + throws UnknownTransactionException, RemoteException { + + return anId.getManager().getState(anId.getId()); + } +}