private List<Object> closePipeline(boolean getResults) { pipelineRequested = false; List<Object> results = Collections.emptyList(); if (pipeline != null) { pipeline = null; if (getResults) { results = getPipelinedResults(); } callback.close(); callback = null; } return results; }
private List<Object> getPipelinedResults() { List<Object> execute = new ArrayList<Object>(callback.complete()); if (execute != null && !execute.isEmpty()) { Exception cause = null; for (int i = 0; i < execute.size(); i++) { Object object = execute.get(i); if (object instanceof Exception) { DataAccessException dataAccessException = convertSrpAccessException((Exception) object); if (cause == null) { cause = dataAccessException; } execute.set(i, dataAccessException); } } if (cause != null) { throw new RedisPipelineException(cause, execute); } return execute; } return Collections.emptyList(); }
// processing method that adds a listener to the future in order to track down the results and // close the pipeline private void pipeline(ListenableFuture<? extends Reply> future) { callback.addCommand(future); }