RickDavis
RickDavis

Reputation: 2296

Struts 1.x Action classes ThreadSafe?

Can anyone explain, if Struts Action classes are threadsafe in Struts 1.x.

Upvotes: 2

Views: 1765

Answers (2)

Bhesh Gurung
Bhesh Gurung

Reputation: 51030

It caches the instance of an Action class and reuses it for subsequent requests.

You can check out the code here: org.apache.struts.action.RequestProcessor.process(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException

So, they are not thread-safe.

Upvotes: 1

Paul Vargas
Paul Vargas

Reputation: 42040

In fact, Struts 1.x is stateless. But if you include instance variables in your Action's not anymore (Not recomended), because the same instance is used. You can see the behavior of Struts 1.x if you enable the log level to TRACE.

Upvotes: 1

Related Questions