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>
AManagementOperation
is a background task, which can be executed by anExecutor
. ItsManagementOperation.Status
indicates 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 class
ManagementOperation.Status
Status 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
.int
getId()
Each instance of aManagementOperation
has an unique id associated with it.@NotNull String
getName()
Informal name@NotNull ManagementOperation.Status
getStatus()
static <R> ManagementOperation<R>
newManagementOperation(@NotNull String name, @NotNull Callable<R> task)
Create a newManagementOperation
of the given name.static <R> ManagementOperation<R>
newManagementOperation(@NotNull String name, @NotNull Supplier<String> statusMessage, @NotNull Callable<R> task)
Create a newManagementOperation
of the given name.String
toString()
-
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 newManagementOperation
of the given name. Thename
is 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 newManagementOperation
of the given name. Thename
is 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
ManagementOperation
instance that is already done.
-
getId
public int getId()
Each instance of aManagementOperation
has 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()
Thestatus
of this operation:- Returns:
- the current status of this operation
-
toString
public String toString()
- Overrides:
toString
in classFutureTask<R>
-
-