Neo4j: Exception handling and explict invoking of failure()/close()? -


i trying handle exceptions in neo4j try transaction.

try(transaction tx = graphdb.begintx()) {     // more code     tx.sucess(); } 

the code posted standard, keeps transaction in variable tx , upon end of try block tx.close() automatically called.

hows 1 handle exceptions in type of block? know following works:

transaction tx = graphdb.begintx(); try{     // more code     tx.sucess(); // must called } catch(exception e) {     tx.failure(); // exception arised, best call this. } {     tx.close(); // tx.close called automatically, or must call did here? } 

so have 2 questions, first sample of code: how 1 handle exceptions in one? second sample of code: must call explicitly , automatically called?

simply add exception handling, omit finally:

try(transaction tx = graphdb.begintx()) {     // more code     tx.sucess(); } catch(exception e) {     // .. } 

Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -