public class RequestScopeManager extends GenericContext implements Schedulable, atg.nucleus.ScopeManager
A RequestScopeManager manages a set of hierarchies that are meant to hold "request-scoped" objects. Each hierarchy is associated with a key. One can ask for the hierarchy corresponding to a specified key, which will return or create the Context at the top of that hierarchy.
In normal use, a server will spin off a number of threads that will handle requests. Those threads will each have a request object which is used as the key for its request scope.
GenericContext.ConcurrencyModel
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
CLASS_VERSION
Class version string
|
SERVICE_INFO_KEY
DEFAULT_LOG_TRACE_STATUS
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
Constructor and Description |
---|
RequestScopeManager()
Constructs a new blank RequestScopeManager
|
Modifier and Type | Method and Description |
---|---|
boolean |
canReferenceOtherScope(atg.nucleus.ScopeManager pScopeManager) |
void |
doStartService()
This is called after a Service has been created, placed into the
naming hierarchy, and initialized with its configured property
values.
|
void |
doStopService()
This is called when a Service is required to shut down.
|
int |
generateId()
Generates a new id and returns it.
|
GenericContext |
getContext(java.lang.Object pKey)
Deprecated.
|
GenericContext |
getContext(java.lang.Object pKey,
int pId)
Returns the GenericContext for the given Key and id
|
Schedule |
getLostRequestScopeSchedule() |
java.lang.String |
getManagedScopeName() |
int |
getNumSavedRequestScopes()
Read-only property which returns the number of request scopes that
we are currently holding onto for pending redirects.
|
int |
getRequestScopeExpirationMilliseconds() |
NameContext |
getRootContextForRequest(DynamoHttpServletRequest pRequest)
Get the root reqwuest scope for the specified request.
|
GenericContext |
getSavedRequestScope(java.lang.Object pKey,
int pId,
java.lang.String pSessionId)
Returns the saved request scope, while also removing it from the saved
store.
|
boolean |
getSaveRequestScopeOnRedirect() |
Scheduler |
getScheduler()
Returns the Scheduler used to run the expiration and swapping
checks.
|
boolean |
isInheritsEffectiveScope() |
void |
performScheduledTask(Scheduler pScheduler,
ScheduledJob pJob)
This is called once for the minimum timeout specified by save
requestScope.
|
int |
readId() |
boolean |
removeContext(java.lang.Object pKey)
Removes the request context object stored for the key specified
|
int |
saveRequestScope(java.lang.Object pKey,
java.lang.String pSessionId)
Save a request scope, returning an integer id with which this request
scope can later be reclaimed.
|
void |
setLostRequestScopeSchedule(Schedule pLostRequestScopeSchedule)
Sets the property LostRequestScopeSchedule.
|
void |
setRequestScopeExpirationMilliseconds(int pRequestScopeExpirationMilliseconds)
Sets the property RequestScopeExpirationMilliseconds.
|
void |
setSaveRequestScopeOnRedirect(boolean pSaveRequestScopeOnRedirect)
Sets the property SaveRequestScopeOnRedirect.
|
void |
setScheduler(Scheduler pScheduler)
Sets the Scheduler used to run the expiration and swapping
checks.
|
addNameContextBindingListener, addNameContextPreBindingListener, clearElementLock, complainIfComponentAlreadyHasParentNameContext, createChildNameContext, getAttribute, getAttributeNames, getConfigurationLock, getContext, getContextPath, getDocumentRoot, getElement, getElementLock, getInitParameter, getInitParameterNames, getMajorVersion, getMimeType, getMimeTyper, getMinorVersion, getNameContextBindingListeners, getNameContextPreBindingListeners, getNamedDispatcher, getPendingElement, getRealPath, getRequestDispatcher, getResource, getResourceAsStream, getResourcePaths, getServerInfo, getServlet, getServletContextName, getServletNames, getServlets, isElementBound, isOptimizedForConcurrency, listElement, listElementNames, listElements, log, log, log, notifyAddedObject, notifyRemovedObject, preNotifyAddedObject, preNotifyRemovedObject, putElement, putPendingElement, removeAttribute, removeElement, removeNameContextBindingListener, removeNameContextPreBindingListener, removePendingElement, setAttribute, setDocumentRoot, setMimeTyper, startService
addLogListener, createAdminServlet, getAbsoluteName, getAdminServlet, getAdminServletOutputStreamEncoding, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isAdminServletUseServletOutputStream, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, reResolveThis, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setAdminServletOutputStreamEncoding, setAdminServletUseServletOutputStream, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, stopService
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getName, getNameContext
nameContextElementBound, nameContextElementUnbound
public static final java.lang.String CLASS_VERSION
public RequestScopeManager()
public void doStartService() throws ServiceException
GenericService
doStartService
in class GenericService
ServiceException
- if the Service had a problem starting uppublic void doStopService() throws ServiceException
GenericContext
doStopService
in class GenericContext
ServiceException
- if the Service had a problem shutting downpublic Scheduler getScheduler()
public void setScheduler(Scheduler pScheduler)
public void setLostRequestScopeSchedule(Schedule pLostRequestScopeSchedule)
public Schedule getLostRequestScopeSchedule()
public void setRequestScopeExpirationMilliseconds(int pRequestScopeExpirationMilliseconds)
public int getRequestScopeExpirationMilliseconds()
public void setSaveRequestScopeOnRedirect(boolean pSaveRequestScopeOnRedirect)
public boolean getSaveRequestScopeOnRedirect()
public int getNumSavedRequestScopes()
public int generateId()
public int readId()
public GenericContext getContext(java.lang.Object pKey)
public GenericContext getContext(java.lang.Object pKey, int pId)
public int saveRequestScope(java.lang.Object pKey, java.lang.String pSessionId)
public GenericContext getSavedRequestScope(java.lang.Object pKey, int pId, java.lang.String pSessionId)
public java.lang.String getManagedScopeName()
getManagedScopeName
in interface atg.nucleus.ScopeManager
public void performScheduledTask(Scheduler pScheduler, ScheduledJob pJob)
performScheduledTask
in interface Schedulable
pScheduler
- calling the jobpJob
- the ScheduledJobpublic boolean removeContext(java.lang.Object pKey)
public NameContext getRootContextForRequest(DynamoHttpServletRequest pRequest)
getRootContextForRequest
in interface atg.nucleus.ScopeManager
pRequest
- the request to access.public boolean canReferenceOtherScope(atg.nucleus.ScopeManager pScopeManager)
canReferenceOtherScope
in interface atg.nucleus.ScopeManager
public boolean isInheritsEffectiveScope()
isInheritsEffectiveScope
in interface atg.nucleus.ScopeManager