use of org.neo4j.kernel.impl.transaction.LockManager in project graphdb by neo4j-attic.
the class MasterImpl method acquireLock.
private <T extends PropertyContainer> Response<LockResult> acquireLock(SlaveContext context, LockGrabber lockGrabber, T... entities) {
Transaction otherTx = suspendOtherAndResumeThis(context);
try {
LockManager lockManager = graphDbConfig.getLockManager();
LockReleaser lockReleaser = graphDbConfig.getLockReleaser();
for (T entity : entities) {
lockGrabber.grab(lockManager, lockReleaser, entity);
}
return packResponse(context, new LockResult(LockStatus.OK_LOCKED));
} catch (DeadlockDetectedException e) {
return packResponse(context, new LockResult(e.getMessage()));
} catch (IllegalResourceException e) {
return packResponse(context, new LockResult(LockStatus.NOT_LOCKED));
} finally {
suspendThisAndResumeOther(otherTx, context);
}
}
use of org.neo4j.kernel.impl.transaction.LockManager in project graphdb by neo4j-attic.
the class TestNeoStore method initializeStores.
private void initializeStores() throws IOException {
try {
LockManager lockManager = getEmbeddedGraphDb().getConfig().getLockManager();
LockReleaser lockReleaser = getEmbeddedGraphDb().getConfig().getLockReleaser();
ds = new NeoStoreXaDataSource(MapUtil.genericMap(LockManager.class, lockManager, LockReleaser.class, lockReleaser, IdGeneratorFactory.class, ID_GENERATOR_FACTORY, FileSystemAbstraction.class, CommonFactories.defaultFileSystemAbstraction(), LogBufferFactory.class, CommonFactories.defaultLogBufferFactory(MapUtil.stringMap()), TxIdGenerator.class, TxIdGenerator.DEFAULT, "store_dir", path(), "neo_store", file("neo"), "logical_log", file("nioneo_logical.log")));
// ds = new NeoStoreXaDataSource( file( "neo" ), file( "nioneo_logical.log" ),
// lockManager, lockReleaser );
} catch (InstantiationException e) {
throw new IOException("" + e);
}
xaCon = (NeoStoreXaConnection) ds.getXaConnection();
nStore = xaCon.getNodeConsumer();
pStore = xaCon.getPropertyStore();
relTypeStore = xaCon.getRelationshipTypeConsumer();
rStore = xaCon.getRelationshipConsumer();
}
Aggregations