java.lang.Object
org.mentawai.core.BaseAction
org.mentawai.core.SingleInstanceBaseAction
- All Implemented Interfaces:
- Action
- public abstract class SingleInstanceBaseAction
- extends BaseAction
This is the base class for single instance actions, in other words,
those actions that will be instantiated only once and shared among all requests.
Sometimes, when you looking for every performance drop, you may not want to create a new action instance for every request.
This class keeps the action data in thread locals,
so that each thread has its own input, output, session, application and locale.
The actions extending this class must be configurated with a SingleInstanceActionConfig.
It is your responsibility to make your action thread-safe, otherwise you should stick with the BaseAction class.
| Fields inherited from class org.mentawai.core.BaseAction |
|
| Methods inherited from class org.mentawai.core.BaseAction |
addError, addError, addError, addError, addError, addError, addError, addError, addError, addError, addMessage, addMessage, addMessage, addMessage, addMessage, setMessageContext |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.mentawai.core.Action |
execute |
input
private java.lang.ThreadLocal input
output
private java.lang.ThreadLocal output
session
private java.lang.ThreadLocal session
application
private java.lang.ThreadLocal application
loc
private java.lang.ThreadLocal loc
SingleInstanceBaseAction
public SingleInstanceBaseAction()
- Creates a SingleInstanceBaseAction.
setInput
public void setInput(Input input)
- Description copied from interface:
Action
- Sets the input for this action.
- Specified by:
setInput in interface Action- Overrides:
setInput in class BaseAction
setOutput
public void setOutput(Output output)
- Description copied from interface:
Action
- Sets the output for this action.
- Specified by:
setOutput in interface Action- Overrides:
setOutput in class BaseAction
setSession
public void setSession(Context session)
- Description copied from interface:
Action
- Sets the session context for this action.
- Specified by:
setSession in interface Action- Overrides:
setSession in class BaseAction
setApplication
public void setApplication(Context application)
- Description copied from interface:
Action
- Sets the application context for this action.
- Specified by:
setApplication in interface Action- Overrides:
setApplication in class BaseAction
setLocale
public void setLocale(java.util.Locale loc)
- Description copied from interface:
Action
- Sets the user locale for this action.
- Specified by:
setLocale in interface Action- Overrides:
setLocale in class BaseAction
getInput
public Input getInput()
- Description copied from interface:
Action
- Gets the action input.
- Specified by:
getInput in interface Action- Overrides:
getInput in class BaseAction
getOutput
public Output getOutput()
- Description copied from interface:
Action
- Gets the action output.
- Specified by:
getOutput in interface Action- Overrides:
getOutput in class BaseAction
getSession
public Context getSession()
- Description copied from interface:
Action
- Gets this action session context.
- Specified by:
getSession in interface Action- Overrides:
getSession in class BaseAction
getApplication
public Context getApplication()
- Description copied from interface:
Action
- Gets this action application context.
- Specified by:
getApplication in interface Action- Overrides:
getApplication in class BaseAction
getLocale
public java.util.Locale getLocale()
- Description copied from interface:
Action
- Gets the use locale for this action.
- Specified by:
getLocale in interface Action- Overrides:
getLocale in class BaseAction