I am trying to develop an application manager to manage MHP applications. I would like your inputs on how to tackle the following issue.
The lifecycle control functions initXlet(),startXlet(),pauseXlet() and destroyXlet() are supposed to return quickly (As per the javax.tv.xlet Specification). That is these calls from the Application Manager are just to signal state changes to the application. But what if I make such a call to the application and the application puts that thread into a while(true) loop ?? . To be specific, a Rogue application would put my PauseXlet() or destroyXlet() called thread into a infinite loop and never return. So how should I take care of such a scenario?
What is the best strategy to make these calls to the application? I am planning to allocate a threadgroup to the thread I use to make the initXlet(),startXlet() ,etc calls and set a timer for each operation(on a trail error basis which i think is not the best way to do it).If the threads dont return after a reasonable amount of time(say 10sec) I would assume that the thread is hung or the application is misbehaving and proceed to destroy the application. If the destroy doesnt return then I would kill the threadgroup on the whole.
Please do tell me other alternatives to handle such applications.