Tomcat 현재 열려 있는 Connection pool 개수 조회
<%@ page language="java" contentType="text/html; charset=utf-8" %>
<%@ page import="
javax.naming.*,
javax.sql.*,
org.apache.tomcat.dbcp.dbcp.*"
%>
<%
// org.apache.commons.dbcp.*
Context initContext = new InitialContext();
Context envContext = (Context)initContext.lookup("java:/comp/env");
DataSource ds = (DataSource)envContext.lookup("jdbc/****");
BasicDataSource bds = (BasicDataSource)ds;
String dbname = "";
try {
int bdsNumActive = bds.getNumActive();
int bdsMaxActive = bds.getMaxActive();
int bdsNumIdle = bds.getNumIdle();
long bdsMaxWait = bds.getMaxWait();
String fontcolor = "";
if (bdsNumActive <= 400) {
fontcolor = "<font color='green'>";
} else if (bdsNumActive > 400 && bdsNumActive <= 500) {
fontcolor = "<font color='orange'>";
} else {
fontcolor = "<font color='red'>";
}
%>
<table cellpadding='3' cellspacing='0' border='1'>
<tr>
<td colspan='4' align='center'><b><%=dbname%></b> DataSource</td>
</tr>
<tr>
<td height='24' align='center' alt='connections that are processing'># Active Connections</td>
<td height='24' align='center' alt='total size of pool'>Maximum Active Connections</td>
<td height='24' align='center' alt='connections that are idle in the pool'># of Idle Connections</td>
<td height='24' align='center'>Maxium Wait period before timeout</td>
</tr>
<tr>
<td align='right'><%=fontcolor%><%=bdsNumActive%></font></td>
<td align='right'><%=bdsMaxActive%></td>
<td align='right'><%=bdsNumIdle%></td>
<td align='right'><%=bdsMaxWait%></td>
</tr>
</table>
<%
} catch(Exception e) {
out.println(e.toString());
}
%>
'Server > was' 카테고리의 다른 글
JEUS WAS 한글 인코딩 (1) | 2016.08.11 |
---|---|
Broken pipe 에러 회피 및 기타 옵션 (0) | 2016.01.26 |
JEUS 1.6 기동오류 (0) | 2015.11.06 |