Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
  * Copyright (c) 2013 GraphAware
  *
  * This file is part of GraphAware.
  *
  * GraphAware is free software: you can redistribute it and/or modify it under the terms of
  * the GNU General Public License as published by the Free Software Foundation, either
  * version 3 of the License, or (at your option) any later version.
  *
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 *  without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details. You should have received a copy of
 * the GNU General Public License along with this program.  If not, see
 * <http://www.gnu.org/licenses/>.
 */
package com.graphaware.tx.executor.single;

Implementations execute work in Neo4j org.neo4j.graphdb.Transactions.
public interface TransactionExecutor {

    
Execute work in a single transaction, using RethrowException as ExceptionHandlingStrategy.

Parameters:
callback specifying the work to be executed.
<T> type of execution result. If no result is expected, this should be com.graphaware.tx.executor.NullItem. It could also be java.lang.Void (but the former is generally preferred).
Returns:
result of the execution.
Throws:
java.lang.RuntimeException if any occurred during the transaction.
    <T> T executeInTransaction(TransactionCallback<T> callback);

    
Execute work in a single transaction.

Parameters:
callback specifying the work to be executed.
exceptionHandlingStrategy what to do in case an exception occurs. This could be either an exception thrown by the callback, or by the database.
<T> type of execution result. If no result is expected, this should be com.graphaware.tx.executor.NullItem. It could also be java.lang.Void and always null, but then a successful execution and failed execution isn't distinguishable if KeepCalmAndCarryOn exception handling strategy is used.
Returns:
result of the execution. Will be null in case a result is expected, but an exception occurred during the execution of the transaction, which isn't re-thrown by the exception handling strategy.
    <T> T executeInTransaction(TransactionCallback<T> callbackExceptionHandlingStrategy exceptionHandlingStrategy);
New to GrepCode? Check out our FAQ X