Suppose we have a class called AccountService that manages the state of accounts.

AccountService is defined as

```
interface AccountService{
 public void debit(account);
 public void credit(account);
 public void transfer(Account account, Account account1);

}

```

Given this definition, what is the best way to implement transfer() so that you can guarantee that transfer is an atomic operation.

I'm interested in answers that reference Java 1.4 code as well as answers that might use resources from java.util.concurrent in Java 5