Reputation: 613
I have an Axis2 java webservice.
I need to implement some new logic - where there should be a 'worker' thread (with MsgQ). Used when user request should do some work but not block the user.
Unfortunatly I am missing the knowladge of this. How can create the thread, how.
!!! The important issue - is where should it be create? Currently in WebService project there are only methods that are client API. Where is the main? how can init and do logic seperated from the clientAPI (such as creating the thread)
Thanks Yoav
Upvotes: 1
Views: 350
Reputation: 2077
I don't know whether I really got your question or not.
Following thing you can try out:
Write a start up servlet(you need to add entry of startup servlet in server.xml) in which
- Start your thread in Servlet.init().
- Shutdown in Servlet.destroy().
In thread's run() you can write logic you want, also you can share resources between WS and thread.
Upvotes: 2