inconsistent exception usage + question
James Grahn <[email protected]> Wed, 28 May 2008 19:02:20 -0400
| Newsgroups | gmane.comp.java.sun.javaspaces |
|---|---|
| Message-ID | <[email protected]> |
Just noticed this gem today, from the reference implementation of Javaspace: When using a transaction whose lease has expired: 1) Using in conjunction with space operations, you get an UnknownTransactionException. 2) Aborting that transaction results in a CannotAbortException (which has no cause included). 3) Committing that transaction results in an UnknownTransactionException. Why does the failed abort result in CannotAbort, but the failed commit does not result in CannotCommit? Why not throw UnknownTransaction in every case? I've not read through the jini code yet, but if the methods could find out that the transaction has timed out, I think it would be a good idea for them to report that information more clearly. Having that bit of information returned in the exception could help my code more intelligently deal with that particular case. My question is this: I'm using the TransactionFactory presently, and the only way I see of testing the remaining lease time of a transaction is by getting its lease and checking the expiration against currentTimeMillis. Is there a more elegant way to determine if the transaction has expired due to a timeout? jamesG =========================================================================== To unsubscribe, send email to [email protected] and include in the body of the message "signoff JAVASPACES-USERS". For general help, send email to [email protected] and include in the body of the message "help". To view past JAVASPACES-USERS postings, please see: http://archives.java.sun.com/archives/javaspaces-users.html