List of usage examples for java.util.concurrent ExecutorService submit
Future<?> submit(Runnable task);
From source file:apiserver.services.pdf.service.UrlToPdfCFService.java
public Object execute(Message<?> message) throws ColdFusionException { Url2PdfResult props = (Url2PdfResult) message.getPayload(); try {/*from w ww. j a va2 s . c om*/ long startTime = System.nanoTime(); Grid grid = verifyGridConnection(); // Get grid-enabled executor service for nodes where attribute 'coldfusion-worker' is defined. ExecutorService exec = getColdFusionExecutor(); Future<ByteArrayResult> future = exec.submit(new UrlToPdfCallable(props.getPath(), props.getOptions())); ByteArrayResult _result = future.get(defaultTimeout, TimeUnit.SECONDS); props.setResult(_result.getBytes()); long endTime = System.nanoTime(); log.debug("execution times: CF=" + _result.getStats().getExecutionTime() + "ms -- total=" + (endTime - startTime) + "ms"); return props; } catch (Exception ge) { throw new RuntimeException(ge); } }
From source file:apiserver.services.pdf.service.ExtractPdfTextCFService.java
public Object execute(Message<?> message) throws ColdFusionException { ExtractTextResult props = (ExtractTextResult) message.getPayload(); try {// ww w. j a v a 2 s . c o m long startTime = System.nanoTime(); Grid grid = verifyGridConnection(); // Get grid-enabled executor service for nodes where attribute 'worker' is defined. ExecutorService exec = getColdFusionExecutor(); Future<StringResult> future = exec .submit(new ExtractTextCallable(props.getFile().getFileBytes(), props.getOptions())); StringResult _result = future.get(defaultTimeout, TimeUnit.SECONDS); props.setResult(_result.getResult()); long endTime = System.nanoTime(); log.debug("execution times: CF=" + _result.getStats().getExecutionTime() + "ms -- total=" + (endTime - startTime) + "ms"); return props; } catch (Exception ge) { throw new RuntimeException(ge); } }
From source file:apiserver.services.pdf.service.AddFooterToPdfCFService.java
public Object execute(Message<?> message) throws ColdFusionException { AddFooterPdfResult props = (AddFooterPdfResult) message.getPayload(); try {// ww w . java2 s . c om long startTime = System.nanoTime(); Grid grid = verifyGridConnection(); // Get grid-enabled executor service for nodes where attribute 'worker' is defined. ExecutorService exec = getColdFusionExecutor(); Future<ByteArrayResult> future = exec .submit(new AddFooterCallable(props.getFile().getFileBytes(), props.getOptions())); ByteArrayResult _result = future.get(defaultTimeout, TimeUnit.SECONDS); props.setResult(_result.getBytes()); long endTime = System.nanoTime(); log.debug("execution times: CF=" + _result.getStats().getExecutionTime() + "ms -- total=" + (endTime - startTime) + "ms"); return props; } catch (Exception ge) { throw new RuntimeException(ge); } }
From source file:apiserver.services.pdf.service.AddHeaderToPdfCFService.java
public Object execute(Message<?> message) throws ColdFusionException { AddHeaderPdfResult props = (AddHeaderPdfResult) message.getPayload(); try {/*ww w. j a va 2 s .c o m*/ long startTime = System.nanoTime(); Grid grid = verifyGridConnection(); // Get grid-enabled executor service for nodes where attribute 'worker' is defined. ExecutorService exec = getColdFusionExecutor(); Future<ByteArrayResult> future = exec .submit(new AddFooterCallable(props.getFile().getFileBytes(), props.getOptions())); ByteArrayResult _result = future.get(defaultTimeout, TimeUnit.SECONDS); props.setResult(_result.getBytes()); long endTime = System.nanoTime(); log.debug("execution times: CF=" + _result.getStats().getExecutionTime() + "ms -- total=" + (endTime - startTime) + "ms"); return props; } catch (Exception ge) { throw new RuntimeException(ge); } }
From source file:apiserver.services.pdf.service.AddPdfWatermarkCFService.java
public Object execute(Message<?> message) throws ColdFusionException { WatermarkPdfResult props = (WatermarkPdfResult) message.getPayload(); try {/* w w w .j ava 2 s . c om*/ long startTime = System.nanoTime(); Grid grid = verifyGridConnection(); // Get grid-enabled executor service for nodes where attribute 'worker' is defined. ExecutorService exec = getColdFusionExecutor(); Future<ByteArrayResult> future = exec .submit(new AddWatermarkCallable(props.getFile().getFileBytes(), props.getOptions())); ByteArrayResult _result = future.get(defaultTimeout, TimeUnit.SECONDS); props.setResult(_result.getBytes()); long endTime = System.nanoTime(); log.debug("execution times: CF=" + _result.getStats().getExecutionTime() + "ms -- total=" + (endTime - startTime) + "ms"); return props; } catch (Exception ge) { throw new RuntimeException(ge); } }
From source file:apiserver.services.pdf.service.DeletePdfPagesCFService.java
public Object execute(Message<?> message) throws ColdFusionException { DeletePdfPagesResult props = (DeletePdfPagesResult) message.getPayload(); try {// w w w . j ava2s . c om long startTime = System.nanoTime(); Grid grid = verifyGridConnection(); // Get grid-enabled executor service for nodes where attribute 'worker' is defined. ExecutorService exec = getColdFusionExecutor(); Future<ByteArrayResult> future = exec .submit(new DeletePagesCallable(props.getFile().getFileBytes(), props.getOptions())); ByteArrayResult _result = future.get(defaultTimeout, TimeUnit.SECONDS); props.setResult(_result.getBytes()); long endTime = System.nanoTime(); log.debug("execution times: CF=" + _result.getStats().getExecutionTime() + "ms -- total=" + (endTime - startTime) + "ms"); return props; } catch (Exception ge) { throw new RuntimeException(ge); } }
From source file:apiserver.services.pdf.service.HtmlToPdfCFService.java
public Object execute(Message<?> message) throws ColdFusionException { Html2PdfResult props = (Html2PdfResult) message.getPayload(); try {/*from w ww. j ava 2 s . co m*/ long startTime = System.nanoTime(); Grid grid = verifyGridConnection(); // Get grid-enabled executor service for nodes where attribute 'worker' is defined. ExecutorService exec = getColdFusionExecutor(); Future<ByteArrayResult> future = exec.submit(new HtmlToPdfCallable(props.getHtml(), props.getHeaderHtml(), props.getFooterHtml(), props.getOptions())); ByteArrayResult _result = future.get(defaultTimeout, TimeUnit.SECONDS); props.setResult(_result.getBytes()); long endTime = System.nanoTime(); log.debug("execution times: CF=" + _result.getStats().getExecutionTime() + "ms -- total=" + (endTime - startTime) + "ms"); return props; } catch (Exception ge) { throw new RuntimeException(ge); } }
From source file:apiserver.services.pdf.service.OptimizePdfCFService.java
public Object execute(Message<?> message) throws ColdFusionException { OptimizePdfResult props = (OptimizePdfResult) message.getPayload(); try {// w ww . j a v a 2s .co m long startTime = System.nanoTime(); Grid grid = verifyGridConnection(); // Get grid-enabled executor service for nodes where attribute 'worker' is defined. ExecutorService exec = getColdFusionExecutor(); Future<ByteArrayResult> future = exec .submit(new OptimizePdfCallable(props.getFile().getFileBytes(), props.getOptions())); ByteArrayResult _result = future.get(defaultTimeout, TimeUnit.SECONDS); props.setResult(_result.getBytes()); long endTime = System.nanoTime(); log.debug("execution times: CF=" + _result.getStats().getExecutionTime() + "ms -- total=" + (endTime - startTime) + "ms"); return props; } catch (Exception ge) { throw new RuntimeException(ge); } }
From source file:apiserver.services.pdf.service.ProcessPdfDDXCFService.java
public Object execute(Message<?> message) throws ColdFusionException { DDXPdfResult props = (DDXPdfResult) message.getPayload(); try {/* w w w .jav a 2 s .co m*/ long startTime = System.nanoTime(); Grid grid = verifyGridConnection(); // Get grid-enabled executor service for nodes where attribute 'worker' is defined. ExecutorService exec = getColdFusionExecutor(); Future<ByteArrayResult> future = exec .submit(new ProcessDDXCallable(props.getFile().getFileBytes(), props.getDdx())); ByteArrayResult _result = future.get(defaultTimeout, TimeUnit.SECONDS); props.setResult(_result.getBytes()); long endTime = System.nanoTime(); log.debug("execution times: CF=" + _result.getStats().getExecutionTime() + "ms -- total=" + (endTime - startTime) + "ms"); return props; } catch (Exception ge) { throw new RuntimeException(ge); } }
From source file:apiserver.services.pdf.service.RemotePdfWatermarkCFService.java
public Object execute(Message<?> message) throws ColdFusionException { WatermarkPdfResult props = (WatermarkPdfResult) message.getPayload(); try {//from www . j a v a 2 s . co m long startTime = System.nanoTime(); Grid grid = verifyGridConnection(); // Get grid-enabled executor service for nodes where attribute 'worker' is defined. ExecutorService exec = getColdFusionExecutor(); Future<ByteArrayResult> future = exec .submit(new RemoveWatermarkCallable(props.getFile().getFileBytes(), props.getOptions())); ByteArrayResult _result = future.get(defaultTimeout, TimeUnit.SECONDS); props.setResult(_result.getBytes()); long endTime = System.nanoTime(); log.debug("execution times: CF=" + _result.getStats().getExecutionTime() + "ms -- total=" + (endTime - startTime) + "ms"); return props; } catch (Exception ge) { throw new RuntimeException(ge); } }