is actionservlet thread safe

ActionServlet is controller in Model View Controller design pattern for web applications.

ActionServlet is not thread safe
There is only a method named getRequestProcessor is synchronized.

Code of this method is below :-

/**
* <p>Look up and return the {@link RequestProcessor} responsible for the
* specified module, creating a new one if necessary.</p>
*
* @param config The module configuration for which to
* acquire and return a RequestProcessor.
*
* @exception ServletException if we cannot instantiate a RequestProcessor
* instance
* @since Struts 1.1
*/
protected synchronized RequestProcessor getRequestProcessor(ModuleConfig config)
throws ServletException {

// :FIXME: Document UnavailableException?

RequestProcessor processor = this.getProcessorForModule(config);

if (processor == null) {
try {
processor =
(RequestProcessor) RequestUtils.applicationInstance(
config.getControllerConfig().getProcessorClass());

} catch (Exception e) {
throw new UnavailableException(
"Cannot initialize RequestProcessor of class "
+ config.getControllerConfig().getProcessorClass()
+ ": "
+ e);
}

processor.init(this, config);

String key = Globals.REQUEST_PROCESSOR_KEY + config.getPrefix();
getServletContext().setAttribute(key, processor);

}

return (processor);

}

Comments

Recent Post

Recent Posts Widget

Popular posts from this blog

Capture image from webcam java code, examples

Database Connection using NODE JS example

Shallow Copy Deep Copy Java example