| TPTP Java Agent - how to stop [message #110905] |
Fri, 31 August 2007 07:00  |
Eclipse User |
|
|
|
Hi all
I have two problems in TPTP java agent. First is how I can correctly close
agent? This is my run method:
public void run() {
try {
synchronized (lock) {
lock.wait();
}
} catch (Exception e) {
e.printStackTrace();
}
}
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
/* Deregister agent */
this.deregister();
}
lock.notify() - I'm calling this on receive command. My problem is
Thread.sleep(1000). It is not so clear solution. In C++ is something like
WaitForCloseConnection()...I can't remember name of these method now. How
can I do it in Java Agent?
My second problem is not TPTP problem, but I have this problem in Agent
;-) I'm connecting DLL via JNI and running functions from this DLL in
separate thread. If this DLL contains endless loop, then I can't stop this
thread. Methods .stop() and .interrupt() are not working. I don't know why.
Solution for both my problems is System.exit(0), but it is too hard
solution, I think :-) Sorry for my english and thanks for your help.
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05414 seconds