killerxf 发表于 2017-2-4 12:21:02

tomcat启动中项目的访问时间无限延长

前天在tomcat中部署了2个项目,Eric_Manager和Eric_Regedit,在Eric_Manager启动过程中有关于访问Eric_Regedit的一段代码

public boolean registerRoomUser(String roomId,Set userlist){
this.myUrl = this.myUrl + "/RegeditUserAction!regeditRoomAndUser.do";
URL url;
String usernames = null;
if(userlist == null || userlist.size() == 0){
usernames = "userNames="+"";
}else{
usernames = this.mapConvertStirng(userlist);
}
BufferedReader read = null;
PrintWriter out = null;
boolean checkResult = false;
try {
url = new URL(this.myUrl);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
connection.setDoInput(true);
connection.setDoOutput(true);
out = new PrintWriter(connection.getOutputStream());
out.print(usernames+ "&");
out.print("roomId="+roomId);
out.flush();
read = new BufferedReader(new InputStreamReader(connection.getInputStream()) );
String input = null;
if((input = read.readLine()) != null)
{
if(input.equals("false")){
checkResult = false;
}else if(input.equals("true")){
checkResult = true;
}
}
} catch (MalformedURLException e) {
Log4jUtil.info("连接注册服务器发生MalformedURLException异常---------1");
} catch (IOException e) {
Log4jUtil.info("连接注册服务器发生IOException异常---------2");
}finally{
out.close();
try {
read.close();
} catch (IOException e) {
Log4jUtil.info("关闭流时发生IOException");
}
}
return checkResult;
}

    此时Tomcat还未加载Eric_Regedit的项目,那么程序段就会堵塞在:
read = new BufferedReader(new InputStreamReader(connection.getInputStream()) );
    那么这样就会造成项目无法正常启动。
页: [1]
查看完整版本: tomcat启动中项目的访问时间无限延长