Commit ae423998 authored by Daniel Henninger's avatar Daniel Henninger Committed by dhenninger

Added information about connection pool to admin console.

Added dbutil.jar to Admin.iml to satisfy IntelliJ checking.

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@9769 b35dd754-fafc-0310-a699-88a17e54d16e
parent b04d10fe
......@@ -357,6 +357,15 @@
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../lib/merge/dbutil.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntryProperties />
</component>
</module>
......
......@@ -254,6 +254,27 @@
##
## 3.4.3
## Added key: 'setup.ldap.user.vcard.avatardb'
##
## 3.4.5
# Added key: 'server.db.pool_info'
# Added key: 'server.db.house_keeping_sleep'
# Added key: 'server.db.house_keeping_sql'
# Added key: 'server.db.connection_lifetime'
# Added key: 'server.db.connection_max'
# Added key: 'server.db.connection_min'
# Added key: 'server.db.test_after_use'
# Added key: 'server.db.test_before_use'
# Added key: 'server.db.connections'
# Added key: 'server.db.connections.active'
# Added key: 'server.db.connections.available'
# Added key: 'server.db.connections.max'
# Added key: 'server.db.connections_served'
# Added key: 'server.db.connections_refused'
# Added key: 'server.db.connection_details'
# Added key: 'server.db.connection_details.id'
# Added key: 'server.db.connection_details.when_created'
# Added key: 'server.db.connection_details.last_used'
# Added key: 'server.db.connection_details.thread'
# Openfire
......@@ -1090,6 +1111,25 @@ server.db.transaction_level=Transaction Isolation Level:
server.db.multiple_connect=Supports multiple connections
server.db.multiple_connect2=open at once:
server.db.read_only_mode=In read-only mode:
server.db.pool_info=Connection Pool Info
server.db.house_keeping_sleep=House Keeping Interval:
server.db.house_keeping_sql=Connection Test SQL:
server.db.connection_lifetime=Maximum Connection Lifetime:
server.db.connection_max=Maximum Connections:
server.db.connection_min=Minimum Connections:
server.db.test_after_use=Test Connection After Use:
server.db.test_before_use=Test Connection Before Use:
server.db.connections=Connections:
server.db.connections.active=active
server.db.connections.available=available
server.db.connections.max=max
server.db.connections_served=Connections Served:
server.db.connections_refused=Connections Refused:
server.db.connection_details=Connection Details:
server.db.connection_details.id=Id
server.db.connection_details.when_created=When Created
server.db.connection_details.last_used=Last Used
server.db.connection_details.thread=Thread
server.db_stats.title=Database Query Statistics
server.db_stats.description=Enable database query statistics to trace all database queries made. \
......
......@@ -13,6 +13,11 @@
java.sql.*"
errorPage="error.jsp"
%>
<%@ page import="org.logicalcobwebs.proxool.ConnectionPoolDefinitionIF" %>
<%@ page import="org.logicalcobwebs.proxool.ProxoolFacade" %>
<%@ page import="org.logicalcobwebs.proxool.admin.SnapshotIF" %>
<%@ page import="org.logicalcobwebs.proxool.ConnectionInfoIF" %>
<%@ page import="java.text.SimpleDateFormat" %>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt_rt" prefix="fmt" %>
......@@ -150,7 +155,160 @@
try { if (con != null) { con.close(); } }
catch (SQLException e) { Log.error(e); }
}
if (DbConnectionManager.getConnectionProvider().isPooled()) {
try {
// Get metadata about the connection pool
ConnectionPoolDefinitionIF poolDef = ProxoolFacade.getConnectionPoolDefinition("openfire");
SnapshotIF poolStats = ProxoolFacade.getSnapshot("openfire", true);
Integer active = 100 * poolStats.getActiveConnectionCount() / poolStats.getMaximumConnectionCount();
Integer inactive = 100 * (poolStats.getAvailableConnectionCount() - poolStats.getActiveConnectionCount()) / poolStats.getMaximumConnectionCount();
Integer notopened = 100 - active - inactive;
SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss");
%>
<br/><br/>
<div class="jive-table">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<thead>
<tr>
<th colspan="2"><fmt:message key="server.db.pool_info" /></th>
</tr>
</thead>
<tbody>
<tr>
<td class="c1">
<fmt:message key="server.db.house_keeping_sleep" />
</td>
<td class="c2">
<%= (poolDef.getHouseKeepingSleepTime() / 1000) %> <fmt:message key="server.db_stats.seconds" />
</td>
</tr>
<tr>
<td class="c1">
<fmt:message key="server.db.connection_lifetime" />
</td>
<td class="c2">
<%= (poolDef.getMaximumConnectionLifetime() / 1000) %> <fmt:message key="server.db_stats.seconds" />
</td>
</tr>
<tr>
<td class="c1">
<fmt:message key="server.db.connection_min" />
</td>
<td class="c2">
<%= poolDef.getMinimumConnectionCount() %>
</td>
</tr>
<tr>
<td class="c1">
<fmt:message key="server.db.connection_max" />
</td>
<td class="c2">
<%= poolDef.getMaximumConnectionCount() %>
</td>
</tr>
<tr>
<td class="c1">
<fmt:message key="server.db.house_keeping_sql" />
</td>
<td class="c2">
<%= poolDef.getHouseKeepingTestSql() %>
</td>
</tr>
<tr>
<td class="c1">
<fmt:message key="server.db.test_before_use" />
</td>
<td class="c2">
<%= (poolDef.isTestBeforeUse() ? "Yes" : "No") %>
</td>
</tr>
<tr>
<td class="c1">
<fmt:message key="server.db.test_after_use" />
</td>
<td class="c2">
<%= (poolDef.isTestAfterUse() ? "Yes" : "No") %>
</td>
</tr>
<tr>
<td class="c1">
<fmt:message key="server.db.connections" />
</td>
<td class="c2">
<%= poolStats.getActiveConnectionCount() %> (<fmt:message key="server.db.connections.active"/>),
<%= poolStats.getAvailableConnectionCount() %> (<fmt:message key="server.db.connections.available"/>),
<%= poolStats.getMaximumConnectionCount() %> (<fmt:message key="server.db.connections.max"/>)<br/>
<table border="0" cellspacing="0" cellpadding="0" width="250px" style="margin: 8px; font-size: 50%">
<tr>
<% if (active > 0) { %><td style="border: 1.0px solid #000000; background-color: #ffffaa" width="<%= active %>%">&nbsp;</td><% } %>
<% if (inactive > 0) { %><td style="border: 1.0px solid #000000; background-color: #aaffaa" width="<%= inactive %>%">&nbsp;</td><% } %>
<td style="border: 1.0px solid #000000; background-color: #eeeeee" width="<%= notopened %>%">&nbsp;</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="c1">
<fmt:message key="server.db.connections_served" />
</td>
<td class="c2">
<%= poolStats.getServedCount() %>
</td>
</tr>
<tr>
<td class="c1">
<fmt:message key="server.db.connections_refused" />
</td>
<td class="c2">
<%= poolStats.getRefusedCount() %>
</td>
</tr>
<tr>
<td class="c1">
<fmt:message key="server.db.connection_details" />
</td>
<td class="c2">
<table cellspacing="0">
<thead>
<tr>
<th><fmt:message key="server.db.connection_details.id"/></th>
<th><fmt:message key="server.db.connection_details.when_created"/></th>
<th><fmt:message key="server.db.connection_details.last_used"/></th>
<th><fmt:message key="server.db.connection_details.thread"/></th>
</tr>
</thead>
<tbody>
<%
for (ConnectionInfoIF info : poolStats.getConnectionInfos()) {
%>
<tr>
<td align="center" style="padding: 2px"><%= info.getId() %></td>
<td align="center" style="padding: 2px"><%= dateFormat.format(info.getBirthDate()) %></td>
<td align="center" style="padding: 2px"><%= info.getTimeLastStartActive() > 0 ? dateFormat.format(new Date(info.getTimeLastStartActive())) : "-" %></td>
<td align="center" style="padding: 2px"><%= info.getRequester() != null ? info.getRequester() : "-" %></td>
</tr>
<%
}
%>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
<%
}
catch (Exception e) {
// Nothing
Log.error("AdminConsole: Error while displaying connection pool information: ", e);
}
}
%>
<br/><br/>
<table border="0">
<tr>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment