Top Description Inners Fields Constructors Methods
org.jabref.logic.util

public Class HeadlessExecutorService

extends Object
implements Executor
Class Inheritance
All Implemented Interfaces
java.util.concurrent.Executor
Imports
java.util.Collection, .Collections, .List, .Objects, .Timer, .TimerTask, java.util.concurrent.Callable, .ExecutionException, .Executor, .ExecutorService, .Executors, .Future, .TimeUnit, org.jabref.gui.FallbackExceptionHandler, org.jabref.gui.util.UiTaskExecutor, org.jabref.logic.pdf.search.PdfIndexerManager, org.slf4j.Logger, .LoggerFactory

Responsible for managing of all threads (except GUI threads) in JabRef.

GUI background tasks should run in UiTaskExecutor.

This is a wrapper around ExecutorService

Offers both high-priority and low-priority thread pools.

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private final ExecutorService
public static final HeadlessExecutorService
private static final Logger
private final ExecutorService
private Thread
private final Timer

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public void
execute(Runnable
the runnable task
command
)

Implements java.util.concurrent.Executor.execute.

Executes the given command at some time in the future.

public <T> Future<T>

Returns:

A Future object that provides the returning value.
execute
(Callable<T>
The task to execute.
command
)

Executes a callable task that provides a return value after the calculation is done.

public <T> List<Future<T>>

Returns:

A List of Future objects that provide the returning values.
executeAll
(Collection<Callable<T>>
The tasks to execute
tasks
)

Executes a collection of callable tasks and returns a List of the resulting Future objects after the calculation is done.

public <T> List<Future<T>>
executeAll(Collection<Callable<T>> tasks, int timeout, TimeUnit timeUnit)

public void
public void
executeInterruptableTask(final Runnable runnable, String taskName)

public void
public static void
gracefullyShutdown(ExecutorService executorService)

Shuts down the provided executor service by first trying a normal shutdown, then waiting for the shutdown and then forcibly shutting it down.

public void
shutdownEverything()

Shuts everything down.

public void
public void
public void
submit(TimerTask timerTask, long millisecondsDelay)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

executorServiceback to summary
private final ExecutorService executorService
INSTANCEback to summary
public static final HeadlessExecutorService INSTANCE
LOGGERback to summary
private static final Logger LOGGER
lowPriorityExecutorServiceback to summary
private final ExecutorService lowPriorityExecutorService
remoteThreadback to summary
private Thread remoteThread
timerback to summary
private final Timer timer

Constructor Detail

HeadlessExecutorServiceback to summary
private HeadlessExecutorService()

Method Detail

executeback to summary
public void execute(Runnable command)

Implements java.util.concurrent.Executor.execute.

Doc from java.util.concurrent.Executor.execute.

Executes the given command at some time in the future. The command may execute in a new thread, in a pooled thread, or in the calling thread, at the discretion of the Executor implementation.

Parameters
command:Runnable

the runnable task

executeback to summary
public <T> Future<T> execute(Callable<T> command)

Executes a callable task that provides a return value after the calculation is done.

Parameters
command:Callable<T>

The task to execute.

Returns:Future<T>

A Future object that provides the returning value.

executeAllback to summary
public <T> List<Future<T>> executeAll(Collection<Callable<T>> tasks)

Executes a collection of callable tasks and returns a List of the resulting Future objects after the calculation is done.

Parameters
tasks:Collection<Callable<T>>

The tasks to execute

Returns:List<Future<T>>

A List of Future objects that provide the returning values.

executeAllback to summary
public <T> List<Future<T>> executeAll(Collection<Callable<T>> tasks, int timeout, TimeUnit timeUnit)
executeAndWaitback to summary
public void executeAndWait(Runnable command)
executeInterruptableTaskback to summary
public void executeInterruptableTask(final Runnable runnable, String taskName)
executeInterruptableTaskAndWaitback to summary
public void executeInterruptableTaskAndWait(Runnable runnable)
gracefullyShutdownback to summary
public static void gracefullyShutdown(ExecutorService executorService)

Shuts down the provided executor service by first trying a normal shutdown, then waiting for the shutdown and then forcibly shutting it down. Returns if the status of the shut down is known.

shutdownEverythingback to summary
public void shutdownEverything()

Shuts everything down. After termination, this method returns.

startRemoteThreadback to summary
public void startRemoteThread(Thread thread)
stopRemoteThreadback to summary
public void stopRemoteThread()
submitback to summary
public void submit(TimerTask timerTask, long millisecondsDelay)
org.jabref.logic.util back to summary

private Class HeadlessExecutorService.NamedRunnable

extends Object
implements Runnable
Class Inheritance
All Implemented Interfaces
java.lang.Runnable

Field Summary

Modifier and TypeField and Description
private final String
private final Runnable

Constructor Summary

AccessConstructor and Description
private
NamedRunnable(String name, Runnable runnable)

Method Summary

Modifier and TypeMethod and Description
public void
run()

Implements java.lang.Runnable.run.

Runs this operation.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

nameback to summary
private final String name
taskback to summary
private final Runnable task

Constructor Detail

NamedRunnableback to summary
private NamedRunnable(String name, Runnable runnable)

Method Detail

runback to summary
public void run()

Implements java.lang.Runnable.run.

Doc from java.lang.Runnable.run.

Runs this operation.

Annotations
@Override