/** * Commits documents and delete them from queue when done. * @param batch the bath of operations to commit. */ private void commitAndCleanBatch(List<ICommitOperation> batch) { int numTries = 0; boolean success = false; while (!success) { try { commitBatch(batch); success = true; } catch (Exception e) { if (numTries < maxRetries) { LOG.error("Could not commit batched operations.", e); Sleeper.sleepMillis(maxRetryWait); numTries++; } else { throw (RuntimeException) e; } } } // Delete queued documents after commit for (ICommitOperation op : batch) { op.delete(); } batch.clear(); }
@Override public void run() { monitoring = true; while(monitoring) { if (stopFile.exists()) { stopMonitoring(); stopSuite(); } Sleeper.sleepSeconds(1); } }
@Override public void run() { try { while(!terminate) { for (MutableJobStatus status : statuses) { status.setLastActivity( new Date(suite.getJobStatusStore().touch( suite.getId(), status.getJobId()))); } Sleeper.sleepMillis(HEARTBEAT_INTERVAL); } } catch (IOException e) { throw new JEFException("Cannot update status heartbeat.", e); } }
private void stopJob(final IJob job, final IJobStatus status) { ((MutableJobStatus) status).setStopRequested(true); job.stop(status, suite); while (status.isRunning()) { Sleeper.sleepSeconds(STOP_WAIT_DELAY); } if (status.getState() == JobState.STOPPED) { for (IJobLifeCycleListener l : suite.getJobLifeCycleListeners()) { l.jobStopped(status); } if (job.getId().equals(suite.getRootJob().getId())) { for (ISuiteLifeCycleListener l : suite.getSuiteLifeCycleListeners()) { l.suiteStopped(suite); } } } }
+ attemptCount + " of " + maxRerunAttempts + ").", exception); Sleeper.sleepMillis(sleepTime);
return false; Sleeper.sleepMillis(MINIMUM_DELAY);