use of org.neo4j.com.ComException in project neo4j by neo4j.
the class SlaveLocksClientTest method mustThrowIfStartingNewLockSessionOnMasterThrowsComException.
@Test(expected = DistributedLockFailureException.class)
public void mustThrowIfStartingNewLockSessionOnMasterThrowsComException() throws Exception {
when(master.newLockSession(any(RequestContext.class))).thenThrow(new ComException());
client.acquireShared(LockTracer.NONE, NODE, 1);
}
use of org.neo4j.com.ComException in project neo4j by neo4j.
the class SlaveLocksClientTest method acquireSharedMustThrowIfMasterThrows.
@Test(expected = DistributedLockFailureException.class)
public void acquireSharedMustThrowIfMasterThrows() throws Exception {
whenMasterAcquireShared().thenThrow(new ComException());
client.acquireShared(LockTracer.NONE, NODE, 1);
}
use of org.neo4j.com.ComException in project neo4j by neo4j.
the class SlaveLocksClientTest method mustCloseLocalClientEvenIfMasterThrows.
@Test
public void mustCloseLocalClientEvenIfMasterThrows() throws Exception {
when(master.endLockSession(any(RequestContext.class), anyBoolean())).thenThrow(new ComException());
try {
// initialise
client.acquireExclusive(LockTracer.NONE, NODE, 1);
client.close();
fail("Expected client.close to throw");
} catch (Exception ignore) {
}
verify(local).close();
}
use of org.neo4j.com.ComException in project neo4j by neo4j.
the class HaIdGeneratorFactoryTest method shouldTranslateComExceptionsIntoTransientTransactionFailures.
@Test(expected = TransientTransactionFailureException.class)
public void shouldTranslateComExceptionsIntoTransientTransactionFailures() throws Exception {
when(master.allocateIds(any(RequestContext.class), any(IdType.class))).thenThrow(new ComException());
IdGenerator generator = switchToSlave();
generator.nextId();
}
use of org.neo4j.com.ComException in project neo4j by neo4j.
the class SlaveUpdatePuller method doPullUpdates.
private void doPullUpdates() {
try {
RequestContext context = requestContextFactory.newRequestContext();
try (Response<Void> ignored = master.pullUpdates(context)) {
// Updates would be applied as part of response processing
monitor.pulledUpdates(context.lastAppliedTransaction());
}
invalidEpochCappedLogger.reset();
comExceptionCappedLogger.reset();
} catch (InvalidEpochException e) {
invalidEpochHandler.handle();
invalidEpochCappedLogger.warn("Pull updates by " + this + " failed at the epoch check", e);
} catch (ComException e) {
invalidEpochCappedLogger.warn("Pull updates by " + this + " failed due to network error.", e);
} catch (Throwable e) {
logger.error("Pull updates by " + this + " failed", e);
}
lastUpdateTime.setLastUpdateTime(currentTimeMillis());
}
Aggregations