Mercurial > hg > blitz_condensed
view src/org/dancres/blitz/remote/TxnParticipantProxy.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 |
line wrap: on
line source
package org.dancres.blitz.remote; import java.rmi.RemoteException; import java.io.Serializable; import java.io.IOException; import net.jini.core.transaction.server.TransactionParticipant; import net.jini.core.transaction.server.TransactionManager; import net.jini.core.transaction.UnknownTransactionException; import net.jini.id.Uuid; import net.jini.id.ReferentUuid; import net.jini.id.ReferentUuids; import org.dancres.blitz.remote.nio.FastSpace; public class TxnParticipantProxy implements Serializable, ReferentUuid, TransactionParticipant { FastSpace theFast; TransactionParticipant theStub; Uuid theUuid; TxnParticipantProxy(TransactionParticipant aStub, Uuid aUuid) { theStub = aStub; theUuid = aUuid; } void enableFastIO(FastSpace aSpace) { theFast = aSpace; } synchronized FastSpace getFastChannel() { if (theFast != null) { if (! theFast.isInited()) { try { theFast.init(); } catch (IOException anIOE) { throw new Error("Panic: fast io didn't init", anIOE); } } } return theFast; } public Uuid getReferentUuid() { return theUuid; } public int prepare(TransactionManager aMgr, long anId) throws UnknownTransactionException, RemoteException { if (getFastChannel() != null) return getFastChannel().prepare(aMgr, anId); else return theStub.prepare(aMgr, anId); } public void commit(TransactionManager aMgr, long anId) throws UnknownTransactionException, RemoteException { if (getFastChannel() != null) getFastChannel().commit(aMgr, anId); else theStub.commit(aMgr, anId); } public void abort(TransactionManager aMgr, long anId) throws UnknownTransactionException, RemoteException { if (getFastChannel() != null) getFastChannel().abort(aMgr, anId); else theStub.abort(aMgr, anId); } public int prepareAndCommit(TransactionManager aMgr, long anId) throws UnknownTransactionException, RemoteException { if (getFastChannel() != null) return getFastChannel().prepareAndCommit(aMgr, anId); else return theStub.prepareAndCommit(aMgr, anId); } public boolean equals(Object anObject) { return ReferentUuids.compare(this, anObject); } public int hashCode() { return theUuid.hashCode(); } }