try {
// start tx (REQUIRED)
txTemplate.execute(new TransactionCallbackWithoutResult() {
protected void doInTransactionWithoutResult(final TransactionStatus status) {
spaceTemplate.execute(new JavaSpaceCallback() {
public Object doInSpace(JavaSpace js, final Transaction transaction)
throws RemoteException, TransactionException, UnusableEntryException,
InterruptedException {
// check that we have a tx
assertNotNull("no tx started", transaction);
Object result = js.read(template, transaction, timeout);
assertNull(result);
// write
js.write(template, transaction, Lease.ANY);
notSupportedTransaction.execute(new TransactionCallbackWithoutResult() {
protected void doInTransactionWithoutResult(final TransactionStatus status2) {
spaceTemplate.execute(new JavaSpaceCallback() {
public Object doInSpace(JavaSpace js2, Transaction transaction2)
throws RemoteException, TransactionException,
UnusableEntryException, InterruptedException {
// NOT_SUPPORTED means tx was suspended
assertNull(transaction2);