[ 
https://issues.apache.org/jira/browse/OFBIZ-4289?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13400121#comment-13400121
 ] 

Jacopo Cappellato commented on OFBIZ-4289:
------------------------------------------

A few comments:

* the name of the argument "persistSerialized" (in setWebContextObjects method) 
is confusing and could be renamed to "distributableApplication", it will make 
the code more readable
* we should also rename the variable "sessionPersistence" (same as above)
* in setWebContextObjects instead of:
{code}
        if (!persistSerialized) {
            session.setAttribute("delegator", null);
        } else {
            session.setAttribute("delegator", delegator);
        }
{code}
it will be more readable as:
{code}
        if (persistSerialized) {
            session.setAttribute("delegator", delegator);
        } else {
            session.setAttribute("delegator", null);
        }
{code}
or, if you will implement my suggestion #1:
{code}
        if (distributableApplication) {
            session.setAttribute("delegator", null);
        } else {
            session.setAttribute("delegator", delegator);
        }
{code}
* in order to increase readability we could group all the special code for 
distributable application in the same block:
{code}
        if (distributableApplication) {
            session.setAttribute("delegator", null);
            session.setAttribute("dispatcher", null);
            session.setAttribute("security", null);
            session.setAttribute("authz", null);
        } else {
            session.setAttribute("delegator", delegator);
            session.setAttribute("dispatcher", dispatcher);
            session.setAttribute("security", security);
            session.setAttribute("authz", authz);
        }
{code}; this is actually minor; however see my next 2 comments
* did you consider to not change the code here but instead, before the session 
is serialized, remove all the objects that are not "instanceof Serializable"?
* what is the effect (in distributable appls) of setting nulls for 
security/dispatcher/delegator etc...? isn't it causing any issue? aren't they 
used?


                
> Login out on a cluster handled by DeltaManager causes a NPE
> -----------------------------------------------------------
>
>                 Key: OFBIZ-4289
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-4289
>             Project: OFBiz
>          Issue Type: Bug
>          Components: framework
>    Affects Versions: Release Branch 4.0, Release Branch 09.04, Release Branch 
> 10.04, Release Branch 11.04, SVN trunk
>         Environment: Ubuntu
>            Reporter: Jacques Le Roux
>            Assignee: Jacques Le Roux
>            Priority: Critical
>              Labels: cluster, logout
>             Fix For: Release Branch 10.04, Release Branch 11.04, SVN trunk
>
>         Attachments: OFBIZ-4289_Login_out_on_a 
> cluster_handled_by_DeltaManager_causes_a_NPE.patch, OFBIZ-4289_Login_out_on_a 
> cluster_handled_by_DeltaManager_causes_a_NPE.patch, OFBIZ-4289_Login_out_on_a 
> cluster_handled_by_DeltaManager_causes_a_NPE.patch, OFBIZ-4289_Login_out_on_a 
> cluster_handled_by_DeltaManager_causes_a_NPE.patch, OFBIZ-4289_Login_out_on_a 
> cluster_handled_by_DeltaManager_causes_a_NPE.patch, changeset_2510.diff
>
>
> It works locally but not on clusters. You simply get a NPE.
> h3. Problem
>     * When we logout we cross an issue due to Tomcat sessions persistence.
>     * Because we set distributable to true, to allow sessions failover,
>     * and use and DeltaManager for replication.
>     * Delegator and other main Classes (notably Dispatcher) are not 
> serialized in OFBiz. This is the origin of the problem 
> h3. Tried solutions
> By default DeltaManager save active sessions on disk. It uses a private 
> String variable pathname for that (default to "SESSIONS.ser"). You can set it 
> to null, to avoid session persistence, using a context.xml file in the 
> WEB-INF folder with content like below. But I tried it in webtools app on 
> staging qs001 (only) and it did not work (with distributable set to false). 
> And we have no other means to set it from OFBiz (OOTB).
> {code}
>     <Context>
>      <Manager className="org.apache.catalina.session.DeltatManager" 
> pathname="">
>      </Manager>
>     </Context>
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to