|
Search this API | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objecty.util.TaskExecutorFactory
public abstract class TaskExecutorFactory
Base factory class for creating TaskExecutor instances.
Use setDefault(TaskExecutorFactory) to set a specific factory
implementation to be used by algorithms which support multi-threaded
execution.

| Field Summary | |
|---|---|
static TaskExecutorFactory |
DEFAULT
Shared instance of the default TaskExecutorFactory. |
static TaskExecutorFactory |
MULTI_THREADED
Shared instance of a TaskExecutorFactory that creates TaskExecutors that execute tasks in
parallel, i.e., multi-threaded. |
static TaskExecutorFactory |
SINGLE_THREADED
Shared instance of a TaskExecutorFactory that creates TaskExecutors that execute tasks in a
single thread, that is, one after another. |
| Constructor Summary | |
|---|---|
TaskExecutorFactory()
|
|
| Method Summary | |
|---|---|
abstract TaskExecutor |
createExecutor()
Creates a new TaskExecutor. |
static TaskExecutorFactory |
getDefault()
Returns the factory used to create new TaskExecutors. |
static void |
setDefault(TaskExecutorFactory factory)
Sets the factory used to create new TaskExecutors. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final TaskExecutorFactory DEFAULT
TaskExecutorFactory.
This factory does not actually create TaskExecutor instances,
but delegates instance creation to a dynamically determined factory.
This is done as follows:
First, this factory tries to load a factory that is declared as service
provider in META-INF/services (see ServiceRegistry
for details). If there are multiple provider implementations available,
one is chosen randomly.
If loading a service provider fails, then this factory tries to load
MultiThreadedTaskExecutorFactory via reflection.
If loading MultiThreadedTaskExecutorFactory fails, too,
the MULTI_THREADED factory instance is used.
public static final TaskExecutorFactory SINGLE_THREADED
TaskExecutorFactory that creates TaskExecutors that execute tasks in a
single thread, that is, one after another.
public static final TaskExecutorFactory MULTI_THREADED
TaskExecutorFactory that creates TaskExecutors that execute tasks in
parallel, i.e., multi-threaded. The number of created threads is limited by the minimum of the
size of the given task list (see method TaskExecutor.execute(java.util.List)) and
the number of available processors as returned by
method java.lang.Runtime.getRuntime().availableProcessors().
| Constructor Detail |
|---|
public TaskExecutorFactory()
| Method Detail |
|---|
public static TaskExecutorFactory getDefault()
TaskExecutors.
By default, DEFAULT is returned.
TaskExecutor.public static void setDefault(TaskExecutorFactory factory)
TaskExecutors.
factory - The factory used to create new TaskExecutor.public abstract TaskExecutor createExecutor()
TaskExecutor.
TaskExecutor.
|
© Copyright 2000-2025, yWorks GmbH. All rights reserved. |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||