Quantcast
Channel: Gigaspaces XAP forum - RSS feed
Viewing all articles
Browse latest Browse all 1486

Transactions spanning multiple threads

$
0
0
Hello, Is a transaction always strictly bound to one thread, or is it possible to use a transaction spanning multiple threads, that is, start a transaction in one thread and commit it in a different thread? A typical use case would be using asynchronous GigaSpace methods in a continuation style. In a meta-language it would be like this: Transaction t = transactionManager.getTransaction(); AsyncFuture asyncFuture = gigaSpace.asyncRead(query); asyncFuture.setListener(new AsyncFutureListener() { public void onResult(AsyncResult result) { Object obj = result.getResult(); // Some business logic: use the returned object, modify other objects in space... // Note that all this logic is executed not in the original thread, but in the LRMI thread which invoked // a listener of the async future. // After the business logic is executed, commit the transaction. // Note that we are committing the transaction not in the original thread, but in a different thread. t.commit(); } }); Is such usage possible in GigaSpace? If not, would you consider making it possible in future releases?

Viewing all articles
Browse latest Browse all 1486

Trending Articles