`
flysky7931
  • 浏览: 43606 次
  • 性别: Icon_minigender_1
  • 来自: 武汉
社区版块
存档分类
最新评论

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

    博客分类:
  • J2EE
阅读更多
    前天在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()) );

    那么这样就会造成项目无法正常启动。
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics