1. beginning refreshed exception information : java.sql.SQLException: We are already in the process of making 11 connections and the number of ; simultaneous builds has been throttled to 10
2. refresh the information for some time after the exception is : java.sql.SQLException: Couldn't get connection because we are at maximum connection count (200/200) and there are none
3. finally reported out of memory exception. [/ align]
code I checked no problem , pst, rs, conn that were closed off to access the home page 19 query method is same level concepts.
@RequestMapping(value = { "indexInfo" }, method = { RequestMethod.GET,
RequestMethod.POST })
public ModelAndView indexInfo(HttpServletRequest request,
HttpServletResponse response, HttpSession session, ModelMap modelMap)
throws Exception {
List<Map<String, Object>> maps = browseByPicNewsType(7);
StringBuffer sb = new StringBuffer();
StringBuffer sb1 = new StringBuffer();
StringBuffer sb2 = new StringBuffer();
for (Map<String, Object> map : maps) {
sb.append("../");
sb.append(map.get("IMAGEPATH"));
sb.append("|");
sb1.append("../news_pic/picInfo.do?id=");
sb1.append(map.get("ID"));
sb1.append("|");
sb2.append(map.get("TITLE"));
sb2.append("|");
}
modelMap.put("news_pic_imgpath", sb.substring(0, sb.length() - 1));
modelMap.put("news_pic_url", sb1.substring(0, sb1.length() - 1));
modelMap.put("news_pic_title", sb2.substring(0, sb2.length() - 1));
objList = new ArrayList();
HashMap optionMap = new HashMap();
optionMap.put("value", "content");
optionMap.put("text", "文章");
objList.add(optionMap);
optionMap = new HashMap();
optionMap.put("value", "pics");
optionMap.put("text", "图片");
objList.add(optionMap);
// 经信动态
List<Map<String, Object>> jingxindongtai = getAdminService()
.select(
" jxw_news",
"Id, title, content,newType,userName,hints, issueDate,createdate",
"newType=9 order by createdate desc limit 0,9");
modelMap.put("jingxindongtai", jingxindongtai);
// 领导讲话
List<Map<String, Object>> lingdaojianghua = getAdminService()
.select(
" jxw_news",
"Id, title, content,newType,userName,hints, issueDate,createdate",
"newType=4 order by createdate desc limit 0,10");
modelMap.put("lingdaojianghua", lingdaojianghua);
// 政策文件
List<Map<String, Object>> zhengcewenjian = getAdminService()
.select(
" jxw_news",
"Id, title, content,newType,userName,hints, issueDate,createdate",
"newType=10 order by createdate desc limit 0,10");
modelMap.put("zhengcewenjian", zhengcewenjian);
// 机关党建
List<Map<String, Object>> jiguandangjian = getAdminService()
.select(
" jxw_news",
"Id, title, content,newType,userName,hints, issueDate,createdate",
"newType=37 order by createdate desc limit 0,10");
modelMap.put("jiguandangjian", jiguandangjian);
// 县区工作
List<Map<String, Object>> xianqugongzuo = getAdminService()
.select(
" jxw_news",
"Id, title, content,newType,userName,hints, issueDate,createdate",
"newType=40 order by createdate desc limit 0,10");
modelMap.put("xianqugongzuo", xianqugongzuo);
// 综合信息
List<Map<String, Object>> zonghexinxi = getAdminService()
.select(
" jxw_news",
"Id, title, content,newType,userName,hints, issueDate,createdate",
"newType=2 order by createdate desc limit 0,10");
modelMap.put("zonghexinxi", zonghexinxi);
// 经信知识
List<Map<String, Object>> jingxinzhishi = getAdminService()
.select(
" jxw_news",
"Id, title, content,newType,userName,hints, issueDate,createdate",
"newType=64 order by createdate desc limit 0,10");
modelMap.put("jingxinzhishi", jingxinzhishi);
// 政策法规
List<Map<String, Object>> zhengcefagui = getAdminService()
.select(
" jxw_news",
"Id, title, content,newType,userName,hints, issueDate,createdate",
"newType=3 order by createdate desc limit 0,10");
modelMap.put("zhengcefagui", zhengcefagui);
// 政策法规 国资委
List<Map<String, Object>> zhengcefaguigzw = getAdminService()
.select(
" jxw_news",
"Id, title, content,newType,userName,hints, issueDate,createdate",
"newType=160 order by createdate desc limit 0,15");
modelMap.put("zhengcefaguigzw", zhengcefaguigzw);
// 国资动态
List<Map<String, Object>> guozidongtai = getAdminService()
.select(
" jxw_news",
"Id, title, content,newType,userName,hints, issueDate,createdate",
"newType=22 order by createdate desc limit 0,10");
modelMap.put("guozidongtai", guozidongtai);
// 国资动态 国资委
List<Map<String, Object>> guozidongtaigzw = getAdminService()
.select(
" jxw_news",
"Id, title, content,newType,userName,hints, issueDate,createdate",
"newType=161 order by createdate desc limit 0,15");
modelMap.put("guozidongtaigzw", guozidongtaigzw);
// 通知公告
List<Map<String, Object>> tongzhigonggao = getAdminService()
.select(
" jxw_news",
"Id, title, content,newType,userName,hints, issueDate,createdate",
"newType=6 order by createdate desc limit 0,10");
modelMap.put("tongzhigonggao", tongzhigonggao);
// 企业资讯
List<Map<String, Object>> qiyezixun = getAdminService()
.select(
" jxw_news",
"Id, title, content,newType,userName,hints, issueDate,createdate",
"newType=16 order by createdate desc limit 0,10");
modelMap.put("qiyezixun", qiyezixun);
// 企业动态
List<Map<String, Object>> qiyedongtai = getAdminService()
.select(
" jxw_news",
"Id, title, content,newType,userName,hints, issueDate,createdate",
"newType=17 order by createdate desc limit 0,10");
modelMap.put("qiyedongtai", qiyedongtai);
// 重点工程
List<Map<String, Object>> zhongdiangongcheng = getAdminService()
.select(
" jxw_news",
"Id, title, content,newType,userName,hints, issueDate,createdate",
"newType=18 order by createdate desc limit 0,10");
modelMap.put("zhongdiangongcheng", zhongdiangongcheng);
List<Map<String, Object>> rows = getAdminService()
.select(
" jxw_renwu",
"Id, name, content,phone,email,address, createdate, files, type,sortnum,showinfront",
"type=0 order by createdate");
// 经信人物
modelMap.put("renwu", rows);
List<Map<String, Object>> rowss = getAdminService()
.select(
" jxw_renwu",
"Id, name, content,phone,email,address, createdate, files, type,sortnum,showinfront",
"type=1 order by createdate");
// 经信企业
modelMap.put("qiye", rowss);
List<Map<String, Object>> zhuanti = getAdminService()
.select(
" jxw_renwu",
"Id, name, content,phone,email,address, createdate, files, type,sortnum,showinfront",
"type=2 order by createdate");
modelMap.put("zhuanti", zhuanti);
List<Map<String, Object>> images = getAdminService()
.select(
" jxw_picnews",
"ID,title,newType,browseImage,imgurl,sortnum,content,createDate,userName,infoSource",
"browseImage=1 order by sortnum limit 0,5");// sortnum
// asc
modelMap.put("images", images);
modelMap.put("selectOption", objList);
return new ModelAndView("index2.jsp", modelMap);
}
connection pool configuration proxool.xml:
the proxool configuration can be embedded within your own
application's. Anything outside the "proxool" tag is ignored.
->
------ Solution ------------------------- -------------------
landlord using the oracle do ?
is not driven version of the problem ah
------ Solution ----------------------------- ---------------
this setting unreasonable to
------ Solution ----------------- ---------------------------
see what you write database connection release automatically released
--- --- Solution --------------------------------------------
read this on a reasonable yet ? 4 floor of a friend ? Abnormalities also reported it ? Configure the connection pool , first look at the official description of what each attribute value in the range of fluctuation , not just write the value on the line .
------ Solution ---------------------------------------- ----
try another connection pool try, will not be BUG
------ Solution --------------------------------- -----------
set a
will be better
------ Solution -------------------------------- ------------
not have a maximum number of concurrent projects carrying capacity , is the largest optimization and let concurrency can be more, can not do infinitely complicated , so you did this in the stress test it
------ For reference only --------------------------------- ------
Please great God who is pointing pointing , grateful brother ! ! ! Will dinners .
------ For reference I think it is only ---------------------------------------
connection pool problem , java.sql.SQLException: We are already in the process of making 11 connections and the number of simultaneous builds has been throttled to 10
great God who come to help me ! ! !
------ For reference only -------------------------------------- -
read this on a reasonable yet ? 4 floor of a friend ? Abnormalities also reported it ?
------ For reference only -------------------------------------- -
I use mysql, thank you , did not see proxool.xml in the drive , right ?
------ For reference only -------------------------------------- -
5 floor of a friend What do you mean ? A code ? I use jdbc connection pool , the connection every time I would get in the way following close conn, pst, rs 's .
------ For reference only -------------------------------------- -
still on the code it ! ! !
This is connected with the connection pool for the class :
package cn.com.rocan.db;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class DBUtil {
public static Connection getConn() throws SQLException {
Connection connection = null;
connection = DriverManager.getConnection("proxool.jxw_db");
return connection;
}
}
This is Dao query :
/**
* 查询所有数据
*
* @param tableName
* 表明
* @param fields
* 字段名["name,pass,desc"]
* @param whereStr
* 条件[id=1 and name='user1']
* @return 结果 List<Map<String, Object>>类型。Map的Key为大写字母
* @throws Exception
* 异常统一向页面抛
*/
public List<Map<String, Object>> select(String tableName, String fields,
String whereStr) throws Exception {
Map<String, Object> map = null;
List<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
// String str[] = fields.split(",");
StringBuilder sql = new StringBuilder();
Connection conn = null;
PreparedStatement pst = null;
ResultSet rs = null;
// DatabaseUtil database = new DatabaseUtil();
conn = DBUtil.getConn();
sql.append("select ").append(fields).append(" from ").append(tableName);
if ((whereStr != null) && (!"".equals(whereStr))) {
sql.append(" where ").append(whereStr);
}
pst = conn.prepareStatement(sql.toString());
rs = pst.executeQuery();
// System.out.println("[SQL]:" + sql);
log.debug("[SQL]:" + sql);
// rs = DatabaseUtil.executeQuery(sql.toString(), pst, rs, conn);
if (rs != null && (!"".equals(rs.toString()))) {
ResultSetMetaData rsmd = rs.getMetaData();
while (rs.next()) {
map = new HashMap<String, Object>();
for (int i = 1; i <= rsmd.getColumnCount(); i++) {
map.put(rsmd.getColumnName(i).toUpperCase(), rs
.getObject(rsmd.getColumnName(i)));
}
list.add(map);
}
}
if (rs != null) {
rs.close();
rs = null;
}
if (pst != null) {
pst.close();
pst = null;
}
if (conn != null) {
conn.close();
conn = null;
}
return list;
}
------ For reference only ----------------------------------- ----
read this on a reasonable yet ? 4 floor of a friend ? Abnormalities also reported it ? Configure the connection pool , first look at the official description of what each attribute value in the range of fluctuation , not just write the value on the line .
Blessings, thank god advise, I changed , the re- test
------ For reference only -------------------- -------------------
, for what connection pool ? ? ?
------ For reference only -------------------------------------- -
C3P0 or DBCP
------ For reference only --------------------------------------- < br> create database connection first exception would be no excessive second database connection
database connection can not release or release rate did not you add a database connection speed.
If it requires the performance of a single case , then you can consider the proportion of exaggerating the number of connections , etc.
There is a home to go 19 list about the sql is not designed to have a problem
------ For reference only --------- ------------------------------
I used stored procedures, but not a problem. Thank you for your answer . Problem solved.
没有评论:
发表评论