Source:
<code>public BulkResponse bulkRequest(BulkRequest requests, RequestMetrics metrics) { LOGGER.debug("Bulk request start"); Error.push("bulk operation"); <START> ExecutorService executor = Executors.newFixedThreadPool(factory.getBulkParallelExecutions()); <END> try { LOGGER.debug("Executing up to requests in parallel, ordered = {}", factory.getBulkParallelExecutions(), requests.isOrdered()); List<Request> requestList = requests.getEntries(); int n = requestList.size(); BulkExecutionContext ctx = new BulkExecutionContext(n); ctx.setResultSizeThresholds(factory.getMaxResultSetSizeForReadsB(), factory.getWarnResultSetSizeB(), requests); for (int i = 0; i < n; i++) { Request req = requestList.get(i); if (requests.isOrdered()) { if (req.getOperation() == CRUDOperation.FIND) { ctx.futures[i] = executor.submit(getFutureRequest(req, metrics)); } else { wait(ctx); switch (req.getOperation()) { case INSERT: ctx.setResponseAt(i, insert((InsertionRequest) req, metrics)); break; case DELETE: ctx.setResponseAt(i, delete((DeleteRequest) req, metrics)); break; case UPDATE: ctx.setResponseAt(i, update((UpdateRequest) req, metrics)); break; case SAVE: ctx.setResponseAt(i, save((SaveRequest) req, metrics)); break; } } } else { LOGGER.debug("Scheduling a future operation"); ctx.futures[i] = executor.submit(getFutureRequest(req, metrics)); } } wait(ctx); LOGGER.debug("Bulk execution completed"); BulkResponse response = new BulkResponse(); response.setEntries(ctx.getResponses()); Error.pop(); return response; } finally { executor.shutdown(); } }</code><technical_language>fine track bulk request still, other information other a bulk request. else add in a sane I think</technical_language>

Target:
public BulkResponse bulkRequest(BulkRequest requests, RequestMetrics metrics) { LOGGER.debug("Bulk request start"); Error.push("bulk operation"); ExecutorService executor = Executors.newFixedThreadPool(factory.getBulkParallelExecutions()); try { LOGGER.debug("Executing up to requests in parallel, ordered = {}", factory.getBulkParallelExecutions(), requests.isOrdered()); List<Request> requestList = requests.getEntries(); int n = requestList.size(); BulkExecutionContext ctx = new BulkExecutionContext(n); ctx.setResultSizeThresholds(factory.getMaxResultSetSizeForReadsB(), factory.getWarnResultSetSizeB(), requests); for (int i = 0; i < n; i++) { Response resp = null; Request req = requestList.get(i); if (requests.isOrdered()) { if (req.getOperation() == CRUDOperation.FIND) { ctx.futures[i] = executor.submit(getFutureRequest(req, metrics)); } else { wait(ctx); RequestMetrics.Context metricCtx = metrics.startEntityRequest(req.getOperation().toString().toLowerCase(), req.getEntityVersion().getEntity(), req.getEntityVersion().getVersion()); switch (req.getOperation()) { case INSERT: resp = insert((InsertionRequest) req); ctx.setResponseAt(i, resp); break; case DELETE: resp = delete((DeleteRequest) req); ctx.setResponseAt(i, resp); break; case UPDATE: resp = update((UpdateRequest) req); ctx.setResponseAt(i, resp); break; case SAVE: resp = save((SaveRequest) req); ctx.setResponseAt(i, resp); break; } metricCtx.markAllErrorsAndEndRequestMonitoring(resp.getErrors()); } } else { LOGGER.debug("Scheduling a future operation"); ctx.futures[i] = executor.submit(getFutureRequest(req, metrics)); } } wait(ctx); LOGGER.debug("Bulk execution completed"); BulkResponse response = new BulkResponse(); response.setEntries(ctx.getResponses()); Error.pop(); return response; } finally { executor.shutdown(); } }