Class ManagementOperation<R>

    • 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 new ManagementOperation of the given name. The name is an informal value attached to this instance.
        Parameters:
        name - informal name
        task - 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 new ManagementOperation of the given name. The name is an informal value attached to this instance.
        Parameters:
        name - informal name
        statusMessage - 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 given value.
        Parameters:
        name - name of the operation
        result - result returned by the operation
        Returns:
        a ManagementOperation instance that is already done.
      • getId

        public int getId()
        Each instance of a ManagementOperation has an unique id associated with it. This id is returned as a part of its status
        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()
        The status of this operation:
        • running if the operation is currently being executed.
        • succeeded if the operation has terminated without errors.
        • failed if the operation has been cancelled, its thread has been interrupted during execution or the operation has failed with an exception.
        Returns:
        the current status of this operation