Class ManagementOperation<R>
- java.lang.Object
-
- java.util.concurrent.FutureTask<R>
-
- org.apache.jackrabbit.oak.commons.jmx.ManagementOperation<R>
-
- All Implemented Interfaces:
Runnable,Future<R>,RunnableFuture<R>
public class ManagementOperation<R> extends FutureTask<R>
AManagementOperationis a background task, which can be executed by anExecutor. ItsManagementOperation.Statusindicates whether execution has already been started, is currently under the way or has already finished.- See Also:
RepositoryManagementMBean
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classManagementOperation.StatusStatus of aManagementOperation.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static <R> @NotNull ManagementOperation<R>done(String name, R result)An operation that is already done with the givenvalue.intgetId()Each instance of aManagementOperationhas an unique id associated with it.@NotNull StringgetName()Informal name@NotNull ManagementOperation.StatusgetStatus()static <R> ManagementOperation<R>newManagementOperation(@NotNull String name, @NotNull Callable<R> task)Create a newManagementOperationof the given name.static <R> ManagementOperation<R>newManagementOperation(@NotNull String name, @NotNull Supplier<String> statusMessage, @NotNull Callable<R> task)Create a newManagementOperationof the given name.StringtoString()-
Methods inherited from class java.util.concurrent.FutureTask
cancel, done, get, get, isCancelled, isDone, run, runAndReset, set, setException
-
-
-
-
Field Detail
-
id
protected final int id
-
name
@NotNull protected final @NotNull String name
-
-
Method Detail
-
newManagementOperation
public static <R> ManagementOperation<R> newManagementOperation(@NotNull @NotNull String name, @NotNull @NotNull Callable<R> task)
Create a newManagementOperationof the given name. Thenameis an informal value attached to this instance.- Parameters:
name- informal nametask- task to execute for this operation
-
newManagementOperation
public static <R> ManagementOperation<R> newManagementOperation(@NotNull @NotNull String name, @NotNull @NotNull Supplier<String> statusMessage, @NotNull @NotNull Callable<R> task)
Create a newManagementOperationof the given name. Thenameis an informal value attached to this instance.- Parameters:
name- informal namestatusMessage- an informal status message describing the status of the background operation at the time of invocation.task- task to execute for this operation
-
done
@NotNull public static <R> @NotNull ManagementOperation<R> done(String name, R result)
An operation that is already done with the givenvalue.- Parameters:
name- name of the operationresult- result returned by the operation- Returns:
- a
ManagementOperationinstance that is already done.
-
getId
public int getId()
Each instance of aManagementOperationhas an unique id associated with it. This id is returned as a part of itsstatus- Returns:
- id of this operation
-
getName
@NotNull public @NotNull String getName()
Informal name- Returns:
- name of this operation
-
getStatus
@NotNull public @NotNull ManagementOperation.Status getStatus()
Thestatusof this operation:- Returns:
- the current status of this operation
-
toString
public String toString()
- Overrides:
toStringin classFutureTask<R>
-
-