Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Test and Performance Tools Platform (TPTP) » TPTP Java Agent - how to stop
TPTP Java Agent - how to stop [message #110905] Fri, 31 August 2007 11:00 Go to next message
Pavel Pravda is currently offline Pavel PravdaFriend
Messages: 4
Registered: July 2009
Junior Member
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.
Re: TPTP Java Agent - how to stop [message #110939 is a reply to message #110905] Fri, 31 August 2007 12:17 Go to previous messageGo to next message
Igor Alelekov is currently offline Igor AlelekovFriend
Messages: 139
Registered: July 2009
Senior Member
Hi Pavel,
In your sample Thread.sleep(1000) is redundant and can be excluded.
Regards,
Igor
Re: TPTP Java Agent - how to stop [message #110950 is a reply to message #110939] Fri, 31 August 2007 12:25 Go to previous messageGo to next message
Pavel Pravda is currently offline Pavel PravdaFriend
Messages: 4
Registered: July 2009
Junior Member
Yes, but if I exclude Sleep(), then virtual machine crashed. I forgot
write it to description of the problem.
Re: TPTP Java Agent - how to stop [message #111114 is a reply to message #110950] Mon, 03 September 2007 07:37 Go to previous messageGo to next message
Igor Alelekov is currently offline Igor AlelekovFriend
Messages: 139
Registered: July 2009
Senior Member
Hi Pavel,
I'm successfully terminating java agent without any sleep calls.
Please submit souce code of your agent.
Regards,
Igor
Re: TPTP Java Agent - how to stop [message #111284 is a reply to message #111114] Tue, 04 September 2007 08:29 Go to previous message
Pavel Pravda is currently offline Pavel PravdaFriend
Messages: 4
Registered: July 2009
Junior Member
I found, that thread with JNI calls I can't stop, so I resolved it by
System.exit(0) behind agent.deregister() without Sleep.
Previous Topic:TPTP 4.4.0.2 asks for a JAXP
Next Topic:tptpFileTranseferAgent problem
Goto Forum:
  


Current Time: Wed Aug 21 09:10:39 GMT 2019

Powered by FUDForum. Page generated in 0.01433 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top