org.objectweb.jotm.examples
Class AccountImpl

java.lang.Object
  |
  +--org.objectweb.jotm.examples.ListenerImpl
        |
        +--org.objectweb.jotm.examples.AccountImpl
All Implemented Interfaces:
Account, EventListener

public class AccountImpl
extends ListenerImpl
implements Account

Simple implementation of a bank account. It uses transactional locks and can take part in transactions since it extends ListenerImpl.


Constructor Summary
AccountImpl()
           
 
Method Summary
 int balance()
          Gets account balance.
 void commit()
           
 void deposit(int value)
          Deposits an amount of money to the bank account.
 void one_phase_commit()
           
 void withdraw(int value)
          Withdraws an amount of money from the bank account.
 
Methods inherited from class org.objectweb.jotm.examples.ListenerImpl
abort, before_completion, handleEvent, prepare
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AccountImpl

public AccountImpl()
Method Detail

balance

public int balance()
Description copied from interface: Account
Gets account balance.

Specified by:
balance in interface Account
Returns:
amount of money currently available at the bank account

deposit

public void deposit(int value)
Description copied from interface: Account
Deposits an amount of money to the bank account.

Specified by:
deposit in interface Account
Parameters:
value - value representing the amount of money

withdraw

public void withdraw(int value)
Description copied from interface: Account
Withdraws an amount of money from the bank account.

Specified by:
withdraw in interface Account
Parameters:
value - value representing the amount of money

one_phase_commit

public void one_phase_commit()
Overrides:
one_phase_commit in class ListenerImpl

commit

public void commit()
Overrides:
commit in class ListenerImpl