If an exception cause a block of code to exit prior to a transaction being
finish()ed, will it be implicitly finished in garbage collection?

 

Here's the situation I want to try to implement : I would like to propagate
the exception thrown by "doSomething()" to the caller of myFunc(), but also
ensure that the transaction is properly "failed" and the transaction is
properly "finished", if necessary:

 

public void myFunc()  throws Exception {

                Transaction tx    neo.beginTx();

 

                try {

                                doSomething();  // This could throw an
exception

                }

                catch(Exception ex) {

                                tx.failure();

                                throw new Exception("An error has occurred:
" + ex.getMessage);

                }

                finally{

                                tx.finish();

                }

}

 

I think I'm just not thinking clearly since I've been coding for 24 of the
last 36 hours, so I wanted to see if I'm too tired to figure out what should
be an easy exception handling scenario.

 

Thanks

 

Rick

 

_______________________________________________
Neo mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to