Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.mentawai.core
Class SingleInstanceBaseAction  view SingleInstanceBaseAction download SingleInstanceBaseAction.java

java.lang.Object
  extended byorg.mentawai.core.BaseAction
      extended byorg.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.


Field Summary
private  java.lang.ThreadLocal application
           
private  java.lang.ThreadLocal input
           
private  java.lang.ThreadLocal loc
           
private  java.lang.ThreadLocal output
           
private  java.lang.ThreadLocal session
           
 
Fields inherited from class org.mentawai.core.BaseAction
 
Fields inherited from interface org.mentawai.core.Action
ERROR, SUCCESS
 
Constructor Summary
SingleInstanceBaseAction()
          Creates a SingleInstanceBaseAction.
 
Method Summary
 Context getApplication()
          Gets this action application context.
 Input getInput()
          Gets the action input.
 java.util.Locale getLocale()
          Gets the use locale for this action.
 Output getOutput()
          Gets the action output.
 Context getSession()
          Gets this action session context.
 void setApplication(Context application)
          Sets the application context for this action.
 void setInput(Input input)
          Sets the input for this action.
 void setLocale(java.util.Locale loc)
          Sets the user locale for this action.
 void setOutput(Output output)
          Sets the output for this action.
 void setSession(Context session)
          Sets the session context for this action.
 
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
 

Field Detail

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
Constructor Detail

SingleInstanceBaseAction

public SingleInstanceBaseAction()
Creates a SingleInstanceBaseAction.

Method Detail

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