Class AsyncOperation


  • public class AsyncOperation
    extends java.lang.Object
    An operation that will be enqueued for asynchronous execution.
    See Also:
    AsyncSession
    • Field Detail

      • FLAG_STOP_QUEUE_ON_EXCEPTION

        public static final int FLAG_STOP_QUEUE_ON_EXCEPTION
        TODO unused, just an idea
        See Also:
        Constant Field Values
      • FLAG_TRACK_CREATOR_STACKTRACE

        public static final int FLAG_TRACK_CREATOR_STACKTRACE
        See Also:
        Constant Field Values
    • Method Detail

      • getThrowable

        public java.lang.Throwable getThrowable()
      • setThrowable

        public void setThrowable​(java.lang.Throwable throwable)
      • getParameter

        public java.lang.Object getParameter()
      • getResult

        public java.lang.Object getResult()
        The operation's result after it has completed. Waits until a result is available.
        Returns:
        The operation's result or null if the operation type does not produce any result.
        See Also:
        waitForCompletion()
      • isMergeTx

        public boolean isMergeTx()
        Returns:
        true if this operation may be merged with others into a single database transaction.
      • getTimeStarted

        public long getTimeStarted()
      • getTimeCompleted

        public long getTimeCompleted()
      • getDuration

        public long getDuration()
      • isFailed

        public boolean isFailed()
      • isCompleted

        public boolean isCompleted()
      • waitForCompletion

        public java.lang.Object waitForCompletion()
        Waits until the operation is complete. If the thread gets interrupted, any InterruptedException will be rethrown as a DaoException.
        Returns:
        Result if any, see getResult()
      • waitForCompletion

        public boolean waitForCompletion​(int maxMillis)
        Waits until the operation is complete, but at most the given amount of milliseconds.If the thread gets interrupted, any InterruptedException will be rethrown as a DaoException.
        Returns:
        true if the operation completed in the given time frame.
      • isCompletedSucessfully

        public boolean isCompletedSucessfully()
      • getMergedOperationsCount

        public int getMergedOperationsCount()
        If this operation was successfully merged with other operation into a single TX, this will give the count of merged operations. If the operation was not merged, it will be 0.
      • getSequenceNumber

        public int getSequenceNumber()
        Each operation get a unique sequence number when the operation is enqueued. Can be used for efficiently identifying/mapping operations.
      • getCreatorStacktrace

        public java.lang.Exception getCreatorStacktrace()
        The stacktrace is captured using an exception if FLAG_TRACK_CREATOR_STACKTRACE was used (null otherwise).