18#ifndef _DECAF_UTIL_CONCURRENT_EXECUTORS_H_
19#define _DECAF_UTIL_CONCURRENT_EXECUTORS_H_
34 class ExecutorService;
65 RunnableAdapter(
const RunnableAdapter&);
66 RunnableAdapter operator= (
const RunnableAdapter&);
74 virtual ~RunnableAdapter() {
211 "The Runnable task argument cannot be NULL");
214 return new RunnableAdapter<E>(task, owns, E());
237 "The Runnable task argument cannot be NULL");
240 return new RunnableAdapter<E>(task, owns, result);
245 static void initialize();
246 static void shutdown();
Definition: Threading.h:36
Interface for a runnable object - defines a task that can be run by a thread.
Definition: Runnable.h:29
virtual void run()=0
Run method - called by the Thread class in the context of the thread.
Definition: NullPointerException.h:32
A task that returns a result and may throw an exception.
Definition: Callable.h:47
An Executor that provides methods to manage termination and methods that can produce a Future for tra...
Definition: ExecutorService.h:56
Implements a set of utilities for use with Executors, ExecutorService, ThreadFactory,...
Definition: Executors.h:43
static ExecutorService * newSingleThreadExecutor()
Creates an Executor that uses a single worker thread operating off an unbounded queue owned by the ex...
static Callable< E > * callable(decaf::lang::Runnable *task, bool owns=true)
Returns a Callable object that, when called, runs the given task and returns the default value of the...
Definition: Executors.h:207
static ExecutorService * newSingleThreadExecutor(ThreadFactory *threadFactory)
Creates an Executor that uses a single worker thread operating off an unbounded queue owned by the ex...
static ExecutorService * unconfigurableExecutorService(ExecutorService *executor)
Returns a new ExecutorService derived instance that wraps and takes ownership of the given ExecutorSe...
static ExecutorService * newFixedThreadPool(int nThreads)
Creates a new ThreadPoolExecutor with a fixed number of threads to process incoming tasks.
static Callable< E > * callable(decaf::lang::Runnable *task, const E &result, bool owns=true)
Returns a Callable object that, when called, runs the given task and returns the default value of the...
Definition: Executors.h:233
static ThreadFactory * getDefaultThreadFactory()
Creates and returns a new ThreadFactory that expresses the default behavior for ThreadFactories used ...
static ExecutorService * newFixedThreadPool(int nThreads, ThreadFactory *threadFactory)
Creates a new ThreadPoolExecutor with a fixed number of threads to process incoming tasks.
public interface ThreadFactory
Definition: ThreadFactory.h:52
#define DECAF_CATCHALL_NOTHROW()
A catch-all that does not throw an exception, one use would be to catch any exception in a destructor...
Definition: ExceptionDefines.h:62
#define NULL
Definition: Config.h:33
#define DECAF_API
Definition: Config.h:29
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.
Definition: AprPool.h:25