public class WorkerService extends Object
Modifier and Type | Class and Description |
---|---|
static class |
WorkerService.WorkRequest
Callers should implement a class extending WorkRequest in order to
schedule work with the service.
|
Constructor and Description |
---|
WorkerService(String name,
int numThreads,
boolean useAssignableThreads) |
Modifier and Type | Method and Description |
---|---|
void |
join(long shutdownTimeoutMS) |
void |
schedule(WorkerService.WorkRequest workRequest)
Schedule work to be done.
|
void |
schedule(WorkerService.WorkRequest workRequest,
long id)
Schedule work to be done by the thread assigned to this id.
|
void |
start() |
void |
stop() |
public WorkerService(String name, int numThreads, boolean useAssignableThreads)
name
- worker threads are named <name>Thread-##numThreads
- number of worker threads (0 - N)
If 0, scheduled work is run immediately by
the calling thread.useAssignableThreads
- whether the worker threads should be
individually assignable or notpublic void schedule(WorkerService.WorkRequest workRequest)
public void schedule(WorkerService.WorkRequest workRequest, long id)
public void start()
public void stop()
public void join(long shutdownTimeoutMS)
Copyright © 2008–2021 The Apache Software Foundation. All rights reserved.