@Test public void should_handle_initial_poll_exceptions() throws Exception { when(configPollerMock.doPoll()).thenThrow(new IOException("Mock: No contact with server")); scheduler.run(); }
@Override public void run() { synchronized (executor) { if (executor.isShutdown()) { logger.fine("Codekvast scheduler is shutting down"); return; } if (!resolvedAndReady()) { if (System.currentTimeMillis() < stopWaitingForResolvedAppVersionAtMillis) { return; } if (stopWaitingForResolvedAppVersionAtMillis > 0L) { logger.warning( String.format( "Codekvast is not ready, check codeBase='%s' and appVersion='%s' in %s.", config.getCodeBase(), config.getAppVersion(), "codekvast.conf")); stopWaitingForResolvedAppVersionAtMillis = -1L; } } try { pollDynamicConfigIfNeeded(); publishCodeBaseIfNeeded(); publishInvocationDataIfNeeded(); } catch (Throwable t) { System.err.println("Codekvast scheduler failure: " + t); } } }
Scheduler implements Runnable { @Override public void run() { synchronized (executor) { if (executor.isShutdown()) { logger.fine("Codekvast scheduler is shutting down"); return; } if (!resolvedAndReady()) { if (System.currentTimeMillis() < stopWaitingForResolvedAppVersionAtMillis) { return; } if (stopWaitingForResolvedAppVersionAtMillis > 0L) { logger.warning( String.format( "Codekvast is not ready, check codeBase='%s' and appVersion='%s' in %s.", config.getCodeBase(), config.getAppVersion(), "codekvast.conf")); stopWaitingForResolvedAppVersionAtMillis = -1L; } } try { pollDynamicConfigIfNeeded(); publishCodeBaseIfNeeded(); publishInvocationDataIfNeeded(); } catch (Throwable t) { System.err.println("Codekvast scheduler failure: " + t); } } } }
Scheduler implements Runnable { @Override public void run() { synchronized (executor) { if (executor.isShutdown()) { logger.fine("Codekvast scheduler is shutting down"); return; } if (!resolvedAndReady()) { if (System.currentTimeMillis() < stopWaitingForResolvedAppVersionAtMillis) { return; } if (stopWaitingForResolvedAppVersionAtMillis > 0L) { logger.warning( String.format( "Codekvast is not ready, check codeBase='%s' and appVersion='%s' in %s.", config.getCodeBase(), config.getAppVersion(), "codekvast.conf")); stopWaitingForResolvedAppVersionAtMillis = -1L; } } try { pollDynamicConfigIfNeeded(); publishCodeBaseIfNeeded(); publishInvocationDataIfNeeded(); } catch (Throwable t) { System.err.println("Codekvast scheduler failure: " + t); } } } Scheduler(
      AgentConfig config,
      ConfigPoller configPoller,
      CodeBasePublisherFactory codeBasePublisherFactory,
      InvocationDataPublisherFactory invocationDataPublisherFactory,
      SystemClock systemClock); }
Scheduler implements Runnable { @Override public void run() { synchronized (executor) { if (executor.isShutdown()) { logger.fine("Codekvast scheduler is shutting down"); return; } if (!resolvedAndReady()) { if (System.currentTimeMillis() < stopWaitingForResolvedAppVersionAtMillis) { return; } if (stopWaitingForResolvedAppVersionAtMillis > 0L) { logger.warning( String.format( "Codekvast is not ready, check codeBase='%s' and appVersion='%s' in %s.", config.getCodeBase(), config.getAppVersion(), "codekvast.conf")); stopWaitingForResolvedAppVersionAtMillis = -1L; } } try { pollDynamicConfigIfNeeded(); publishCodeBaseIfNeeded(); publishInvocationDataIfNeeded(); } catch (Throwable t) { System.err.println("Codekvast scheduler failure: " + t); } } } Scheduler(
      AgentConfig config,
      ConfigPoller configPoller,
      CodeBasePublisherFactory codeBasePublisherFactory,
      InvocationDataPublisherFactory invocationDataPublisherFactory,
      SystemClock systemClock); Scheduler start(); void shutdown(); @Override void run(); }
Scheduler implements Runnable { @Override public void run() { synchronized (executor) { if (executor.isShutdown()) { logger.fine("Codekvast scheduler is shutting down"); return; } if (!resolvedAndReady()) { if (System.currentTimeMillis() < stopWaitingForResolvedAppVersionAtMillis) { return; } if (stopWaitingForResolvedAppVersionAtMillis > 0L) { logger.warning( String.format( "Codekvast is not ready, check codeBase='%s' and appVersion='%s' in %s.", config.getCodeBase(), config.getAppVersion(), "codekvast.conf")); stopWaitingForResolvedAppVersionAtMillis = -1L; } } try { pollDynamicConfigIfNeeded(); publishCodeBaseIfNeeded(); publishInvocationDataIfNeeded(); } catch (Throwable t) { System.err.println("Codekvast scheduler failure: " + t); } } } Scheduler(
      AgentConfig config,
      ConfigPoller configPoller,
      CodeBasePublisherFactory codeBasePublisherFactory,
      InvocationDataPublisherFactory invocationDataPublisherFactory,
      SystemClock systemClock); Scheduler start(); void shutdown(); @Override void run();  }