-1

I used Runtime.getRuntime().exec() to start external program in GREG handler, and get its pid. But how I can detect when the GREG stopping or restarting , that I can stop or restart the external program.

Community
  • 1
  • 1
yeahliu
  • 154
  • 1
  • 8

2 Answers2

1

There is no documented mechanism of doing this. There are some internal mechanisms within the OSGi space where the components can define dependancies to detest if those are started. However, I do not think those are exposed to handler API.

One way to do is to check if you can access a resource successfully from within the handler, and if so, then start the program.

Samisa
  • 1,012
  • 1
  • 10
  • 19