Coordinated coordinated = (Coordinated) o;
final Object message = coordinated.getMessage();
if (message instanceof AccountDebit) {
coordinated.atomic(new Runnable() {
public void run() {
AccountDebit accDebit = (AccountDebit) message;
//check for funds availability
if (balance.get() > accDebit.getAmount()) {
float bal = balance.get() - accDebit.getAmount();
balance.set(bal);
} else {
throw new IllegalStateException(
"Insufficient Balance");
}