windows - Port is not open asap -
i re-run web application , have wait 7 seconds port being opened.
- i have rest service "sub-service1" & "sub-service2" working on local machine.
- i have service "main" uses service "sub-service1" , "sub-service2"
sometimes have switch between service "sub-service1" service "sub-service2" , backwards (they're web applications , can see pid, processes)
sometimes have kill "sub-service1" , run again. "sub-service1" after restart available after 7 seconds cannot accept.
is there can service available run? maybe should close services in other way can close port when exiting or something?
some code:
private process startbigserviceprocess() { if (!processhandler.isprocessopen(processname)) { return processhandler.start(exepathofservice, filenameofservice); } else { processhandler.getprocess(processname).kill(); //after killing process, port closed few seconds thread.sleep(7000);//if there no sleep, service not accesible return processhandler.start(exepathofservice, filenameofservice); } }
it takes 7 seconds time_wait listening status. i've checked netstat -anb | find "4579"
Comments
Post a Comment