Class BackgroundSupport
java.lang.Object
uk.ac.manchester.spinnaker.alloc.web.BackgroundSupport
- Direct Known Subclasses:
SpallocServiceImpl
public abstract class BackgroundSupport extends Object
Enables a web service class to move processing a request into a background
task easily.
- Author:
- Donal Fellows
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static interface
BackgroundSupport.BackgroundAction
An action that produces a response, usually handled asynchronously. -
Constructor Summary
Constructors Constructor Description BackgroundSupport()
-
Method Summary
Modifier and Type Method Description protected void
bgAction(AsyncResponse response, Permit permit, BackgroundSupport.BackgroundAction action)
Run the action in the background and wrap it into the response when it completes.protected void
bgAction(AsyncResponse response, BackgroundSupport.BackgroundAction action)
Run the action in the background and wrap it into the response when it completes.protected static void
fgAction(AsyncResponse response, BackgroundSupport.BackgroundAction action)
Run the action immediately and wrap it into the response.
-
Constructor Details
-
BackgroundSupport
public BackgroundSupport()
-
-
Method Details
-
bgAction
Run the action in the background and wrap it into the response when it completes.- Parameters:
response
- The asynchronous response.action
- The action that generates aResponse
-
bgAction
protected void bgAction(AsyncResponse response, Permit permit, BackgroundSupport.BackgroundAction action)Run the action in the background and wrap it into the response when it completes.- Parameters:
response
- The asynchronous response.permit
- The permissions granted to the asynchronous task from the context that asked for it to happen.action
- The action that generates aResponse
-
fgAction
Run the action immediately and wrap it into the response.- Parameters:
response
- The asynchronous response.action
- The action that generates aResponse
-