|
From: <San...@DM...> - 2003-05-06 08:03:28
|
I have a service that launch a java app, sometimes this app could crash,
then the service goes down.
I have another java service that check if some services are alive. This
service runs code below to check services status:
private boolean ping(String p_host, String p_port)
{
int count = 0;
int portInt = Integer.parseInt(p_port);
m_log.log(m_sCabeceraLogs,"Pinging "+ p_port+ " ...");
while (count < 10) {
try {
Socket s1 = new Socket(p_host, portInt);
s1.close();
m_log.log(m_sCabeceraLogs,p_port+ " is running!");
break;
} catch (Exception e) {
m_log.log(m_sCabeceraLogs,p_port+ " not responding
.. retrying");
count++;
}
try {
Thread.currentThread().sleep(1000);
} catch (Exception e) {};
}
if (count == 10) {
return false;
}else
{
return true;
}
}
This code works fine this other services, but with services that uses
wrapper, sentence "Socket s1 = new Socket(p_host, portInt);" throws a
exception.
How can I tell wrapper that accepts this calls?
|