|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjgroup.test.jini.txn.PassiveReplicatedBankServer
public class PassiveReplicatedBankServer
Bank server with replication support used as participant in a transaction.
| Nested Class Summary | |
|---|---|
class |
PassiveReplicatedBankServer.CreditDebit
Class that holds a temporary credit/debit operation, before doing a commit/abort operation. |
| Nested classes/interfaces inherited from interface jgroup.core.MembershipListener |
|---|
jgroup.core.MembershipListener.AllowDuplicateViews |
| Field Summary |
|---|
| Fields inherited from interface net.jini.core.transaction.server.TransactionConstants |
|---|
ABORTED, ACTIVE, COMMITTED, NOTCHANGED, PREPARED, VOTING |
| Constructor Summary | |
|---|---|
PassiveReplicatedBankServer(java.lang.String[] configArgs,
com.sun.jini.start.LifeCycle lifeCycle)
Constructor compatible with the jini service starter. |
|
| Method Summary | |
|---|---|
void |
abort(net.jini.core.transaction.server.TransactionManager mgr,
long id)
|
void |
commit(net.jini.core.transaction.server.TransactionManager mgr,
long id)
|
void |
deposit(long accountNumber,
int amount,
long transactionID)
Do a deposit operation on given account. |
java.lang.Integer |
getBalance(long accNumber)
Get balance of an account. |
java.lang.String |
getName()
Get the name of a bank service. |
void |
hasLeft()
|
int |
prepare(net.jini.core.transaction.server.TransactionManager mgr,
long id)
|
int |
prepareAndCommit(net.jini.core.transaction.server.TransactionManager mgr,
long id)
|
void |
prepareChange()
|
void |
txnCompleted(long txnId,
int outcome)
|
void |
txnDeposit(long account,
int amount,
long transactionID)
Transfer deposit state to other members int he group |
void |
txnPrepared(long txnId,
java.lang.Object stateObj)
Transfers the state of the txn to other members of the group. |
void |
txnWithdraw(long account,
int amount,
long transactionID)
Transfer withdraw state to other members in the group. |
void |
viewChange(jgroup.core.View view)
|
void |
withdraw(long accountNumber,
int amount,
long transactionID)
Do a withdraw operation on given account. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PassiveReplicatedBankServer(java.lang.String[] configArgs,
com.sun.jini.start.LifeCycle lifeCycle)
throws java.lang.Exception
configArgs - String array whose elements are
the arguments to use when creating the server.lifeCycle - instance of LifeCycle that, if
non-null, will cause this object's
unregister method to be invoked during
shutdown to notify the service starter framework that
the reference to this service's implementation can be
'released' for garbage collection. A value of
null for this argument is allowed.
java.lang.Exception - If there was a problem initializing the service.| Method Detail |
|---|
@Anycast
public java.lang.Integer getBalance(long accNumber)
throws java.rmi.RemoteException
Bank
getBalance in interface BankaccNumber - Account number
java.rmi.RemoteException
@Anycast
public void withdraw(long accountNumber,
int amount,
long transactionID)
throws java.rmi.RemoteException
Bank
withdraw in interface BankaccountNumber - The account number to useamount - The amount to withdrawtransactionID - The transaction id to use
java.rmi.RemoteException
@Anycast
public void deposit(long accountNumber,
int amount,
long transactionID)
throws java.rmi.RemoteException
Bank
deposit in interface BankaccountNumber - The account number to useamount - The amount to deposit
java.rmi.RemoteException
@Anycast
public java.lang.String getName()
throws java.rmi.RemoteException
Bank
getName in interface Bankjava.rmi.RemoteException
@Anycast
public int prepare(net.jini.core.transaction.server.TransactionManager mgr,
long id)
throws net.jini.core.transaction.UnknownTransactionException,
java.rmi.RemoteException
prepare in interface net.jini.core.transaction.server.TransactionParticipantnet.jini.core.transaction.UnknownTransactionException
java.rmi.RemoteException
@Anycast
public void commit(net.jini.core.transaction.server.TransactionManager mgr,
long id)
throws net.jini.core.transaction.UnknownTransactionException,
java.rmi.RemoteException
commit in interface net.jini.core.transaction.server.TransactionParticipantnet.jini.core.transaction.UnknownTransactionException
java.rmi.RemoteException
@Leadercast
public void abort(net.jini.core.transaction.server.TransactionManager mgr,
long id)
throws net.jini.core.transaction.UnknownTransactionException,
java.rmi.RemoteException
abort in interface net.jini.core.transaction.server.TransactionParticipantnet.jini.core.transaction.UnknownTransactionException
java.rmi.RemoteException
@Leadercast
public int prepareAndCommit(net.jini.core.transaction.server.TransactionManager mgr,
long id)
throws net.jini.core.transaction.UnknownTransactionException,
java.rmi.RemoteException
prepareAndCommit in interface net.jini.core.transaction.server.TransactionParticipantnet.jini.core.transaction.UnknownTransactionException
java.rmi.RemoteExceptionpublic void viewChange(jgroup.core.View view)
viewChange in interface jgroup.core.MembershipListenerpublic void prepareChange()
prepareChange in interface jgroup.core.MembershipListenerpublic void hasLeft()
hasLeft in interface jgroup.core.MembershipListener
public void txnPrepared(long txnId,
java.lang.Object stateObj)
throws java.rmi.RemoteException
InternalPassiveTransactionParticipant
txnPrepared in interface InternalPassiveTransactionParticipantjava.rmi.RemoteException
public void txnCompleted(long txnId,
int outcome)
throws java.rmi.RemoteException
txnCompleted in interface InternalPassiveTransactionParticipantjava.rmi.RemoteException
public void txnWithdraw(long account,
int amount,
long transactionID)
throws java.rmi.RemoteException
InternalPassiveTransactionParticipant
txnWithdraw in interface InternalPassiveTransactionParticipantjava.rmi.RemoteException
public void txnDeposit(long account,
int amount,
long transactionID)
throws java.rmi.RemoteException
InternalPassiveTransactionParticipant
txnDeposit in interface InternalPassiveTransactionParticipantjava.rmi.RemoteException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||