You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by Bharath Ganesh <bh...@pramati.com> on 2007/03/13 13:46:17 UTC

Non-Daemon Timer thread created at RMManager

Hi 

I could see a Timer created at org.apache.cxf.ws.rm.RMManager using the default Timer constructor. This causes the associate timer thread to run as a non-daemon thread. 

Since this timer is never cancelled, the thread to be there forever, stopping the VM from exiting. (Matters a lot at the JAX-WS client side)

This needs to be fixed. 

Thanks
-Bharath
http://www.bharathganesh.com

Re: Non-Daemon Timer thread created at RMManager

Posted by Andrea Smyth <an...@iona.com>.
Dan Diephouse wrote:

> But if someone is using just a generated client should they really 
> have to
> call Bus.shutdown()?  Maybe we should add some shutdown hooks so
> Bus.shutdown() is called automatically when someone exits the JVM.

I'd say that's a good idea. In the particular case of the RM timer we 
can workaround by creating the timer with a daemon thread, but the 
general problem of releasing resources remains.
Andrea.

>
>
> - Dan
>
> On 3/13/07, Andrea Smyth <an...@iona.com> wrote:
>
>>
>> Bharath Ganesh wrote:
>>
>> >Hi
>> >
>> >I could see a Timer created at org.apache.cxf.ws.rm.RMManager using the
>> default Timer constructor. This causes the associate timer thread to 
>> run as
>> a non-daemon thread.
>> >
>> >Since this timer is never cancelled, the thread to be there forever,
>> stopping the VM from exiting. (Matters a lot at the JAX-WS client side)
>> >
>> >This needs to be fixed.
>> >
>> >Thanks
>> >-Bharath
>> >http://www.bharathganesh.com
>> >
>> >
>> Hi Barath,
>>
>> This timer is canceled - in the RMManager's  @PreDestroy annotated
>> shutdown method, which is called when the the bus is shutdown. Do you
>> call Bus.shutdown() in your application?
>>
>> Andrea.
>>
>>
>>
>
>


Re: Non-Daemon Timer thread created at RMManager

Posted by Bharath Ganesh <bh...@pramati.com>.
Yes correct. The client would neither do a System.exit() nor shutdown the bus.  So making the Timer thread to be a daemon thread seems to be the best solution. 
  ----- Original Message ----- 
  From: Daniel Kulp 
  To: cxf-dev@incubator.apache.org 
  Sent: Thursday, March 15, 2007 5:10 AM
  Subject: Re: Non-Daemon Timer thread created at RMManager


  On Tuesday 13 March 2007 09:44, Dan Diephouse wrote:
  > But if someone is using just a generated client should they really
  > have to call Bus.shutdown()?  Maybe we should add some shutdown hooks
  > so Bus.shutdown() is called automatically when someone exits the JVM.

  Just FYI:  a shutdown hook wouldn't help in this case.    If there is a 
  non-daemon thread around, the VM won't ever start to shutdown.   Thus, 
  the shutdown hooks wouldn't be called.  

  Basically, we need to get the Timer switched over to a daemon thread.   
  Any other threads that may be created also need to be the same way.  
  (does the WS-RM stuff cause threads/servers to start up?   What about 
  the work queues?)

  Dan



  >
  > - Dan
  >
  > On 3/13/07, Andrea Smyth <an...@iona.com> wrote:
  > > Bharath Ganesh wrote:
  > > >Hi
  > > >
  > > >I could see a Timer created at org.apache.cxf.ws.rm.RMManager using
  > > > the
  > >
  > > default Timer constructor. This causes the associate timer thread to
  > > run as a non-daemon thread.
  > >
  > > >Since this timer is never cancelled, the thread to be there
  > > > forever,
  > >
  > > stopping the VM from exiting. (Matters a lot at the JAX-WS client
  > > side)
  > >
  > > >This needs to be fixed.
  > > >
  > > >Thanks
  > > >-Bharath
  > > >http://www.bharathganesh.com
  > >
  > > Hi Barath,
  > >
  > > This timer is canceled - in the RMManager's  @PreDestroy annotated
  > > shutdown method, which is called when the the bus is shutdown. Do
  > > you call Bus.shutdown() in your application?
  > >
  > > Andrea.

  -- 
  J. Daniel Kulp
  Principal Engineer
  IONA
  P: 781-902-8727    C: 508-380-7194
  daniel.kulp@iona.com
  http://www.dankulp.com/blog

Re: Non-Daemon Timer thread created at RMManager

Posted by Daniel Kulp <da...@iona.com>.
On Tuesday 13 March 2007 09:44, Dan Diephouse wrote:
> But if someone is using just a generated client should they really
> have to call Bus.shutdown()?  Maybe we should add some shutdown hooks
> so Bus.shutdown() is called automatically when someone exits the JVM.

