2013年9月10日星期二

Pray for breaking the law

blocking IO in = read (buffer) , if in broken due to network reasons , has been blocked , the program will be suspended , even if the recovery over time , in can not continue , so causing the program to hang died there due to hang , but also an exception can not be caught , I do nothing , seeking master to a blocking IO solution
------ Solution ----------------------- ---------------------
that write their own code
1. closing the Session when a notification to the queue , let it recover from a blocking state
2. use with a timeout of blocking access ways
------ Solution ------------------------- -------------------
two suggested :
1, to establish a network connection, set the timeout parameter ;
2, using NIO technology , ie non-blocking IO.
------ For reference only -------------------------------------- -
1. networks which parameters should be set before the connection ?
ftp.setDefaultTimeout (2 * 60 * 1000);
ftp.setSoTimeout (5 * 60 * 1000);
these two sets are still blocked
2.nio change too, I dreaded other problems arise , they still want to punch blocking IO start here
------ For reference only ---------- -----------------------------
resolved, ftp.setDataTimeout (1000);

没有评论:

发表评论