@Test public void testExecuteExecutor() throws Exception { TikaConfig config = TikaConfig.getDefaultConfig(); ParseContext context = new ParseContext(); context.set(ExecutorService.class, config.getExecutorService()); Future result = ConcurrentUtils.execute(context, new Runnable() { @Override public void run() { } }); assertNull(result.get()); }
public static Future execute(ParseContext context, Runnable runnable) { Future future = null; ExecutorService executorService = context.get(ExecutorService.class); if(executorService == null) { FutureTask task = new FutureTask<>(runnable, null); Thread thread = new Thread(task, "Tika Thread"); thread.start(); future = task; } else { future = executorService.submit(runnable); } return future; }
ConcurrentUtils { public static Future execute(ParseContext context, Runnable runnable) { Future future = null; ExecutorService executorService = context.get(ExecutorService.class); if(executorService == null) { FutureTask task = new FutureTask<>(runnable, null); Thread thread = new Thread(task, "Tika Thread"); thread.start(); future = task; } else { future = executorService.submit(runnable); } return future; } }
ConcurrentUtils { public static Future execute(ParseContext context, Runnable runnable) { Future future = null; ExecutorService executorService = context.get(ExecutorService.class); if(executorService == null) { FutureTask task = new FutureTask<>(runnable, null); Thread thread = new Thread(task, "Tika Thread"); thread.start(); future = task; } else { future = executorService.submit(runnable); } return future; }  }
ConcurrentUtils { public static Future execute(ParseContext context, Runnable runnable) { Future future = null; ExecutorService executorService = context.get(ExecutorService.class); if(executorService == null) { FutureTask task = new FutureTask<>(runnable, null); Thread thread = new Thread(task, "Tika Thread"); thread.start(); future = task; } else { future = executorService.submit(runnable); } return future; }  static Future execute(ParseContext context, Runnable runnable); }
ConcurrentUtils { public static Future execute(ParseContext context, Runnable runnable) { Future future = null; ExecutorService executorService = context.get(ExecutorService.class); if(executorService == null) { FutureTask task = new FutureTask<>(runnable, null); Thread thread = new Thread(task, "Tika Thread"); thread.start(); future = task; } else { future = executorService.submit(runnable); } return future; }  static Future execute(ParseContext context, Runnable runnable);  }