-
Method Summary
Modifier and TypeMethodDescriptionstatic TaskExecutorServiceReturns aTaskExecutorServicewhich executes tasks submitted to them on the AWT Event Dispatch Thread.static TaskExecutorgetSimpleExecutor(boolean alwaysInvokeLater) Returns aTaskExecutorwhich executes tasks submitted to them on the AWT Event Dispatch Thread.static TaskExecutorgetStrictExecutor(boolean alwaysInvokeLater) Returns aTaskExecutorwhich executes tasks submitted to them on the AWT Event Dispatch Thread.static <IDType,RightType>
BackgroundTaskExecutor<IDType,RightType> getSwingBackgroundTaskExecutor(AccessManager<IDType, RightType> accessManager, TaskExecutor executor) Creates a newBackgroundTaskExecutorto be used with Swing with the given access manager andTaskExecutor.static UiExecutorProviderReturns an implementation ofUiExecutorProviderexecuting scheduled tasks on the AWT Event Dispatch Thread.static TaskExecutorServicegetSwingExecutorService(boolean alwaysInvokeLater) Returns aTaskExecutorServicewhich executes submitted tasks on the AWT Event Dispatch Thread.static UpdateTaskExecutorReturns anUpdateTaskExecutorimplementation which executes tasks on the AWT Event Dispatch Thread.static UpdateTaskExecutorgetSwingUpdateExecutor(boolean alwaysInvokeLater) Returns anUpdateTaskExecutorimplementation which executes tasks on the AWT Event Dispatch Thread.
-
Method Details
-
getDefaultInstance
Returns aTaskExecutorServicewhich executes tasks submitted to them on the AWT Event Dispatch Thread. This method always returns the sameTaskExecutorServiceinstance and is intended to be used as a sensible default value when an executor is need which executes task on the EDT. The returnedTaskExecutorServicecannot be shutted down, attempting to do so will cause an unchecked exception to be thrown.- Returns:
- a
TaskExecutorServicewhich executes tasks submitted to them on the AWT Event Dispatch Thread. This method never returnsnull.
-
getSwingUpdateExecutor
Returns anUpdateTaskExecutorimplementation which executes tasks on the AWT Event Dispatch Thread. The returned executor will not call the scheduled tasks on the calling thread even if the calling thread is the AWT Event Dispatch Thread.This method is effectively the same as calling
getSwingUpdateExecutor(true).- Returns:
- an
UpdateTaskExecutorimplementation which executes tasks on the AWT Event Dispatch Thread. This method never returnsnull.
-
getSwingUpdateExecutor
Returns anUpdateTaskExecutorimplementation which executes tasks on the AWT Event Dispatch Thread.- Parameters:
alwaysInvokeLater- if this argument istrue, submitted tasks are never executed synchronously on the calling thread (i.e.: they are always submitted asSwingUtilities.invokeLaterdoes it). In case this argument isfalse, tasks submitted from the AWT Event Dispatch Thread will be executed immediately on the calling thread (this may not always possible to execute tasks in the order they were submitted).- Returns:
- an
UpdateTaskExecutorimplementation which executes tasks on the AWT Event Dispatch Thread. This method never returnsnull.
-
getSwingExecutorService
Returns aTaskExecutorServicewhich executes submitted tasks on the AWT Event Dispatch Thread. Submitted tasks are executed in the order they were submitted. UnlikeTaskExecutorServiceimplementations in general,SwingTaskExecutorinstances does not need to be shutted down (although shutdown is still possible).In case the services provided by the
TaskExecutorservice are adequate, consider using the more efficient implementations returned by the staticgetSimpleExecutororgetStrictExecutormethods.A static instance can be retrieved by the
getDefaultInstancemethod. The instance returned by this method can be used as a sensible default value.- Parameters:
alwaysInvokeLater- if this argument istrue, submitted tasks are never executed synchronously on the calling thread (i.e.: they are always submitted asSwingUtilities.invokeLaterdoes it). In case this argument isfalse, tasks submitted from the AWT Event Dispatch Thread will be executed immediately on the calling thread (this may not always possible to execute tasks in the order they were submitted).- Returns:
- a
TaskExecutorServicewhich executes submitted tasks on the AWT Event Dispatch Thread. This method never returnsnull. - See Also:
-
getSimpleExecutor
Returns aTaskExecutorwhich executes tasks submitted to them on the AWT Event Dispatch Thread. The returned executor does not necessarily executes tasks in the same order as the tasks were submitted. In case tasks needed to be executed in the same order as they were submitted to the executor: Use thegetStrictExecutor(boolean)method.The returned executor is more efficient than an instance returned by
getSwingExecutorService(boolean).- Parameters:
alwaysInvokeLater- if this argument istrue, submitted tasks are never executed synchronously on the calling thread (i.e.: they are always submitted asSwingUtilities.invokeLaterdoes it). In case this argument isfalse, tasks submitted from the AWT Event Dispatch Thread will be executed immediately on the calling thread.- Returns:
- a
TaskExecutorwhich executes tasks submitted to them on the AWT Event Dispatch Thread. This method never returnsnull. - See Also:
-
getStrictExecutor
Returns aTaskExecutorwhich executes tasks submitted to them on the AWT Event Dispatch Thread. The returned executor executes tasks in the same order as the tasks were submitted. If you don't need to execute them in the same order, consider using thegetSimpleExecutor(boolean)method.The returned executor is more efficient than an instance returned by
getSwingExecutorService(boolean).- Parameters:
alwaysInvokeLater- if this argument istrue, submitted tasks are never executed synchronously on the calling thread (i.e.: they are always submitted asSwingUtilities.invokeLaterdoes it). In case this argument isfalse, tasks submitted from the AWT Event Dispatch Thread will be executed immediately on the calling thread (this may not always possible to execute tasks in the order they were submitted).- Returns:
- a
TaskExecutorwhich executes tasks submitted to them on the AWT Event Dispatch Thread. This method never returnsnull. - See Also:
-
getSwingExecutorProvider
Returns an implementation ofUiExecutorProviderexecuting scheduled tasks on the AWT Event Dispatch Thread.- Returns:
- an implementation of
UiExecutorProviderexecuting scheduled tasks on the AWT Event Dispatch Thread. This method never returnsnull.
-
getSwingBackgroundTaskExecutor
public static <IDType,RightType> BackgroundTaskExecutor<IDType,RightType> getSwingBackgroundTaskExecutor(AccessManager<IDType, RightType> accessManager, TaskExecutor executor) Creates a newBackgroundTaskExecutorto be used with Swing with the given access manager andTaskExecutor.The specified
TaskExecutoris recommended to execute tasks on a separate thread instead of the calling thread, however for debugging purposes it may be beneficial to use theSyncTaskExecutor. The executor should execute tasks on a separate thread to allow methods of this class to be called from the AWT Event Dispatch Thread without actually blocking the EDT.- Type Parameters:
IDType- the type of the request ID of the underlying access managerRightType- the type of the rights handled by the underlying access manager- Parameters:
accessManager- theAccessManagerfrom which access tokens are requested to execute tasks in their context. This argument cannot benull.executor- theTaskExecutorwhich actually executes submitted tasks. This argument cannot benull.- Returns:
- a new
BackgroundTaskExecutorto be used with Swing with the given access manager andTaskExecutor. This method never returnsnull.
-