Search code examples
javaserializationscopestrutssynchronized

Synchronized method inside ActionForm


I have a Serializable ActionForm that holds an instance of another Serializable object. This object have a synchronized method which I can't change right now.

I want to know if my form object is the same across different requests, because the application is facing some slowness exactly before that synchornized method.

This is my ActionMapping:

<action attribute="myActionForm"
            name="myActionForm"
            path="/myAction"
            type="myAction"
            parameter="task"
            scope="session"
            validate="false">
         <forward name="tasks" path=".tasks.new" />             
    </action>

And this is my Action:

public ActionForward taskName(ActionMapping mapping, ActionForm frm, HttpServletRequest request, HttpServletResponse response) throws IntegrationException {
    MyForm form = (MyForm) frm;

    form.getObjectX().executeSynchronizedMethodX();

    return mapping.findForward("tasks");
}

This form is sent back from the view to the same ActionForward.


Solution

  • It's the same bean in the same session; that's what session-scoped means

    Across requests it depends on if the requests are made in the same session.