axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michele Mazzucco <Michele.Mazzu...@ncl.ac.uk>
Subject Re: Axis Thread Pool - thread interrupted
Date Fri, 25 Apr 2008 10:45:39 GMT
1 - I would use another thread pool. The axis2 thread pool is used to  
serve requests, not to accomplish other tasks.
2 - The thread is not interrupted, your code is wrong, If you read  
the documentation of Object.wait() you'll realize that you *must* own  
the lock on that object before calling wait.
3 - catching Exception is not good, use its subclasses instead.

Michele

On 25 Apr 2008, at 11:07, LIE Jorund wrote:

> Hi All.
>
> I am currently working on an multitreaded axis service. From my  
> interface class I invoke a thread that processes the request. The  
> thread is executed in the the thread pool obtained from the Root  
> Context of the service.The thread starts OK, but if it is suspended  
> in a wait() it is immediately interrupted. Do anyone know why this  
> may happen?
>
> I can see that there is a threadKeepAliveTime configurable in the  
> axis2.xml, but the default interval seems to be long enough (180s).
> Below are some snippets of code for illustration:
>
> The execution of the thread in the interface class:
>
> CmsThread cmsThread = new CmsThread();
> ThreadFactory threadFactory =  
> MessageContext.getCurrentMessageContext().getRootContext 
> ().getThreadPool();
> threadFactory.execute(cmsThread);
> The run method of the cmsThread class:
> public void run() {     try{         logger.info 
> ("waiting...");         wait(10000);         logger.info 
> ("end");     }     catch (Exception e)     {         logger.info 
> ("interrupted");     }   }
>
> Thanks for any input
>
> Jørund Lie


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Mime
View raw message