You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by samraat <as...@gmail.com> on 2008/12/23 04:10:34 UTC

multithreading with axis stub

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("aaaaaaaaaa");
			processMsg = new STPServiceProviderStub.ProcessMessage();
			System.out.println("bbbbbbbbbbbb");
		} catch (AxisFault e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
	
	public void run() {
		System.out.println("111111111");
		execute();
	}

	public void execute() {
		
		System.out.println("222222222");

		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:
-------------
aaaaaaaaaa
bbbbbbbbbbbb

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

Posted by samraat <as...@gmail.com>.
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.