use of org.neo4j.graphdb.event.ErrorState in project graphdb by neo4j-attic.
the class TestShutdownSequence method canInvokeShutdownFromShutdownHandler.
@Test
public void canInvokeShutdownFromShutdownHandler() {
graphDb.registerKernelEventHandler(new KernelEventHandler() {
public void beforeShutdown() {
graphDb.shutdown();
}
public Object getResource() {
return null;
}
public void kernelPanic(ErrorState error) {
// do nothing
}
public ExecutionOrder orderComparedTo(KernelEventHandler other) {
return ExecutionOrder.DOESNT_MATTER;
}
});
graphDb.shutdown();
}
use of org.neo4j.graphdb.event.ErrorState in project neo4j by neo4j.
the class TestShutdownSequence method canInvokeShutdownFromShutdownHandler.
@Test
public void canInvokeShutdownFromShutdownHandler() {
graphDb.registerKernelEventHandler(new KernelEventHandler() {
@Override
public void beforeShutdown() {
graphDb.shutdown();
}
@Override
public Object getResource() {
return null;
}
@Override
public void kernelPanic(ErrorState error) {
// do nothing
}
@Override
public ExecutionOrder orderComparedTo(KernelEventHandler other) {
return ExecutionOrder.DOESNT_MATTER;
}
});
graphDb.shutdown();
}
use of org.neo4j.graphdb.event.ErrorState in project neo4j by neo4j.
the class TestShutdownSequence method eventHandlersAreOnlyInvokedOnceDuringShutdown.
@Test
public void eventHandlersAreOnlyInvokedOnceDuringShutdown() {
final AtomicInteger counter = new AtomicInteger();
graphDb.registerKernelEventHandler(new KernelEventHandler() {
@Override
public void beforeShutdown() {
counter.incrementAndGet();
}
@Override
public Object getResource() {
return null;
}
@Override
public void kernelPanic(ErrorState error) {
// do nothing
}
@Override
public ExecutionOrder orderComparedTo(KernelEventHandler other) {
return ExecutionOrder.DOESNT_MATTER;
}
});
graphDb.shutdown();
graphDb.shutdown();
assertEquals(1, counter.get());
}
use of org.neo4j.graphdb.event.ErrorState in project graphdb by neo4j-attic.
the class TestShutdownSequence method eventHandlersAreOnlyInvokedOnceDuringShutdown.
@Test
public void eventHandlersAreOnlyInvokedOnceDuringShutdown() {
final AtomicInteger counter = new AtomicInteger();
graphDb.registerKernelEventHandler(new KernelEventHandler() {
public void beforeShutdown() {
counter.incrementAndGet();
}
public Object getResource() {
return null;
}
public void kernelPanic(ErrorState error) {
// do nothing
}
public ExecutionOrder orderComparedTo(KernelEventHandler other) {
return ExecutionOrder.DOESNT_MATTER;
}
});
graphDb.shutdown();
graphDb.shutdown();
assertEquals(1, counter.get());
}
Aggregations