Refactoring and add semantic cache
This commit is contained in:
@@ -10,7 +10,7 @@ public class DbHelper {
|
|||||||
private static final Logger logger = LoggerFactory.getLogger(DbHelper.class);
|
private static final Logger logger = LoggerFactory.getLogger(DbHelper.class);
|
||||||
private final GraphDatabaseService graphDb;
|
private final GraphDatabaseService graphDb;
|
||||||
|
|
||||||
public DbHelper(GraphDatabaseService graphDb) {
|
public DbHelper(final GraphDatabaseService graphDb) {
|
||||||
this.graphDb = graphDb;
|
this.graphDb = graphDb;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -19,7 +19,7 @@ public class DbHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public <E, T extends Throwable> Result<E, T> wrapInTx(TransactionContextWithReturn<E> action) {
|
public <E, T extends Throwable> Result<E, T> wrapInTx(final TransactionContextWithReturn<E> action) {
|
||||||
try (final TransactionWrapper tx = new TransactionWrapper(beginTx())) {
|
try (final TransactionWrapper tx = new TransactionWrapper(beginTx())) {
|
||||||
final E result = action.execute(tx);
|
final E result = action.execute(tx);
|
||||||
tx.commit();
|
tx.commit();
|
||||||
@@ -31,7 +31,7 @@ public class DbHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public <T extends Throwable> Result<Void, T> wrapInTx(TransactionContextWithoutReturn action) {
|
public <T extends Throwable> Result<Void, T> wrapInTx(final TransactionContextWithoutReturn action) {
|
||||||
try (final TransactionWrapper tx = new TransactionWrapper(beginTx())) {
|
try (final TransactionWrapper tx = new TransactionWrapper(beginTx())) {
|
||||||
action.execute(tx);
|
action.execute(tx);
|
||||||
tx.commit();
|
tx.commit();
|
||||||
|
|||||||
Reference in New Issue
Block a user