In Axis 1.x, MessageContext.getCurrentContext() retrieves a value from
ThreadLocal storage.  The same thing may be done in Axis 2.  To make
this call available in some thread you create, you would have to know
its exact implementation and set the ThreadLocal storage of the thread
you create accordingly..

Jeff


On 12/17/06, Julian Hagenauer <[EMAIL PROTECTED]> wrote:
Hi,
i am pretty new to axis.
I am trying to modify the initialize()-function of a webservice of the 
globus-container.

The origin initialize()-Function looks like that:
public synchronized void initialize() {
        try {
                MessageContext ctx = MessageContext.getCurrentContext();
                globusLocation = (String) 
ctx.getProperty(org.apache.axis.Constants.MC_CONFIGPATH);
        } catch(Exception e) { ...

This works well as exspected.
I am now trying to rewrite a new initalize-funktion that usees threads:
public synchronized void initialize() throws Exception {
        class InitThread extends Thread {
                InitThread() { super(); }
                public void run() {
                        try {
                                MessageContext ctx = 
MessageContext.getCurrentContext();
                                String globusLocation = (String) 
ctx.getProperty(org.apache.axis.Constants.MC_CONFIGPATH);
                        } catch(Exception e) { 
System.err.println("3:"+e.getMessage()); }
                }

                public void test() {
                        try {
                                MessageContext ctx = 
MessageContext.getCurrentContext();
                                String globusLocation = (String) 
ctx.getProperty(org.apache.axis.Constants.MC_CONFIGPATH);
                        } catch(Exception e) { 
System.err.println("2:"+e.getMessage()); }
                };
        };
        try {
                MessageContext ctx = MessageContext.getCurrentContext();
                String globusLocation = (String) 
ctx.getProperty(org.apache.axis.Constants.MC_CONFIGPATH);
        } catch(Exception e) { System.err.println("1:"+e.getMessage()); }
        InitThread initThread = new InitThread();
        initThread.test();
        initThread.start();
}

If i start the globus-container, i get "3:null". The exception itself is null, 
i can't get further information about it.
So, if you look at the code, all ctx.getProperty()-calls finish with success, 
only the one in the run()-method fails.
Why that? Is there a simple way around that?

Thank you,
Julian


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



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

Reply via email to