private Object executeCollator() throws ExecutionException, Exception { if (collator == null) { if (timeout > 0) { redisson.getMap(resultMapName).clearExpire(); } return null; } Callable<Object> collatorTask = new CollatorTask<KOut, VOut, Object>(redisson, collator, resultMapName, objectCodecClass); long timeSpent = System.currentTimeMillis() - startTime; if (isTimeoutExpired(timeSpent)) { throw new MapReduceTimeoutException(); } if (timeout > 0) { ExecutorService executor = ((Redisson) redisson).getConnectionManager().getExecutor(); java.util.concurrent.Future<?> collatorFuture = executor.submit(collatorTask); try { return collatorFuture.get(timeout - timeSpent, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { return null; } catch (TimeoutException e) { collatorFuture.cancel(true); throw new MapReduceTimeoutException(); } } else { return collatorTask.call(); } }
private Object executeCollator() throws ExecutionException, Exception { if (collator == null) { if (timeout > 0) { redisson.getMap(resultMapName).clearExpire(); } return null; } Callable<Object> collatorTask = new CollatorTask<KOut, VOut, Object>(redisson, collator, resultMapName, objectCodecClass); long timeSpent = System.currentTimeMillis() - startTime; if (isTimeoutExpired(timeSpent)) { throw new MapReduceTimeoutException(); } if (timeout > 0) { ExecutorService executor = ((Redisson) redisson).getConnectionManager().getExecutor(); java.util.concurrent.Future<?> collatorFuture = executor.submit(collatorTask); try { return collatorFuture.get(timeout - timeSpent, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { return null; } catch (TimeoutException e) { collatorFuture.cancel(true); throw new MapReduceTimeoutException(); } } else { return collatorTask.call(); } }
private Object executeCollator() throws ExecutionException, Exception { if (collator == null) { if (timeout > 0) { redisson.getMap(resultMapName).clearExpire(); } return null; } Callable<Object> collatorTask = new CollatorTask<KOut, VOut, Object>(redisson, collator, resultMapName, objectCodecClass); long timeSpent = System.currentTimeMillis() - startTime; if (isTimeoutExpired(timeSpent)) { throw new MapReduceTimeoutException(); } if (timeout > 0) { ExecutorService executor = ((Redisson) redisson).getConnectionManager().getExecutor(); java.util.concurrent.Future<?> collatorFuture = executor.submit(collatorTask); try { return collatorFuture.get(timeout - timeSpent, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { return null; } catch (TimeoutException e) { collatorFuture.cancel(true); throw new MapReduceTimeoutException(); } } else { return collatorTask.call(); } }