in my previous problem, i'm running out of port because i always create a new connection when i need it. i check all of my
code & i'm sure i'm not forget to call con.close(); every times i don't need that connection anymore. so i wrote my test case
like this:
public static void main(String[] args) throws Exception {
Class.forName(xxx); //... load driver
Connection con = DriverManager.getConnection(xxx,xxx,xxx);
con.close();
}
i run netstat to check port before, while(using Thread.sleep(xxx)) & after running this test case. this is result
after that:
TCP TOSHIBA2450:3306 localhost:4002 TIME_WAIT
i think calling Connection.close(); only apply to close tcp/ip connection from client side. it will cause server wait until
timeout reached for close connection at server side. am i right? so how to close server side port instantly through our
code?