@Test public void execute_retry1() throws Exception { ProcessProfile profile = profile(2, Action.EXCEPTION, Action.SUCCESS); ProcessProvider provider = profile.createProvider(); provider.execute(factory(), script()); }
@Override public <T> void execute(DriverFactory drivers, ProcessScript<T> script) throws IOException { int maxAttempts = processProfile.getRetryCount() + 1; WGLOG.info("I01000", script.getName(), script.getSourceScript().getResourceName(), script.getDrainScript().getResourceName(), processProfile.getRetryCount()); long start = System.currentTimeMillis(); try { int attempt = 1; while (true) { assert attempt <= maxAttempts; try { processProfile.getComponent().execute(drivers, script); break; } catch (InterruptedIOException e) { WGLOG.error(e, "E01002", script.getName(), script.getSourceScript().getResourceName(), script.getDrainScript().getResourceName()); throw e; } catch (IOException e) { if (attempt < maxAttempts) { WGLOG.warn(e, "W01001", script.getName(), script.getSourceScript().getResourceName(), script.getDrainScript().getResourceName(), attempt, processProfile.getRetryCount()); attempt++; } else { WGLOG.error(e, "E01001", script.getName(), script.getSourceScript().getResourceName(), script.getDrainScript().getResourceName(), maxAttempts); throw e; } } if (processProfile.getRetryInterval() > 0) { try { Thread.sleep(TimeUnit.SECONDS.toMillis( processProfile.getRetryInterval())); } catch (InterruptedException e) { WGLOG.error(e, "E01002", script.getName(), script.getSourceScript().getResourceName(), script.getDrainScript().getResourceName()); throw (IOException) new InterruptedIOException().initCause(e); } } } WGLOG.info("I01001", script.getName(), script.getSourceScript().getResourceName(), script.getDrainScript().getResourceName(), attempt); } finally { long end = System.currentTimeMillis(); WGLOG.info("I01999", script.getName(), script.getSourceScript().getResourceName(), script.getDrainScript().getResourceName(), end - start); } }
RetryableProcessProvider extends ProcessProvider { @Override public <T> void execute(DriverFactory drivers, ProcessScript<T> script) throws IOException { int maxAttempts = processProfile.getRetryCount() + 1; WGLOG.info("I01000", script.getName(), script.getSourceScript().getResourceName(), script.getDrainScript().getResourceName(), processProfile.getRetryCount()); long start = System.currentTimeMillis(); try { int attempt = 1; while (true) { assert attempt <= maxAttempts; try { processProfile.getComponent().execute(drivers, script); break; } catch (InterruptedIOException e) { WGLOG.error(e, "E01002", script.getName(), script.getSourceScript().getResourceName(), script.getDrainScript().getResourceName()); throw e; } catch (IOException e) { if (attempt < maxAttempts) { WGLOG.warn(e, "W01001", script.getName(), script.getSourceScript().getResourceName(), script.getDrainScript().getResourceName(), attempt, processProfile.getRetryCount()); attempt++; } else { WGLOG.error(e, "E01001", script.getName(), script.getSourceScript().getResourceName(), script.getDrainScript().getResourceName(), maxAttempts); throw e; } } if (processProfile.getRetryInterval() > 0) { try { Thread.sleep(TimeUnit.SECONDS.toMillis( processProfile.getRetryInterval())); } catch (InterruptedException e) { WGLOG.error(e, "E01002", script.getName(), script.getSourceScript().getResourceName(), script.getDrainScript().getResourceName()); throw (IOException) new InterruptedIOException().initCause(e); } } } WGLOG.info("I01001", script.getName(), script.getSourceScript().getResourceName(), script.getDrainScript().getResourceName(), attempt); } finally { long end = System.currentTimeMillis(); WGLOG.info("I01999", script.getName(), script.getSourceScript().getResourceName(), script.getDrainScript().getResourceName(), end - start); } } }
RetryableProcessProvider extends ProcessProvider { @Override public <T> void execute(DriverFactory drivers, ProcessScript<T> script) throws IOException { int maxAttempts = processProfile.getRetryCount() + 1; WGLOG.info("I01000", script.getName(), script.getSourceScript().getResourceName(), script.getDrainScript().getResourceName(), processProfile.getRetryCount()); long start = System.currentTimeMillis(); try { int attempt = 1; while (true) { assert attempt <= maxAttempts; try { processProfile.getComponent().execute(drivers, script); break; } catch (InterruptedIOException e) { WGLOG.error(e, "E01002", script.getName(), script.getSourceScript().getResourceName(), script.getDrainScript().getResourceName()); throw e; } catch (IOException e) { if (attempt < maxAttempts) { WGLOG.warn(e, "W01001", script.getName(), script.getSourceScript().getResourceName(), script.getDrainScript().getResourceName(), attempt, processProfile.getRetryCount()); attempt++; } else { WGLOG.error(e, "E01001", script.getName(), script.getSourceScript().getResourceName(), script.getDrainScript().getResourceName(), maxAttempts); throw e; } } if (processProfile.getRetryInterval() > 0) { try { Thread.sleep(TimeUnit.SECONDS.toMillis( processProfile.getRetryInterval())); } catch (InterruptedException e) { WGLOG.error(e, "E01002", script.getName(), script.getSourceScript().getResourceName(), script.getDrainScript().getResourceName()); throw (IOException) new InterruptedIOException().initCause(e); } } } WGLOG.info("I01001", script.getName(), script.getSourceScript().getResourceName(), script.getDrainScript().getResourceName(), attempt); } finally { long end = System.currentTimeMillis(); WGLOG.info("I01999", script.getName(), script.getSourceScript().getResourceName(), script.getDrainScript().getResourceName(), end - start); } }  }
RetryableProcessProvider extends ProcessProvider { @Override public <T> void execute(DriverFactory drivers, ProcessScript<T> script) throws IOException { int maxAttempts = processProfile.getRetryCount() + 1; WGLOG.info("I01000", script.getName(), script.getSourceScript().getResourceName(), script.getDrainScript().getResourceName(), processProfile.getRetryCount()); long start = System.currentTimeMillis(); try { int attempt = 1; while (true) { assert attempt <= maxAttempts; try { processProfile.getComponent().execute(drivers, script); break; } catch (InterruptedIOException e) { WGLOG.error(e, "E01002", script.getName(), script.getSourceScript().getResourceName(), script.getDrainScript().getResourceName()); throw e; } catch (IOException e) { if (attempt < maxAttempts) { WGLOG.warn(e, "W01001", script.getName(), script.getSourceScript().getResourceName(), script.getDrainScript().getResourceName(), attempt, processProfile.getRetryCount()); attempt++; } else { WGLOG.error(e, "E01001", script.getName(), script.getSourceScript().getResourceName(), script.getDrainScript().getResourceName(), maxAttempts); throw e; } } if (processProfile.getRetryInterval() > 0) { try { Thread.sleep(TimeUnit.SECONDS.toMillis( processProfile.getRetryInterval())); } catch (InterruptedException e) { WGLOG.error(e, "E01002", script.getName(), script.getSourceScript().getResourceName(), script.getDrainScript().getResourceName()); throw (IOException) new InterruptedIOException().initCause(e); } } } WGLOG.info("I01001", script.getName(), script.getSourceScript().getResourceName(), script.getDrainScript().getResourceName(), attempt); } finally { long end = System.currentTimeMillis(); WGLOG.info("I01999", script.getName(), script.getSourceScript().getResourceName(), script.getDrainScript().getResourceName(), end - start); } }  @Override void execute(DriverFactory drivers, ProcessScript<T> script); }
RetryableProcessProvider extends ProcessProvider { @Override public <T> void execute(DriverFactory drivers, ProcessScript<T> script) throws IOException { int maxAttempts = processProfile.getRetryCount() + 1; WGLOG.info("I01000", script.getName(), script.getSourceScript().getResourceName(), script.getDrainScript().getResourceName(), processProfile.getRetryCount()); long start = System.currentTimeMillis(); try { int attempt = 1; while (true) { assert attempt <= maxAttempts; try { processProfile.getComponent().execute(drivers, script); break; } catch (InterruptedIOException e) { WGLOG.error(e, "E01002", script.getName(), script.getSourceScript().getResourceName(), script.getDrainScript().getResourceName()); throw e; } catch (IOException e) { if (attempt < maxAttempts) { WGLOG.warn(e, "W01001", script.getName(), script.getSourceScript().getResourceName(), script.getDrainScript().getResourceName(), attempt, processProfile.getRetryCount()); attempt++; } else { WGLOG.error(e, "E01001", script.getName(), script.getSourceScript().getResourceName(), script.getDrainScript().getResourceName(), maxAttempts); throw e; } } if (processProfile.getRetryInterval() > 0) { try { Thread.sleep(TimeUnit.SECONDS.toMillis( processProfile.getRetryInterval())); } catch (InterruptedException e) { WGLOG.error(e, "E01002", script.getName(), script.getSourceScript().getResourceName(), script.getDrainScript().getResourceName()); throw (IOException) new InterruptedIOException().initCause(e); } } } WGLOG.info("I01001", script.getName(), script.getSourceScript().getResourceName(), script.getDrainScript().getResourceName(), attempt); } finally { long end = System.currentTimeMillis(); WGLOG.info("I01999", script.getName(), script.getSourceScript().getResourceName(), script.getDrainScript().getResourceName(), end - start); } }  @Override void execute(DriverFactory drivers, ProcessScript<T> script);  }