1 Reply Latest reply: Jan 21, 2014 6:51 AM by Marian Kolesar RSS

How to stop service from within startService()

Marian Kolesar Newbie

Hello. I would need to programmatically  stop service bean from its own startService() method. As on our project we have specific config file where is defiened whether service is enabled or disabled. In startService() I would read this config and if service is disabled I would need to stop the service. Also I would need for this serivce  to appear as stopped in jmx-console.

 

Thanks in advance

Marian

  • 1. Re: How to stop service from within startService()
    Marian Kolesar Newbie

    Hello,

     

    I have resolved issue perhaps not very correctly from design perspective but it worked for me. Here is solution: If service should be stopped, from startService() I started new thread that regularly checks whether service appears as started, if so, simply stop service. When invoking thread, there was passed reference to service bean, and afterwards on this reference was invoked stopService() method. That's all. If you need sources please let me know. And sorry for so late share of solution .

     

    Marian