@Override public void retryListener(QueryBatch batch, QueryBatchListener queryBatchListener) { // We get the batch and modify the client alone in order to make use // of the new forest client in case if the original host is unavailable. DatabaseClient client = null; Forest[] forests = batch.getBatcher().getForestConfig().listForests(); for(Forest forest : forests) { if(forest.equals(batch.getForest())) client = getMoveMgr().getForestClient(forest); } QueryBatchImpl retryBatch = new QueryBatchImpl() .withClient( client ) .withBatcher( batch.getBatcher() ) .withTimestamp( batch.getTimestamp() ) .withServerTimestamp( batch.getServerTimestamp() ) .withItems( batch.getItems() ) .withJobTicket( batch.getJobTicket() ) .withJobBatchNumber( batch.getJobBatchNumber() ) .withJobResultsSoFar( batch.getJobResultsSoFar() ) .withForestBatchNumber( batch.getForestBatchNumber() ) .withForestResultsSoFar( batch.getForestResultsSoFar() ) .withForest( batch.getForest() ) .withJobTicket( batch.getJobTicket() ); queryBatchListener.processEvent(retryBatch); }
public void run() { QueryBatchImpl batch = new QueryBatchImpl() .withBatcher(batcher) .withTimestamp(Calendar.getInstance()) .withJobTicket(getJobTicket()); try { long currentBatchNumber = batchNumber.incrementAndGet(); int clientIndex = (int) (currentBatchNumber % currentClientList.size()); DatabaseClient client = currentClientList.get(clientIndex); batch = batch.withJobBatchNumber(currentBatchNumber) .withClient(client) .withJobResultsSoFar(resultsSoFar.addAndGet(uris.size())) .withItems(uris.toArray(new String[uris.size()])); logger.trace("batch size={}, jobBatchNumber={}, jobResultsSoFar={}", uris.size(), batch.getJobBatchNumber(), batch.getJobResultsSoFar()); for (QueryBatchListener listener : urisReadyListeners) { try { batch = batch.withItems(uris.toArray(new String[uris.size()])); for (QueryFailureListener listener : failureListeners) { try {
Runnable processBatch = new Runnable() { public void run() { QueryBatchImpl batch = new QueryBatchImpl() .withBatcher(batcher) .withTimestamp(Calendar.getInstance()) QueryBatchImpl batch = new QueryBatchImpl() .withItems(new String[0]) .withClient(clientList.get().get(0)) .withBatcher(batcher) .withTimestamp(Calendar.getInstance()) .withJobResultsSoFar(0);
QueryBatchImpl batch = new QueryBatchImpl() .withBatcher(batcher) .withClient(client) .withTimestamp(queryStart) .withJobTicket(getJobTicket()) .withForestBatchNumber(forestBatchNum) .withForest(forest); if ( retryBatchNumber != -1 ) { batch = batch.withJobBatchNumber(retryBatchNumber); } else { batch = batch.withJobBatchNumber(batchNumber.incrementAndGet()); .withItems(uris.toArray(new String[uris.size()])) .withServerTimestamp(serverTimestamp.get()) .withJobResultsSoFar(resultsSoFar.addAndGet(uris.size())) .withForestResultsSoFar(forestResults.get(forest).addAndGet(uris.size())); batch.getJobBatchNumber(), batch.getJobResultsSoFar(), forest.getForestName()); .withJobResultsSoFar(resultsSoFar.get()) .withForestResultsSoFar(forestResults.get(forest).get()); for ( QueryFailureListener listener : failureListeners ) { try {
services.postResource(null, "internal/apply-transform", null, params, uris, new ReaderHandle()).get() ).lines().collect(Collectors.toList()); QueryBatchImpl processedBatch = new QueryBatchImpl() .withClient( batch.getClient() ) .withItems( responseUris.toArray(new String[responseUris.size()]) ) .withTimestamp( batch.getTimestamp() ) .withJobBatchNumber( batch.getJobBatchNumber() ) .withJobResultsSoFar( batch.getJobResultsSoFar() ) .withForestBatchNumber( batch.getForestBatchNumber() ) .withForestResultsSoFar( batch.getForestResultsSoFar() ) .withForest( batch.getForest() ) .withServerTimestamp( batch.getServerTimestamp() ) .withJobTicket( batch.getJobTicket() ); for ( QueryBatchListener listener : successListeners ) { try { if ( skippedRequestUris.size() > 0 ) { QueryBatchImpl skippedBatch = processedBatch .withItems( skippedRequestUris.toArray(new String[0]) ); for ( QueryBatchListener listener : skippedListeners ) { try {