Interface ServiceExecutor
-
- All Known Implementing Classes:
StampedLockServiceExecutor
@Deprecated(forRemoval=true) public interface ServiceExecutor extends Executor
Deprecated, for removal: This API element is subject to removal in a future version.To be removed without replacementAllows safe invocation of tasks that require resources not available afterclose(Runnable)to block a service from stopping.- Author:
- Paul Ferraro
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description voidclose(Runnable closeTask)Deprecated, for removal: This API element is subject to removal in a future version.Closes the service, executing the specified task, first waiting for any concurrent executions to complete.<R> Optional<R>execute(Supplier<R> executeTask)Deprecated, for removal: This API element is subject to removal in a future version.Executes the specified task, but only if the service was not already closed.<R,E extends Exception>
Optional<R>execute(org.wildfly.common.function.ExceptionSupplier<R,E> executeTask)Deprecated, for removal: This API element is subject to removal in a future version.Executes the specified task, but only if the service was not already closed.
-
-
-
Method Detail
-
execute
<R> Optional<R> execute(Supplier<R> executeTask)
Deprecated, for removal: This API element is subject to removal in a future version.Executes the specified task, but only if the service was not already closed. If service is already closed, the task is not run. If executed, the specified task must return a non-null value, to be distinguishable from a non-execution.- Parameters:
executeTask- a task to execute- Returns:
- an optional value that is present only if the specified task was run.
-
execute
<R,E extends Exception> Optional<R> execute(org.wildfly.common.function.ExceptionSupplier<R,E> executeTask) throws E extends Exception
Deprecated, for removal: This API element is subject to removal in a future version.Executes the specified task, but only if the service was not already closed. If service is already closed, the task is not run. If executed, the specified task must return a non-null value, to be distinguishable from a non-execution.- Parameters:
executeTask- a task to execute- Returns:
- an optional value that is present only if the specified task was run.
- Throws:
E- if the task execution failedE extends Exception
-
close
void close(Runnable closeTask)
Deprecated, for removal: This API element is subject to removal in a future version.Closes the service, executing the specified task, first waiting for any concurrent executions to complete. The specified task will only execute once, irrespective on subsequentclose(Runnable)invocations.- Parameters:
closeTask- a task which closes the service
-
-