use of com.hubspot.mesos.rx.java.Mesos4xxException in project Singularity by HubSpot.
the class SingularityMesosSchedulerClientTest method itCheckAndReconnectThrowsException.
@Test
public void itCheckAndReconnectThrowsException() {
Mesos4xxException exception = new Mesos4xxException(new Object(), new MesosClientErrorContext(403, "Framework not subscribed", new ArrayList<>()));
doAnswer((InvocationOnMock invocation) -> {
((Runnable) invocation.getArguments()[0]).run();
return null;
}).when(executorService).execute(any(Runnable.class));
client.checkAndReconnect(exception).join();
verify(scheduler, times(1)).onUncaughtException(any());
}
use of com.hubspot.mesos.rx.java.Mesos4xxException in project Singularity by HubSpot.
the class SingularityMesosSchedulerClient method checkAndReconnect.
public CompletableFuture<Void> checkAndReconnect(Throwable t) {
LOG.error("Exception calling mesos ({} so far)", failedMesosCalls.incrementAndGet(), t);
String message = t.getMessage();
if (t instanceof Mesos4xxException && message.contains("403")) {
return CompletableFuture.runAsync(() -> scheduler.onUncaughtException(new PrematureChannelClosureException()), executorService);
}
return CompletableFuture.completedFuture(null);
}
Aggregations