Interface CancellationPoint

    • Method Detail

      • getProcessDescription

        java.lang.String getProcessDescription()
        Returns the description of the process that this cancellation point represents.
        the process description.
      • cancel

        void cancel()
        Cancel current point;
      • getCancellationMessage

        java.lang.String getCancellationMessage()
        Description copied from interface: CancelCheck
        Returns null if the process has not been cancelled, otherwise the cancellation cause (if set).
        Specified by:
        getCancellationMessage in interface CancelCheck
        cancellation message used for cancel;
      • wait

        void wait​(long timeout,
                  java.util.concurrent.TimeUnit unit)
           throws java.lang.InterruptedException,
        Waits for specified timeout while the process acquired Cancellation point has been finished;
        timeout - - the time;
        unit - - the unit;
      • close

        void close()
        Closes cancellation point;
        Specified by:
        close in interface java.lang.AutoCloseable
      • uncloseable

        static CancellationPoint uncloseable​(CancellationPoint cp)
        Returns a cancellation point which can be checked but cannot be closed. Useful for passing a cancellation point into processes which don't own it and are not supposed to close it.
      • forCancelCheck

        static CancellationPoint forCancelCheck​(java.lang.String description,
                                                CancelCheck check)
        Wraps the non-cancellable CancelCheck as a cancellable CancellationPoint. This is supposed to be used in those rare cases when a process can be cancelled externally (i.e. gets a CancelCheck from the outer code) but also spawns sub-processes which it can cancel itself. This method makes it easier to ensure that sub-processes get cancelled both from outside of the main process and from inside it. Note: the returned object does not support waiting.
        description - the process description
        check - the external cancellation check
        the cancellation point which is cancelled either via its cancel method or when the external flag is raised.