My guess is this a dev list issue.

I'm working on a CORBA app where we have remote methods like say

public class SomeCorbaImpl extends some FrameWorkClass implements
SomeCorbaOperations{
        public void someMethod(){
                NDC.push(getSession().getUserId());     
                //some code with logging
                someOtherMethod()
                //some more code with logging
                NDC.pop();
        }
        
        public void someOtherMethod(){
                NDC.push(getSession().getUserId());
                //some code with logging
                NDC.pop();
        }
}

The problem is the client code can call someMethod() or someOtherMethod
directly.  If the client calls
someMethod() the ndc get set to something like
davek davek
in someOtherMethod

I know I can check the depth of the NDC in someOtherMethod  like this

        public void someOtherMethod(){
                if(NDC.getDepth()==0){
                        NDC.push(getSession().getUserId());
                }
                //some code with logging
                NDC.pop();
        }

but what to do with the pop?  I could store a flag but that is getting ugly
quick.

One solution I cam up with is to push an empty NDC on to the stack so that a
util class could work like this

public class SessionNDC{
        public static  void push(Session s){
                if(NDC.getDepth()==0){
                        NDC.push(s.getUserId())
                }
                else{
                        NDC.push("");
                }
        }
        
        public static void pop(){
                NDC.pop();
        }
}       
        
And this works except that the NDC places a space between each NDC level
even if the NDC is "", not a huge deal but a pain.

Cekie and I talked (emailed?) about this back before Christmas but didn't
come to a conclusion.  I've been off site since then.

I'm wondering if anyone has come up with another solution or is it worth
modifying the NDC code to removed the extra
spaces?

-Peace
Dave

PS I can't help but be amazed at the progress in three short months.

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to