public class OcrExecutorService extends ThreadPoolExecutor
| Modifier and Type | Class and Description |
|---|---|
static class |
OcrExecutorService.OcrCallable
Represents an OCR task.
|
ThreadPoolExecutor.AbortPolicy, ThreadPoolExecutor.CallerRunsPolicy, ThreadPoolExecutor.DiscardOldestPolicy, ThreadPoolExecutor.DiscardPolicy| Modifier and Type | Field and Description |
|---|---|
static ThreadLocal<Ocr> |
threadLocalOcr |
| Constructor and Description |
|---|
OcrExecutorService(String lang,
String speed)
A service executor with thread count equal to number of CPU core available.
|
OcrExecutorService(String lang,
String speed,
int poolSize)
Creates a new instance of OCR service executor
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
afterExecute(Runnable r,
Throwable t) |
protected void |
beforeExecute(Thread t,
Runnable r) |
static int |
getCpuCores()
Returns number of CPU core available for the current JVM.
|
void |
shutdown() |
void |
stopOcrEngines() |
protected void |
terminated() |
allowCoreThreadTimeOut, allowsCoreThreadTimeOut, awaitTermination, execute, finalize, getActiveCount, getCompletedTaskCount, getCorePoolSize, getKeepAliveTime, getLargestPoolSize, getMaximumPoolSize, getPoolSize, getQueue, getRejectedExecutionHandler, getTaskCount, getThreadFactory, isShutdown, isTerminated, isTerminating, prestartAllCoreThreads, prestartCoreThread, purge, remove, setCorePoolSize, setKeepAliveTime, setMaximumPoolSize, setRejectedExecutionHandler, setThreadFactory, shutdownNow, toStringinvokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskFor, submit, submit, submitpublic static final ThreadLocal<Ocr> threadLocalOcr
public OcrExecutorService(String lang, String speed)
lang - language to recognizespeed - speed settings, e.g., Ocr.SPEED_FASTEST.public OcrExecutorService(String lang, String speed, int poolSize)
lang - language to recognizespeed - speed settings, e.g., Ocr.SPEED_FASTEST.poolSize - number of threads to be used in this executor.protected void beforeExecute(Thread t, Runnable r)
beforeExecute in class ThreadPoolExecutorprotected void afterExecute(Runnable r, Throwable t)
afterExecute in class ThreadPoolExecutorprotected void terminated()
terminated in class ThreadPoolExecutorpublic void shutdown()
shutdown in interface ExecutorServiceshutdown in class ThreadPoolExecutorpublic void stopOcrEngines()
public static int getCpuCores()
Copyright © 2015. All Rights Reserved.