org.apache.struts2.interceptor

## Class BackgroundProcess

- java.lang.Object
- - org.apache.struts2.interceptor.BackgroundProcess

- All Implemented Interfaces:
    Serializable

      public class BackgroundProcess
      extends Object
      implements Serializable

  Background thread to be executed by the ExecuteAndWaitInterceptor.
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected boolean` | `done`
    `protected Exception` | `exception`
    `protected ActionInvocation` | `invocation`
    `protected String` | `result`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `BackgroundProcess(String threadName, ActionInvocation invocation, int threadPriority)` Constructs a background process

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `afterInvocation()` Called after the background thread determines the result code from the ActionInvocation, but before the background thread is marked as done.
    `protected void` | `beforeInvocation()` Called before the background thread determines the result code from the ActionInvocation.
    `Object` | `getAction()` Retrieves the action.
    `Exception` | `getException()` Gets the exception if any was thrown during the execution of the background process.
    `ActionInvocation` | `getInvocation()` Retrieves the action invocation.
    `String` | `getResult()` Gets the result of the background process.
    `boolean` | `isDone()` Returns the status of the background process.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### invocation

          protected transient ActionInvocation invocation

    - #### exception

          protected transient Exception exception

    - #### result

          protected String result

    - #### done

          protected boolean done

  - ### Constructor Detail

    - #### BackgroundProcess

          public BackgroundProcess(String threadName,
                           ActionInvocation invocation,
                           int threadPriority)

      Constructs a background process
      Parameters:
        `threadName` - The thread name
        `invocation` - The action invocation
        `threadPriority` - The thread priority

  - ### Method Detail

    - #### beforeInvocation

          protected void beforeInvocation()
                                   throws Exception

      Called before the background thread determines the result code from the ActionInvocation.
      Throws:
        `Exception` - any exception thrown will be thrown, in turn, by the ExecuteAndWaitInterceptor

    - #### afterInvocation

          protected void afterInvocation()
                                  throws Exception

      Called after the background thread determines the result code from the ActionInvocation, but before the background thread is marked as done.
      Throws:
        `Exception` - any exception thrown will be thrown, in turn, by the ExecuteAndWaitInterceptor

    - #### getAction

          public Object getAction()

      Retrieves the action.
      Returns:
        the action.

    - #### getInvocation

          public ActionInvocation getInvocation()

      Retrieves the action invocation.
      Returns:
        the action invocation

    - #### getResult

          public String getResult()

      Gets the result of the background process.
      Returns:
        the result; `null` if not done.

    - #### getException

          public Exception getException()

      Gets the exception if any was thrown during the execution of the background process.
      Returns:
        the exception or `null` if no exception was thrown.

    - #### isDone

          public boolean isDone()

      Returns the status of the background process.
      Returns:
        `true` if finished, `false` otherwise

Copyright © 2000–2020 Apache Software Foundation. All rights reserved.