Top Description Methods
org.jabref.logic.util

public Interface TaskExecutor

Known Direct Implementers
org.jabref.gui.util.UiTaskExecutor, org.jabref.logic.util.CurrentThreadTaskExecutor
Imports
java.util.concurrent.Future, .TimeUnit

An object that executes submitted javafx.concurrent.Tasks. This interface provides a way of decoupling task submission from the mechanics of how each task will be run, including details of thread use, scheduling, thread pooling, etc.

Method Summary

Modifier and TypeMethod and Description
public DelayTaskThrottler
createThrottler(int delay)

Creates a new task throttler, and registers it so that it gets properly shutdown.

public <
type of return value of the task
V
>
Future<V>
execute(BackgroundTask<V>
the task to run
task
)

Runs the given task and returns a Future representing that task.

public <V> Future<?>

Returns:

a ScheduledFuture representing pending completion of the task and whose get() method will return null upon completion
schedule
(BackgroundTask<V>
the task to execute
task
,
long
the time from now to delay execution
delay
,
TimeUnit
the time unit of the delay parameter
unit
)

Submits a one-shot task that becomes enabled after the given delay.

public void
shutdown()

Shutdown the task executor.

Method Detail

createThrottlerback to summary
public DelayTaskThrottler createThrottler(int delay)

Creates a new task throttler, and registers it so that it gets properly shutdown.

executeback to summary
public <V> Future<V> execute(BackgroundTask<V> task)

Runs the given task and returns a Future representing that task.

Parameters
<V>
type of return value of the task
task:BackgroundTask<V>

the task to run

scheduleback to summary
public <V> Future<?> schedule(BackgroundTask<V> task, long delay, TimeUnit unit)

Submits a one-shot task that becomes enabled after the given delay.

Parameters
task:BackgroundTask<V>

the task to execute

delay:long

the time from now to delay execution

unit:TimeUnit

the time unit of the delay parameter

Returns:Future<?>

a ScheduledFuture representing pending completion of the task and whose get() method will return null upon completion

shutdownback to summary
public void shutdown()

Shutdown the task executor. May happen in the background or may be finished when this method returns.