[Neo4j] Transactions: what happens when tx.finish() is reached before tx.success() or tx.failure()

2011-07-20 Thread cyuczi eekc
Does it auto fail? Considering how I see in the examples, it does
auto-fail... if it doesn't then maybe the doc for tx.finish() should specify
what happens, or even throw ? if there isn't a specified default.
Ah, I just read the javadoc for Transaction (interface):

If an exception is raised in the try-block,
success()eclipse-javadoc:%E2%98%82=neo4j-community/kernel%5C/src%5C/main%5C/java%3Corg.neo4j.graphdb%7BTransaction.java%E2%98%83Transaction%E2%98%82%E2%98%82success%E2%98%82will
never be invoked and the internal state of the transaction object will
cause 
finish()eclipse-javadoc:%E2%98%82=neo4j-community/kernel%5C/src%5C/main%5C/java%3Corg.neo4j.graphdb%7BTransaction.java%E2%98%83Transaction%E2%98%82%E2%98%82finish%E2%98%82to
roll back the transaction. This is very important: unless
success()eclipse-javadoc:%E2%98%82=neo4j-community/kernel%5C/src%5C/main%5C/java%3Corg.neo4j.graphdb%7BTransaction.java%E2%98%83Transaction%E2%98%82%E2%98%82success%E2%98%82is
invoked, the transaction will fail upon
finish()eclipse-javadoc:%E2%98%82=neo4j-community/kernel%5C/src%5C/main%5C/java%3Corg.neo4j.graphdb%7BTransaction.java%E2%98%83Transaction%E2%98%82%E2%98%82finish%E2%98%82.
A transaction can be explicitly marked for rollback by invoking the
failure()eclipse-javadoc:%E2%98%82=neo4j-community/kernel%5C/src%5C/main%5C/java%3Corg.neo4j.graphdb%7BTransaction.java%E2%98%83Transaction%E2%98%82%E2%98%82failure%E2%98%82method.

In this case, could some developer please update the tx.finish() javadoc to
state that?
it currently states this:
Commits or marks this transaction for rollback, depending on whether
success()eclipse-javadoc:%E2%98%82=neo4j-community/kernel%5C/src%5C/main%5C/java%3Corg.neo4j.graphdb%7BTransaction.java%E2%98%83Transaction%7Efinish%E2%98%82%E2%98%82success%E2%98%82or
failure()eclipse-javadoc:%E2%98%82=neo4j-community/kernel%5C/src%5C/main%5C/java%3Corg.neo4j.graphdb%7BTransaction.java%E2%98%83Transaction%7Efinish%E2%98%82%E2%98%82failure%E2%98%82has
been previously invoked.

For some reason, this isn't clear to me that it defaults to failure() unless
success() is invoked


Thanks!
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user


Re: [Neo4j] Transactions: what happens when tx.finish() is reached before tx.success() or tx.failure()

2011-07-20 Thread Norbert Tausch
There is another point in the doc that is not correct. The doc states
out that you can call tx.success after tx.failure. In this case the
transaction stays at being fault. So one call to tx.failure causes a
rollback when calling tx.finish, also when there are further calls to
tx.success before or after the call to tx.failure. But instead, the call
of tx.success after tx.failure produces an exception which forbids this
case. This is opposite to the statements of the javadoc. I would prefer
the behavior that is described in the doc since it makes transaction
handling easier.

Best regards

Norbert Tausch


Am 20.07.2011 23:23, schrieb cyuczi eekc:
 Does it auto fail? Considering how I see in the examples, it does
 auto-fail... if it doesn't then maybe the doc for tx.finish() should specify
 what happens, or even throw ? if there isn't a specified default.
 Ah, I just read the javadoc for Transaction (interface):
 
 If an exception is raised in the try-block,
 success()eclipse-javadoc:%E2%98%82=neo4j-community/kernel%5C/src%5C/main%5C/java%3Corg.neo4j.graphdb%7BTransaction.java%E2%98%83Transaction%E2%98%82%E2%98%82success%E2%98%82will
 never be invoked and the internal state of the transaction object will
 cause 
 finish()eclipse-javadoc:%E2%98%82=neo4j-community/kernel%5C/src%5C/main%5C/java%3Corg.neo4j.graphdb%7BTransaction.java%E2%98%83Transaction%E2%98%82%E2%98%82finish%E2%98%82to
 roll back the transaction. This is very important: unless
 success()eclipse-javadoc:%E2%98%82=neo4j-community/kernel%5C/src%5C/main%5C/java%3Corg.neo4j.graphdb%7BTransaction.java%E2%98%83Transaction%E2%98%82%E2%98%82success%E2%98%82is
 invoked, the transaction will fail upon
 finish()eclipse-javadoc:%E2%98%82=neo4j-community/kernel%5C/src%5C/main%5C/java%3Corg.neo4j.graphdb%7BTransaction.java%E2%98%83Transaction%E2%98%82%E2%98%82finish%E2%98%82.
 A transaction can be explicitly marked for rollback by invoking the
 failure()eclipse-javadoc:%E2%98%82=neo4j-community/kernel%5C/src%5C/main%5C/java%3Corg.neo4j.graphdb%7BTransaction.java%E2%98%83Transaction%E2%98%82%E2%98%82failure%E2%98%82method.
 
 In this case, could some developer please update the tx.finish() javadoc to
 state that?
 it currently states this:
 Commits or marks this transaction for rollback, depending on whether
 success()eclipse-javadoc:%E2%98%82=neo4j-community/kernel%5C/src%5C/main%5C/java%3Corg.neo4j.graphdb%7BTransaction.java%E2%98%83Transaction%7Efinish%E2%98%82%E2%98%82success%E2%98%82or
 failure()eclipse-javadoc:%E2%98%82=neo4j-community/kernel%5C/src%5C/main%5C/java%3Corg.neo4j.graphdb%7BTransaction.java%E2%98%83Transaction%7Efinish%E2%98%82%E2%98%82failure%E2%98%82has
 been previously invoked.

 For some reason, this isn't clear to me that it defaults to failure() unless
 success() is invoked


 Thanks!
 ___
 Neo4j mailing list
 User@lists.neo4j.org
 https://lists.neo4j.org/mailman/listinfo/user
___
Neo4j mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user