Created
December 10, 2015 02:21
-
-
Save diablowu/43064dfd86d51708dfbb to your computer and use it in GitHub Desktop.
DBCP ds status
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <%@page trimDirectiveWhitespaces="true" %> | |
| <%@page import="java.io.*"%> | |
| <%@page import="javax.naming.InitialContext" %> | |
| <%@page import="javax.naming.NamingException" %> | |
| <%@page import="javax.sql.DataSource" %> | |
| <%@page import="java.nio.charset.Charset"%> | |
| <%@page import="org.apache.tomcat.dbcp.dbcp.BasicDataSource" %> | |
| <%@ page language="java" contentType="text/html; charset=UTF-8" | |
| pageEncoding="UTF-8"%> | |
| <% | |
| final String FMT = "{" | |
| +"\"init\":%d," | |
| +"\"maxi\":%d," | |
| +"\"mini\":%d," | |
| +"\"numi\":%d," | |
| +"\"numa\":%d," | |
| +"\"maxa\":%d," | |
| +"\"maxw\":%d," | |
| +"\"maxp\":%d" | |
| +"}"; | |
| String token = request.getParameter("t_o_k_e_n"); | |
| if("passwd".equals(token)){ | |
| InitialContext context = context = new InitialContext(); | |
| BasicDataSource ds = | |
| (BasicDataSource) context.lookup("java:comp/env/jdbc/ds"); | |
| out.println( | |
| String.format(FMT | |
| ,ds.getInitialSize() | |
| ,ds.getMaxIdle() | |
| ,ds.getMinIdle() | |
| ,ds.getNumIdle() | |
| ,ds.getNumActive() | |
| ,ds.getMaxActive() | |
| ,ds.getMaxWait() | |
| ,ds.getMaxOpenPreparedStatements() | |
| ) | |
| ); | |
| } | |
| %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment