private void throwDataNotAvailable(BatchResultInfo info) { int waitCount = info.incrementAndGetWaitCount(); LogManager.logTrace(LogConstants.CTX_CONNECTOR, "Waiting on queued/inprogress, wait number", waitCount); //$NON-NLS-1$ throw new DataNotAvailableException(pollingInterval * Math.min(8, waitCount)); }
@Override public BatchResult[] getBulkResults(JobInfo job, List<String> ids) throws ResourceException { try { JobInfo info = this.bulkConnection.getJobStatus(job.getId()); if (info.getNumberBatchesTotal() != info.getNumberBatchesFailed() + info.getNumberBatchesCompleted()) { throw new DataNotAvailableException(pollingInterval); } BatchResult[] results = new BatchResult[ids.size()]; for (int i = 0; i < ids.size(); i++) { results[i] = this.bulkConnection.getBatchResult(job.getId(), ids.get(i)); } return results; } catch (AsyncApiException e) { throw new ResourceException(e); } }
@Override public AtomicResultsMessage more() throws TranslatorException { if (dataNotAvailable != null) { int delay = dataNotAvailable; dataNotAvailable = null; DataNotAvailableException dnae = new DataNotAvailableException(delay); dnae.setStrict(strict); throw dnae; } if (addWarning) { msg.setWarnings(Arrays.asList(new Exception())); } if (!returnedInitial) { returnedInitial = true; return msg; } throw new RuntimeException("Should not be called"); //$NON-NLS-1$ }