Hi,

I do think the best solution is to make NeoService.shutdown() (either
by default or parameter/config) do the following:

1) block or throw exception for threads trying to start a new transaction
2) rollback all transactions that are not yet in committing state
3) wait for transactions that are in committing state to commit

The problem is this is hard to do in a safe way without introducing
blocking code in the TM. I may have a look at this sometime soon and
see if it is possible to do without killing concurrency.

Regarding suspend/resume of transactions you can have a look at this class:

 
https://svn.neo4j.org/components/neo-rdf-sail/trunk/src/main/java/org/neo4j/rdf/sail/NeoSailConnection.java

Methods in that class that needs transactional context will suspend
any other running transaction and resume the internal transaction
(that is connected with the connection), then on exit, suspend the
internal transaction and resume the transaction that was running on
method invocation (if any) . You would have to make sure that threads
do not try to resume the same transaction concurrently (will result in
an exception from TM).

Regards,
-Johan

On Thu, Dec 10, 2009 at 11:30 PM, Adam Rabung <adamrab...@gmail.com> wrote:
> Hi,
> Thanks for all of the information.
>
> Of course the #1 solution to this problem is to ensure all transactions are
> closed before shutdown is called.  I am trying to implement some kind of
> failsafe in the case that some unforeseen problem/bug causes transactions to
> remain open.  What do you think of an optional parameter to shutdown() to
> signify "Do your best to rollback+finish any open transactions"?  Or, could
> you provide a code example of how to close an Iterable of TransactionImpls
> using TransactionManager suspend and resume?
>
> Thank you,
> Adam
_______________________________________________
Neo mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to