Package org.neo4j.smack.test.util

Source Code of org.neo4j.smack.test.util.Transactor

package org.neo4j.smack.test.util;

import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.graphdb.Transaction;

public class Transactor {
    private final UnitOfWork unitOfWork;
    private final GraphDatabaseService graphDb;

    public Transactor( GraphDatabaseService graphDb, UnitOfWork unitOfWork )
    {
        this.unitOfWork = unitOfWork;
        this.graphDb = graphDb;
    }

    public void execute()
    {
        Transaction tx = graphDb.beginTx();

        try
        {
            unitOfWork.doWork();
            tx.success();
        }
        finally
        {
            tx.finish();
        }

    }
}
TOP

Related Classes of org.neo4j.smack.test.util.Transactor

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.