• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

Stopping deamon application from eclipse

 
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am developing an deamon kind of application.

When I am starting the application at that time i am storing a reference of Manager(main) class in a static field.
Now while stopping the deamon. I have accessing the same instance of Manager class and calling shutdown method on same.

Now this is fine when both the execution(start/stop) are in same JVM but by default, eclipse stars a new jvm on each execution of main class.

So any one has any idea how to change this default behavior, so that both the execution are in same JVM.

thanks in advance.
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No, that's not possible - neither inside nor outside of Eclipse. It's just not how the JVM works.

A typical way of solving this problem is having the main application listen to a port and having the shutdown command sending a special string to that port, so that the main application knows that it should shut down.
 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Swapnil,
As Ilja rightly mentioned, Java provides no standard (predefined) way of doing Inter Process communication - which is what you require. Common methods of achieving inter process communication include, sockets (most preferred), RMI, CORBA, locking files (least preferred).

I am pasting some links which can give your more insight into which method would be the best for your case:

JavaWorld article
Sun's developer forum

I hope this helps.

- Sandeep
[ June 04, 2007: Message edited by: Sandeep Deb ]
 
Swapnil Shroff
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Ilja,
Thanks Sandeep..
I have used saockets for the same and it is working fine.

Swapnil
 
Blood pressure normal? What do I change to get "magnificent"? Maybe this tiny ad?
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic