use of org.eclipse.jetty.util.component.Container in project jetty.project by eclipse.
the class StatisticsServlet method sendTextResponse.
private void sendTextResponse(HttpServletResponse response) throws IOException {
StringBuilder sb = new StringBuilder();
sb.append(_statsHandler.toStatsHTML());
sb.append("<h2>Connections:</h2>\n");
for (Connector connector : _connectors) {
sb.append("<h3>").append(connector.getClass().getName()).append("@").append(connector.hashCode()).append("</h3>");
sb.append("Protocols:");
for (String protocol : connector.getProtocols()) sb.append(protocol).append(" ");
sb.append(" <br />\n");
ConnectionStatistics connectionStats = null;
if (connector instanceof Container)
connectionStats = ((Container) connector).getBean(ConnectionStatistics.class);
if (connectionStats != null) {
sb.append("Total connections: ").append(connectionStats.getConnectionsTotal()).append("<br />\n");
sb.append("Current connections open: ").append(connectionStats.getConnections()).append("<br />\n");
sb.append("Max concurrent connections open: ").append(connectionStats.getConnectionsMax()).append("<br />\n");
sb.append("Mean connection duration: ").append(connectionStats.getConnectionDurationMean()).append("<br />\n");
sb.append("Max connection duration: ").append(connectionStats.getConnectionDurationMax()).append("<br />\n");
sb.append("Connection duration standard deviation: ").append(connectionStats.getConnectionDurationStdDev()).append("<br />\n");
sb.append("Total bytes received: ").append(connectionStats.getReceivedBytes()).append("<br />\n");
sb.append("Total bytes sent: ").append(connectionStats.getSentBytes()).append("<br />\n");
sb.append("Total messages received: ").append(connectionStats.getReceivedMessages()).append("<br />\n");
sb.append("Total messages sent: ").append(connectionStats.getSentMessages()).append("<br />\n");
} else {
ConnectorStatistics connectorStats = null;
if (connector instanceof AbstractConnector)
connectorStats = ((AbstractConnector) connector).getBean(ConnectorStatistics.class);
if (connectorStats != null) {
sb.append("Statistics gathering started ").append(connectorStats.getStartedMillis()).append("ms ago").append("<br />\n");
sb.append("Total connections: ").append(connectorStats.getConnections()).append("<br />\n");
sb.append("Current connections open: ").append(connectorStats.getConnectionsOpen()).append("<br />\n");
sb.append("Max concurrent connections open: ").append(connectorStats.getConnectionsOpenMax()).append("<br />\n");
sb.append("Mean connection duration: ").append(connectorStats.getConnectionDurationMean()).append("<br />\n");
sb.append("Max connection duration: ").append(connectorStats.getConnectionDurationMax()).append("<br />\n");
sb.append("Connection duration standard deviation: ").append(connectorStats.getConnectionDurationStdDev()).append("<br />\n");
sb.append("Total messages in: ").append(connectorStats.getMessagesIn()).append("<br />\n");
sb.append("Total messages out: ").append(connectorStats.getMessagesOut()).append("<br />\n");
} else {
sb.append("Statistics gathering off.\n");
}
}
}
sb.append("<h2>Memory:</h2>\n");
sb.append("Heap memory usage: ").append(_memoryBean.getHeapMemoryUsage().getUsed()).append(" bytes").append("<br />\n");
sb.append("Non-heap memory usage: ").append(_memoryBean.getNonHeapMemoryUsage().getUsed()).append(" bytes").append("<br />\n");
response.setContentType("text/html");
PrintWriter pout = response.getWriter();
pout.write(sb.toString());
}
use of org.eclipse.jetty.util.component.Container in project jetty.project by eclipse.
the class MBeanContainerTest method setBeanAdded.
private void setBeanAdded() {
managed = new Managed();
Container container = new ContainerLifeCycle();
mbeanContainer.beanAdded(container, managed);
mbeanServer = mbeanContainer.getMBeanServer();
}
use of org.eclipse.jetty.util.component.Container in project cxf by apache.
the class JettyHTTPServerEngine method addServerMBean.
private void addServerMBean() {
if (mBeanContainer == null) {
return;
}
try {
Container container = getContainer(server);
container.addEventListener(mBeanContainer);
mBeanContainer.beanAdded(null, server);
} catch (RuntimeException rex) {
throw rex;
} catch (Exception r) {
throw new RuntimeException(r);
}
}
Aggregations