Just FYI:  a shutdown hook wouldn't help in this case.    If there is a 
non-daemon thread around, the VM won't ever start to shutdown.   Thus, 
the shutdown hooks wouldn't be called.  

Basically, we need to get the Timer switched over to a daemon thread.   
Any other threads that may be created also need to be the same way.  
(does the WS-RM stuff cause threads/servers to start up?   What about 
the work queues?)

Dan



>
> - Dan
>
> On 3/13/07, Andrea Smyth <an...@iona.com> wrote:
> > Bharath Ganesh wrote:
> > >Hi
> > >
> > >I could see a Timer created at org.apache.cxf.ws.rm.RMManager using
> > > the
> >
> > default Timer constructor. This causes the associate timer thread to
> > run as a non-daemon thread.
> >
> > >Since this timer is never cancelled, the thread to be there
> > > forever,
> >
> > stopping the VM from exiting. (Matters a lot at the JAX-WS client
> > side)
> >
> > >This needs to be fixed.
> > >
> > >Thanks
> > >-Bharath
> > >http://www.bharathganesh.com
> >
> > Hi Barath,
> >
> > This timer is canceled - in the RMManager's  @PreDestroy annotated
> > shutdown method, which is called when the the bus is shutdown. Do
> > you call Bus.shutdown() in your application?
> >
> > Andrea.

-- 
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
daniel.kulp@iona.com
http://www.dankulp.com/blog

Re: Non-Daemon Timer thread created at RMManager

Posted by Dan Diephouse <da...@envoisolutions.com>.
But if someone is using just a generated client should they really have to
call Bus.shutdown()?  Maybe we should add some shutdown hooks so
Bus.shutdown() is called automatically when someone exits the JVM.

- Dan

On 3/13/07, Andrea Smyth <an...@iona.com> wrote:
>
> Bharath Ganesh wrote:
>
> >Hi
> >
> >I could see a Timer created at org.apache.cxf.ws.rm.RMManager using the
> default Timer constructor. This causes the associate timer thread to run as
> a non-daemon thread.
> >
> >Since this timer is never cancelled, the thread to be there forever,
> stopping the VM from exiting. (Matters a lot at the JAX-WS client side)
> >
> >This needs to be fixed.
> >
> >Thanks
> >-Bharath
> >http://www.bharathganesh.com
> >
> >
> Hi Barath,
>
> This timer is canceled - in the RMManager's  @PreDestroy annotated
> shutdown method, which is called when the the bus is shutdown. Do you
> call Bus.shutdown() in your application?
>
> Andrea.
>
>
>


-- 
Dan Diephouse
Envoi Solutions
http://envoisolutions.com | http://netzooid.com/blog

Re: Non-Daemon Timer thread created at RMManager

Posted by Bharath Ganesh <bh...@pramati.com>.
Hi Andrea

I do not call bus.shutdown(). I feel a JAX-WS Client should not really bother about the bus. 

-Bharath
  ----- Original Message ----- 
  From: Andrea Smyth 
  To: cxf-dev@incubator.apache.org 
  Sent: Tuesday, March 13, 2007 7:04 PM
  Subject: Re: Non-Daemon Timer thread created at RMManager


  Bharath Ganesh wrote:

  >Hi 
  >
  >I could see a Timer created at org.apache.cxf.ws.rm.RMManager using the default Timer constructor. This causes the associate timer thread to run as a non-daemon thread. 
  >
  >Since this timer is never cancelled, the thread to be there forever, stopping the VM from exiting. (Matters a lot at the JAX-WS client side)
  >
  >This needs to be fixed. 
  >
  >Thanks
  >-Bharath
  >http://www.bharathganesh.com
  >  
  >
  Hi Barath,

  This timer is canceled - in the RMManager's  @PreDestroy annotated 
  shutdown method, which is called when the the bus is shutdown. Do you 
  call Bus.shutdown() in your application?

  Andrea.

Re: Non-Daemon Timer thread created at RMManager

Posted by Andrea Smyth <an...@iona.com>.
Bharath Ganesh wrote:

>Hi 
>
>I could see a Timer created at org.apache.cxf.ws.rm.RMManager using the default Timer constructor. This causes the associate timer thread to run as a non-daemon thread. 
>
>Since this timer is never cancelled, the thread to be there forever, stopping the VM from exiting. (Matters a lot at the JAX-WS client side)
>
>This needs to be fixed. 
>
>Thanks
>-Bharath
>http://www.bharathganesh.com
>  
>
Hi Barath,

This timer is canceled - in the RMManager's  @PreDestroy annotated 
shutdown method, which is called when the the bus is shutdown. Do you 
call Bus.shutdown() in your application?

Andrea.