org.apache.struts2.interceptor.exec

## Class StrutsBackgroundProcess

- java.lang.Object
- - org.apache.struts2.interceptor.exec.StrutsBackgroundProcess

- All Implemented Interfaces:
    Serializable, Runnable, BackgroundProcess

      public class StrutsBackgroundProcess
      extends Object
      implements BackgroundProcess, 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
    `StrutsBackgroundProcess(ActionInvocation invocation, String threadName, int threadPriority)` Constructs a background process

  - ### Method Summary

    All Methods Instance Methods Concrete 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.
    `BackgroundProcess` | `prepare()`
    `void` | `run()`
    `String` | `toString()`

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

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, 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

    - #### StrutsBackgroundProcess

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

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

  - ### Method Detail

    - #### prepare

          public BackgroundProcess prepare()

      Specified by:
        `prepare` in interface `BackgroundProcess`

    - #### run

          public void run()

      Specified by:
        `run` in interface `Runnable`

    - #### 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.
      Specified by:
        `getAction` in interface `BackgroundProcess`
      Returns:
        the action.

    - #### getInvocation

          public ActionInvocation getInvocation()

      Retrieves the action invocation.
      Specified by:
        `getInvocation` in interface `BackgroundProcess`
      Returns:
        the action invocation

    - #### getResult

          public String getResult()

      Gets the result of the background process.
      Specified by:
        `getResult` in interface `BackgroundProcess`
      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.
      Specified by:
        `getException` in interface `BackgroundProcess`
      Returns:
        the exception or `null` if no exception was thrown.

    - #### isDone

          public boolean isDone()

      Returns the status of the background process.
      Specified by:
        `isDone` in interface `BackgroundProcess`
      Returns:
        `true` if finished, `false` otherwise

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

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