multithreading with axis stub

2008-12-22 Thread samraat

I am trying to call Axis2 Stub implementation inside a java thread and run
the same. The run method of the java thread is not executed at all. Help me
to find where I am going wrong. Here is my program

public class TestThread implements Runnable {
STPServiceProviderStub stub = null;
STPServiceProviderStub.ProcessMessage processMsg = null;
STPServiceProviderStub.ProcessMessageResponse resp = null;

public void init(){
try {
stub = new
STPServiceProviderStub(http://localhost:7001/axis2/services/MyService;);
System.out.println(aa);
processMsg = new 
STPServiceProviderStub.ProcessMessage();
System.out.println();
} catch (AxisFault e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}

public void run() {
System.out.println(1);
execute();
}

public void execute() {

System.out.println(2);

try {
String msg = message;
processMsg.setParam0(msg);
resp = stub.processMessage(processMsg);
String output = resp.get_return();
System.out.println(Webservices return : + output);
} catch (AxisFault e) {
e.printStackTrace();
} catch (RemoteException e) {
e.printStackTrace();
} catch (RemoteExceptionException0 e) {
e.printStackTrace();
}

}
}


My Test class
--

public Class TestClass{
   public static void main(String args[]){
TestThread obj = new TestThread();
obj.init();
Thread thr = new Thread(obj);
thr.start();
   }
}


My output is:
-
aa


The code execution does not enter the run() method even and no exception or
error is thrown. Is my approach rte???

Thanks in advance

-- 
View this message in context: 
http://www.nabble.com/multithreading-with-axis-stub-tp21138848p21138848.html
Sent from the Axis - User mailing list archive at Nabble.com.



Re: multithreading with axis stub

2008-12-22 Thread samraat

I was able to find the problem. The parent thread dies before the child
thread completion. I then used sleep in the main thread to overcome the
issue. Sorry for bothering guys

Thanks
-- 
View this message in context: 
http://www.nabble.com/multithreading-with-axis-stub-tp21138848p21140782.html
Sent from the Axis - User mailing list archive at Nabble.com.