I have the following snippet of codes first each of the thread is a socket waitign for connection where its gets a connection does all he necessary. Thereafter another section in the run it does this //run a new db connection and does a select where all those have not been updated will be send to webservice and later update their status. The weird part I notice at times this section is ran twice? Could it be the previous thread was not closed?
public void run() {
try{
//socket connection codes which does all the necessary and finally close the connection.
}
catch (SocketTimeoutException ex)
{
System.out.println("SocketTimeoutException has been caught in in the main first try");
ex.printStackTrace();
}
catch (IOException ex)
{
System.out.println("IOException has been caught in in the main first try");
ex.printStackTrace();
}
catch (Exception ex)
{
System.out.println( receivedSocketConn1.getInetAddress() +":"+receivedSocketConn1.getPort()+" IS CONNECTED ");
System.out.println("MyError:Exception has been caught in in the main first try");
ex.printStackTrace(System.out);
}
//run a new db connection and does a select where all those have not been updated will be send to webservice and later update their status.
}