# This patch file was generated by NetBeans IDE
# Following Index: paths are relative to: /Users/oleksiys/Projects/Glassfish/v3/core/kernel
# This patch can be applied using context Tools: Patch action on respective folder.
# It uses platform neutral UTF-8 encoding and \n newlines.
# Above lines and this line are ignored by the patching process.
Index: pom.xml
--- pom.xml Base (BASE)
+++ pom.xml Locally Modified (Based On LOCAL)
@@ -88,7 +88,7 @@
- com.sun.enterprise.v3.services.impl.monitor.probes.ThreadPoolProbeProvider,com.sun.enterprise.v3.services.impl.monitor.probes.FileCacheProbeProvider,com.sun.enterprise.v3.services.impl.monitor.probes.KeepAliveProbeProvider,com.sun.enterprise.v3.services.impl.monitor.probes.ConnectionsProbeProvider
+ com.sun.enterprise.v3.services.impl.monitor.probes.ThreadPoolProbeProvider,com.sun.enterprise.v3.services.impl.monitor.probes.FileCacheProbeProvider,com.sun.enterprise.v3.services.impl.monitor.probes.KeepAliveProbeProvider,com.sun.enterprise.v3.services.impl.monitor.probes.ConnectionQueueProbeProvider
Index: src/main/java/com/sun/enterprise/v3/services/impl/GrizzlyProxy.java
--- src/main/java/com/sun/enterprise/v3/services/impl/GrizzlyProxy.java Base (BASE)
+++ src/main/java/com/sun/enterprise/v3/services/impl/GrizzlyProxy.java Locally Modified (Based On LOCAL)
@@ -306,7 +306,7 @@
monitoring.registerThreadPoolStatsProvider(name);
monitoring.registerKeepAliveStatsProvider(name);
monitoring.registerFileCacheStatsProvider(name);
- monitoring.registerConnectionsStatsProvider(name);
+ monitoring.registerConnectionQueueStatsProvider(name);
}
protected void unregisterMonitoringStatsProviders() {
@@ -316,7 +316,7 @@
monitoring.unregisterThreadPoolStatsProvider(name);
monitoring.unregisterKeepAliveStatsProvider(name);
monitoring.unregisterFileCacheStatsProvider(name);
- monitoring.unregisterConnectionsStatsProvider(name);
+ monitoring.unregisterConnectionQueueStatsProvider(name);
}
Index: src/main/java/com/sun/enterprise/v3/services/impl/monitor/GrizzlyMonitoring.java
--- src/main/java/com/sun/enterprise/v3/services/impl/monitor/GrizzlyMonitoring.java Base (BASE)
+++ src/main/java/com/sun/enterprise/v3/services/impl/monitor/GrizzlyMonitoring.java Locally Modified (Based On LOCAL)
@@ -35,11 +35,11 @@
*/
package com.sun.enterprise.v3.services.impl.monitor;
-import com.sun.enterprise.v3.services.impl.monitor.probes.ConnectionsProbeProvider;
+import com.sun.enterprise.v3.services.impl.monitor.probes.ConnectionQueueProbeProvider;
import com.sun.enterprise.v3.services.impl.monitor.probes.FileCacheProbeProvider;
import com.sun.enterprise.v3.services.impl.monitor.probes.KeepAliveProbeProvider;
import com.sun.enterprise.v3.services.impl.monitor.probes.ThreadPoolProbeProvider;
-import com.sun.enterprise.v3.services.impl.monitor.stats.ConnectionsStatsProvider;
+import com.sun.enterprise.v3.services.impl.monitor.stats.ConnectionQueueStatsProvider;
import com.sun.enterprise.v3.services.impl.monitor.stats.FileCacheStatsProvider;
import com.sun.enterprise.v3.services.impl.monitor.stats.KeepAliveStatsProvider;
import com.sun.enterprise.v3.services.impl.monitor.stats.ThreadPoolStatsProvider;
@@ -66,9 +66,9 @@
// network-listener->keep-alive-stats Map
private final Map keepAliveStatsProvidersMap =
new ConcurrentHashMap();
- // network-listener->connections-stats Map
- private final Map connectionsStatsProvidersMap =
- new ConcurrentHashMap();
+ // network-listener->connection-queue-stats Map
+ private final Map connectionQueueStatsProvidersMap =
+ new ConcurrentHashMap();
// thread-pool emitter probe
private final ThreadPoolProbeProvider threadPoolProbeProvider;
@@ -76,14 +76,14 @@
private final FileCacheProbeProvider fileCacheProbeProvider;
// keep-alive emitter probe
private final KeepAliveProbeProvider keepAliveProbeProvider;
- // connections emitter probe
- private final ConnectionsProbeProvider connectionsProbeProvider;
+ // connection queue emitter probe
+ private final ConnectionQueueProbeProvider connectionQueueProbeProvider;
public GrizzlyMonitoring() {
threadPoolProbeProvider = new ThreadPoolProbeProvider();
fileCacheProbeProvider = new FileCacheProbeProvider();
keepAliveProbeProvider = new KeepAliveProbeProvider();
- connectionsProbeProvider = new ConnectionsProbeProvider();
+ connectionQueueProbeProvider = new ConnectionQueueProbeProvider();
}
/**
@@ -114,12 +114,12 @@
}
/**
- * Get connections probe provider
+ * Get connection queue probe provider
*
- * @return connections probe provider
+ * @return connection queue probe provider
*/
- public ConnectionsProbeProvider getConnectionsProbeProvider() {
- return connectionsProbeProvider;
+ public ConnectionQueueProbeProvider getConnectionQueueProbeProvider() {
+ return connectionQueueProbeProvider;
}
/**
@@ -216,33 +216,33 @@
}
/**
- * Register connections statistics provider for a network listener
+ * Register connection queue statistics provider for a network listener
*
* @param name network listener name
*/
- public void registerConnectionsStatsProvider(String name) {
- ConnectionsStatsProvider connectionsStatsProvider = new ConnectionsStatsProvider(name);
- ConnectionsStatsProvider oldConnectionsStatsProvider =
- connectionsStatsProvidersMap.put(name, connectionsStatsProvider);
+ public void registerConnectionQueueStatsProvider(String name) {
+ ConnectionQueueStatsProvider connectionQueueStatsProvider = new ConnectionQueueStatsProvider(name);
+ ConnectionQueueStatsProvider oldConnectionQueueStatsProvider =
+ connectionQueueStatsProvidersMap.put(name, connectionQueueStatsProvider);
- if (oldConnectionsStatsProvider != null) {
- StatsProviderManager.unregister(oldConnectionsStatsProvider);
+ if (oldConnectionQueueStatsProvider != null) {
+ StatsProviderManager.unregister(oldConnectionQueueStatsProvider);
}
StatsProviderManager.register(CONFIG_ELEMENT, PluginPoint.SERVER,
- subtreePrefix(name) + "/connections", connectionsStatsProvider);
+ subtreePrefix(name) + "/connection-queue", connectionQueueStatsProvider);
}
/**
- * Unregister connections statistics provider for a network listener
+ * Unregister connection queue statistics provider for a network listener
*
* @param name network listener name
*/
- public void unregisterConnectionsStatsProvider(String name) {
- final ConnectionsStatsProvider connectionsStatsProvider =
- connectionsStatsProvidersMap.remove(name);
- if (connectionsStatsProvider != null) {
- StatsProviderManager.unregister(connectionsStatsProvider);
+ public void unregisterConnectionQueueStatsProvider(String name) {
+ final ConnectionQueueStatsProvider connectionQueueStatsProvider =
+ connectionQueueStatsProvidersMap.remove(name);
+ if (connectionQueueStatsProvider != null) {
+ StatsProviderManager.unregister(connectionQueueStatsProvider);
}
}
Index: src/main/java/com/sun/enterprise/v3/services/impl/monitor/MonitorableEmbeddedHttp.java
--- src/main/java/com/sun/enterprise/v3/services/impl/monitor/MonitorableEmbeddedHttp.java Base (BASE)
+++ src/main/java/com/sun/enterprise/v3/services/impl/monitor/MonitorableEmbeddedHttp.java Locally Modified (Based On LOCAL)
@@ -62,6 +62,8 @@
super(grizzlyServiceListener);
this.monitoring = monitoring;
this.listenerName = listenerName;
+
+ keepAliveStats = createKeepAliveStats();
}
@Override
Index: src/main/java/com/sun/enterprise/v3/services/impl/monitor/MonitorableEmbeddedHttps.java
--- src/main/java/com/sun/enterprise/v3/services/impl/monitor/MonitorableEmbeddedHttps.java Base (BASE)
+++ src/main/java/com/sun/enterprise/v3/services/impl/monitor/MonitorableEmbeddedHttps.java Locally Modified (Based On LOCAL)
@@ -61,6 +61,8 @@
super(grizzlyServiceListener);
this.monitoring = monitoring;
this.listenerName = listenerName;
+
+ keepAliveStats = createKeepAliveStats();
}
@Override
Index: src/main/java/com/sun/enterprise/v3/services/impl/monitor/MonitorableKeepAliveStats.java
--- src/main/java/com/sun/enterprise/v3/services/impl/monitor/MonitorableKeepAliveStats.java Base (BASE)
+++ src/main/java/com/sun/enterprise/v3/services/impl/monitor/MonitorableKeepAliveStats.java Locally Modified (Based On LOCAL)
@@ -51,7 +51,13 @@
public MonitorableKeepAliveStats(GrizzlyMonitoring grizzlyMonitoring, String listenerName) {
this.grizzlyMonitoring = grizzlyMonitoring;
this.listenerName = listenerName;
+
+ if (grizzlyMonitoring != null) {
+ // Set initial monitoring values
+ setMaxKeepAliveRequests(getMaxKeepAliveRequests());
+ setKeepAliveTimeoutInSeconds(getKeepAliveTimeoutInSeconds());
}
+ }
@Override
public boolean isEnabled() {
@@ -59,6 +65,18 @@
}
@Override
+ public void setMaxKeepAliveRequests(int maxKeepAliveRequests) {
+ super.setMaxKeepAliveRequests(maxKeepAliveRequests);
+ grizzlyMonitoring.getKeepAliveProbeProvider().setMaxCountRequestsEvent(listenerName, maxKeepAliveRequests);
+ }
+
+ @Override
+ public void setKeepAliveTimeoutInSeconds(int timeout) {
+ super.setKeepAliveTimeoutInSeconds(timeout);
+ grizzlyMonitoring.getKeepAliveProbeProvider().setTimeoutInSecondsEvent(listenerName, timeout);
+ }
+
+ @Override
public void incrementCountConnections() {
// super.incrementCountConnections();
grizzlyMonitoring.getKeepAliveProbeProvider().incrementCountConnectionsEvent(listenerName);
Index: src/main/java/com/sun/enterprise/v3/services/impl/monitor/MonitorableSSLSelectorHandler.java
--- src/main/java/com/sun/enterprise/v3/services/impl/monitor/MonitorableSSLSelectorHandler.java Base (BASE)
+++ src/main/java/com/sun/enterprise/v3/services/impl/monitor/MonitorableSSLSelectorHandler.java Locally Modified (Based On LOCAL)
@@ -78,7 +78,7 @@
public SelectableChannel acceptWithoutRegistration(SelectionKey key)
throws IOException {
final SelectableChannel channel = super.acceptWithoutRegistration(key);
- grizzlyMonitoring.getConnectionsProbeProvider().connectionAcceptedEvent(
+ grizzlyMonitoring.getConnectionQueueProbeProvider().connectionAcceptedEvent(
listenerName, channel.hashCode());
return channel;
@@ -87,7 +87,7 @@
@Override
public boolean onConnectInterest(SelectionKey key, Context ctx)
throws IOException {
- grizzlyMonitoring.getConnectionsProbeProvider().connectionConnectedEvent(
+ grizzlyMonitoring.getConnectionQueueProbeProvider().connectionConnectedEvent(
listenerName, key.channel().hashCode());
return super.onConnectInterest(key, ctx);
Index: src/main/java/com/sun/enterprise/v3/services/impl/monitor/MonitorableSelectionKeyHandler.java
--- src/main/java/com/sun/enterprise/v3/services/impl/monitor/MonitorableSelectionKeyHandler.java Base (BASE)
+++ src/main/java/com/sun/enterprise/v3/services/impl/monitor/MonitorableSelectionKeyHandler.java Locally Modified (Based On LOCAL)
@@ -74,7 +74,7 @@
@Override
public void cancel(SelectionKey key) {
- grizzlyMonitoring.getConnectionsProbeProvider().connectionClosedEvent(
+ grizzlyMonitoring.getConnectionQueueProbeProvider().connectionClosedEvent(
listenerName, key.channel().hashCode());
super.cancel(key);
Index: src/main/java/com/sun/enterprise/v3/services/impl/monitor/MonitorableSelectorHandler.java
--- src/main/java/com/sun/enterprise/v3/services/impl/monitor/MonitorableSelectorHandler.java Base (BASE)
+++ src/main/java/com/sun/enterprise/v3/services/impl/monitor/MonitorableSelectorHandler.java Locally Modified (Based On LOCAL)
@@ -80,7 +80,7 @@
public SelectableChannel acceptWithoutRegistration(SelectionKey key)
throws IOException {
final SelectableChannel channel = super.acceptWithoutRegistration(key);
- grizzlyMonitoring.getConnectionsProbeProvider().connectionAcceptedEvent(listenerName, channel.hashCode());
+ grizzlyMonitoring.getConnectionQueueProbeProvider().connectionAcceptedEvent(listenerName, channel.hashCode());
return channel;
}
@@ -88,7 +88,7 @@
@Override
public boolean onConnectInterest(SelectionKey key, Context ctx)
throws IOException {
- grizzlyMonitoring.getConnectionsProbeProvider().connectionConnectedEvent(listenerName, key.channel().hashCode());
+ grizzlyMonitoring.getConnectionQueueProbeProvider().connectionConnectedEvent(listenerName, key.channel().hashCode());
return super.onConnectInterest(key, ctx);
}
Index: src/main/java/com/sun/enterprise/v3/services/impl/monitor/MonitorableThreadPool.java
--- src/main/java/com/sun/enterprise/v3/services/impl/monitor/MonitorableThreadPool.java Base (BASE)
+++ src/main/java/com/sun/enterprise/v3/services/impl/monitor/MonitorableThreadPool.java Locally Modified (Based On LOCAL)
@@ -37,6 +37,7 @@
*/
package com.sun.enterprise.v3.services.impl.monitor;
+import com.sun.enterprise.v3.services.impl.monitor.probes.ThreadPoolProbeProvider;
import com.sun.grizzly.http.StatsThreadPool;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
@@ -45,18 +46,30 @@
* Grizzly thread pool implementation that emits probe events.
*
* @author jluehe
+ * @author Alexey Stashok
*/
public class MonitorableThreadPool extends StatsThreadPool {
// The GrizzlyMonitoring objects, which encapsulates Grizzly probe emitters
private final GrizzlyMonitoring monitoring;
- private final String threadPoolMonitoringName;
+ private final String monitoringName;
public MonitorableThreadPool(GrizzlyMonitoring monitoring,
- String threadPoolMonitoringName) {
+ String monitoringName) {
this.monitoring = monitoring;
- this.threadPoolMonitoringName = threadPoolMonitoringName;
+ this.monitoringName = monitoringName;
setThreadFactory(new ProbeWorkerThreadFactory());
+
+ final ThreadPoolProbeProvider threadPoolProbeProvider =
+ monitoring.getThreadPoolProbeProvider();
+
+ threadPoolProbeProvider.setCoreThreadsEvent(
+ monitoringName, corePoolSize);
+ threadPoolProbeProvider.setMaxThreadsEvent(
+ monitoringName, maxPoolSize);
+
+ monitoring.getConnectionQueueProbeProvider().setMaxTaskQueueSizeEvent(
+ monitoringName, workQueue.remainingCapacity());
}
public MonitorableThreadPool(
@@ -66,24 +79,105 @@
super(threadPoolName, corePoolSize, maximumPoolSize, maxTasksCount,
keepAliveTime, unit);
this.monitoring = monitoring;
- this.threadPoolMonitoringName = threadPoolMonitoringName;
+ this.monitoringName = threadPoolMonitoringName;
setThreadFactory(new ProbeWorkerThreadFactory());
+
+ final ThreadPoolProbeProvider threadPoolProbeProvider =
+ monitoring.getThreadPoolProbeProvider();
+
+ threadPoolProbeProvider.setCoreThreadsEvent(
+ threadPoolMonitoringName, super.corePoolSize);
+ threadPoolProbeProvider.setMaxThreadsEvent(
+ threadPoolMonitoringName, super.maxPoolSize);
+
+ monitoring.getConnectionQueueProbeProvider().setMaxTaskQueueSizeEvent(
+ monitoringName, workQueue.remainingCapacity());
}
@Override
+ public void setCorePoolSize(int corePoolSize) {
+ synchronized (statelock) {
+ super.setCorePoolSize(corePoolSize);
+
+ if (monitoring == null) return;
+
+ monitoring.getThreadPoolProbeProvider().setCoreThreadsEvent(
+ monitoringName, corePoolSize);
+ }
+ }
+
+ @Override
+ public void setMaximumPoolSize(int maxPoolSize) {
+ synchronized (statelock) {
+ super.setMaximumPoolSize(maxPoolSize);
+
+ if (monitoring == null) return;
+
+ monitoring.getThreadPoolProbeProvider().setMaxThreadsEvent(
+ monitoringName, maxPoolSize);
+ }
+ }
+
+ @Override
+ protected void setPoolSizes(int corePoolSize, int maxPoolSize) {
+ synchronized (statelock) {
+ super.setPoolSizes(corePoolSize, maxPoolSize);
+
+ if (monitoring == null) return;
+
+ final ThreadPoolProbeProvider threadPoolProbeProvider =
+ monitoring.getThreadPoolProbeProvider();
+
+ threadPoolProbeProvider.setCoreThreadsEvent(
+ monitoringName, corePoolSize);
+ threadPoolProbeProvider.setMaxThreadsEvent(
+ monitoringName, maxPoolSize);
+ }
+ }
+
+
+ @Override
protected void beforeExecute(Thread thread, Runnable runnable) {
super.beforeExecute(thread, runnable);
monitoring.getThreadPoolProbeProvider().threadDispatchedFromPoolEvent(
- threadPoolMonitoringName, thread.getName());
+ monitoringName, thread.getName());
}
@Override
protected void afterExecute(Runnable r, Throwable t) {
monitoring.getThreadPoolProbeProvider().threadReturnedToPoolEvent(
- threadPoolMonitoringName, Thread.currentThread().getName());
+ monitoringName, Thread.currentThread().getName());
super.afterExecute(r, t);
}
+ @Override
+ protected void onWorkerExit(BasicWorker worker) {
+ monitoring.getThreadPoolProbeProvider().threadReleasedEvent(
+ monitoringName, Thread.currentThread().getName());
+ super.onWorkerExit(worker);
+ }
+
+ @Override
+ protected void onTaskQueued(Runnable task) {
+ monitoring.getConnectionQueueProbeProvider().onTaskQueuedEvent(
+ monitoringName, task);
+ super.onTaskQueued(task);
+ }
+
+ @Override
+ protected void onTaskDequeued(Runnable task) {
+ monitoring.getConnectionQueueProbeProvider().onTaskDequeuedEvent(
+ monitoringName, task);
+ super.onTaskDequeued(task);
+ }
+
+ @Override
+ protected void onTaskQueueOverflow() {
+ monitoring.getConnectionQueueProbeProvider().onTaskQueueOverflowEvent(
+ monitoringName);
+ super.onTaskQueueOverflow();
+ }
+
public class ProbeWorkerThreadFactory implements ThreadFactory {
@Override
@@ -92,8 +186,8 @@
MonitorableThreadPool.this, r, name +
"-(" + workerThreadCounter.getAndIncrement() + ")",
initialByteBufferSize, monitoring);
- monitoring.getThreadPoolProbeProvider().newThreadsAllocatedEvent(
- threadPoolMonitoringName, 1, true);
+ monitoring.getThreadPoolProbeProvider().threadAllocatedEvent(
+ monitoringName, thread.getName());
return thread;
}
}
Index: src/main/java/com/sun/enterprise/v3/services/impl/monitor/probes/ConnectionQueueProbeProvider.java
--- src/main/java/com/sun/enterprise/v3/services/impl/monitor/probes/ConnectionQueueProbeProvider.java Locally New
+++ src/main/java/com/sun/enterprise/v3/services/impl/monitor/probes/ConnectionQueueProbeProvider.java Locally New
@@ -0,0 +1,83 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
+ *
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common Development
+ * and Distribution License("CDDL") (collectively, the "License"). You
+ * may not use this file except in compliance with the License. You can obtain
+ * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
+ * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * When distributing the software, include this License Header Notice in each
+ * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
+ * Sun designates this particular file as subject to the "Classpath" exception
+ * as provided by Sun in the GPL Version 2 section of the License file that
+ * accompanied this code. If applicable, add the following below the License
+ * Header, with the fields enclosed by brackets [] replaced by your own
+ * identifying information: "Portions Copyrighted [year]
+ * [name of copyright owner]"
+ *
+ * Contributor(s):
+ *
+ * If you wish your version of this file to be governed by only the CDDL or
+ * only the GPL Version 2, indicate your decision by adding "[Contributor]
+ * elects to include this software in this distribution under the [CDDL or GPL
+ * Version 2] license." If you don't indicate a single choice of license, a
+ * recipient has the option to distribute your version of this file under
+ * either the CDDL, the GPL Version 2 or to extend the choice of license to
+ * its licensees as provided above. However, if you add GPL Version 2 code
+ * and therefore, elected the GPL Version 2 license, then the option applies
+ * only if the new code is made subject to such option by the copyright
+ * holder.
+ */
+package com.sun.enterprise.v3.services.impl.monitor.probes;
+
+import org.glassfish.external.probe.provider.annotations.Probe;
+import org.glassfish.external.probe.provider.annotations.ProbeParam;
+import org.glassfish.external.probe.provider.annotations.ProbeProvider;
+
+/**
+ * Probe provider interface for connection queue related events.
+ *
+ * @author Alexey Stashok
+ */
+@ProbeProvider(moduleProviderName = "glassfish", moduleName = "kernel", probeProviderName = "connection-queue")
+public class ConnectionQueueProbeProvider {
+
+ @Probe(name = "connectionAcceptedEvent")
+ public void connectionAcceptedEvent(
+ @ProbeParam("listenerName") String listenerName,
+ @ProbeParam("connection") int connectionId) {}
+
+ @Probe(name = "connectionConnectedEvent")
+ public void connectionConnectedEvent(
+ @ProbeParam("listenerName") String listenerName,
+ @ProbeParam("connection") int connectionId) {}
+
+ @Probe(name = "connectionClosedEvent")
+ public void connectionClosedEvent(
+ @ProbeParam("listenerName") String listenerName,
+ @ProbeParam("connection") int connectionId) {}
+
+ @Probe(name = "setMaxTaskQueueSizeEvent")
+ public void setMaxTaskQueueSizeEvent(
+ @ProbeParam("listenerName") String listenerName,
+ @ProbeParam("size") int size) {}
+
+ @Probe(name = "onTaskQueuedEvent")
+ public void onTaskQueuedEvent(
+ @ProbeParam("listenerName") String listenerName,
+ @ProbeParam("task") Runnable task) {}
+
+ @Probe(name = "onTaskDequeuedEvent")
+ public void onTaskDequeuedEvent(
+ @ProbeParam("listenerName") String listenerName,
+ @ProbeParam("task") Runnable task) {}
+
+ @Probe(name = "onTaskQueueOverflowEvent")
+ public void onTaskQueueOverflowEvent(
+ @ProbeParam("listenerName") String listenerName) {}
+}
Index: src/main/java/com/sun/enterprise/v3/services/impl/monitor/probes/ConnectionsProbeProvider.java
--- src/main/java/com/sun/enterprise/v3/services/impl/monitor/probes/ConnectionsProbeProvider.java Base (BASE)
+++ src/main/java/com/sun/enterprise/v3/services/impl/monitor/probes/ConnectionsProbeProvider.java Locally Deleted
@@ -1,66 +0,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- *
- * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
- *
- * The contents of this file are subject to the terms of either the GNU
- * General Public License Version 2 only ("GPL") or the Common Development
- * and Distribution License("CDDL") (collectively, the "License"). You
- * may not use this file except in compliance with the License. You can obtain
- * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
- * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
- * language governing permissions and limitations under the License.
- *
- * When distributing the software, include this License Header Notice in each
- * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
- * Sun designates this particular file as subject to the "Classpath" exception
- * as provided by Sun in the GPL Version 2 section of the License file that
- * accompanied this code. If applicable, add the following below the License
- * Header, with the fields enclosed by brackets [] replaced by your own
- * identifying information: "Portions Copyrighted [year]
- * [name of copyright owner]"
- *
- * Contributor(s):
- *
- * If you wish your version of this file to be governed by only the CDDL or
- * only the GPL Version 2, indicate your decision by adding "[Contributor]
- * elects to include this software in this distribution under the [CDDL or GPL
- * Version 2] license." If you don't indicate a single choice of license, a
- * recipient has the option to distribute your version of this file under
- * either the CDDL, the GPL Version 2 or to extend the choice of license to
- * its licensees as provided above. However, if you add GPL Version 2 code
- * and therefore, elected the GPL Version 2 license, then the option applies
- * only if the new code is made subject to such option by the copyright
- * holder.
- */
-package com.sun.enterprise.v3.services.impl.monitor.probes;
-
-import org.glassfish.external.probe.provider.annotations.Probe;
-import org.glassfish.external.probe.provider.annotations.ProbeParam;
-import org.glassfish.external.probe.provider.annotations.ProbeProvider;
-
-/**
- * Probe provider interface for connection related events.
- *
- * @author Alexey Stashok
- */
-@ProbeProvider(moduleProviderName = "glassfish", moduleName = "kernel", probeProviderName = "connections")
-public class ConnectionsProbeProvider {
-
- @Probe(name = "connectionAcceptedEvent")
- public void connectionAcceptedEvent(
- @ProbeParam("listenerName") String listenerName,
- @ProbeParam("connection") int connectionId) {}
-
- @Probe(name = "connectionConnectedEvent")
- public void connectionConnectedEvent(
- @ProbeParam("listenerName") String listenerName,
- @ProbeParam("connection") int connectionId) {
- }
-
- @Probe(name = "connectionClosedEvent")
- public void connectionClosedEvent(
- @ProbeParam("listenerName") String listenerName,
- @ProbeParam("connection") int connectionId) {
- }
-}
Index: src/main/java/com/sun/enterprise/v3/services/impl/monitor/probes/KeepAliveProbeProvider.java
--- src/main/java/com/sun/enterprise/v3/services/impl/monitor/probes/KeepAliveProbeProvider.java Base (BASE)
+++ src/main/java/com/sun/enterprise/v3/services/impl/monitor/probes/KeepAliveProbeProvider.java Locally Modified (Based On LOCAL)
@@ -47,21 +47,37 @@
*/
@ProbeProvider (moduleProviderName="glassfish", moduleName="kernel", probeProviderName="connections-keep-alive")
public class KeepAliveProbeProvider {
+ @Probe(name="setMaxCountRequestsEvent")
+ public void setMaxCountRequestsEvent(
+ @ProbeParam("listenerName") String listenerName,
+ @ProbeParam("maxRequests") int max) {}
+
+ @Probe(name="setTimeoutInSecondsEvent")
+ public void setTimeoutInSecondsEvent(
+ @ProbeParam("listenerName") String listenerName,
+ @ProbeParam("timeoutInSeconds") int timeoutInSeconds) {}
+
@Probe(name="incrementCountConnectionsEvent")
- public void incrementCountConnectionsEvent(@ProbeParam("listenerName") String listenerName) {}
+ public void incrementCountConnectionsEvent(
+ @ProbeParam("listenerName") String listenerName) {}
@Probe(name="decrementCountConnectionsEvent")
- public void decrementCountConnectionsEvent(@ProbeParam("listenerName") String listenerName) {}
+ public void decrementCountConnectionsEvent(
+ @ProbeParam("listenerName") String listenerName) {}
@Probe(name="incrementCountFlushesEvent")
- public void incrementCountFlushesEvent(@ProbeParam("listenerName") String listenerName) {}
+ public void incrementCountFlushesEvent(
+ @ProbeParam("listenerName") String listenerName) {}
@Probe(name="incrementCountHitsEvent")
- public void incrementCountHitsEvent(@ProbeParam("listenerName") String listenerName) {}
+ public void incrementCountHitsEvent(
+ @ProbeParam("listenerName") String listenerName) {}
@Probe(name="incrementCountRefusalsEvent")
- public void incrementCountRefusalsEvent(@ProbeParam("listenerName") String listenerName) {}
+ public void incrementCountRefusalsEvent(
+ @ProbeParam("listenerName") String listenerName) {}
@Probe(name="incrementCountTimeoutsEvent")
- public void incrementCountTimeoutsEvent(@ProbeParam("listenerName") String listenerName) {}
+ public void incrementCountTimeoutsEvent(
+ @ProbeParam("listenerName") String listenerName) {}
}
Index: src/main/java/com/sun/enterprise/v3/services/impl/monitor/probes/ThreadPoolProbeProvider.java
--- src/main/java/com/sun/enterprise/v3/services/impl/monitor/probes/ThreadPoolProbeProvider.java Base (BASE)
+++ src/main/java/com/sun/enterprise/v3/services/impl/monitor/probes/ThreadPoolProbeProvider.java Locally Modified (Based On LOCAL)
@@ -46,17 +46,33 @@
@ProbeProvider (moduleProviderName="glassfish", moduleName="kernel", probeProviderName="thread-pool")
public class ThreadPoolProbeProvider {
+ @Probe(name="setMaxThreadsEvent")
+ public void setMaxThreadsEvent(
+ @ProbeParam("threadPoolName") String threadPoolName,
+ @ProbeParam("maxNumberOfThreads") int maxNumberOfThreads) {}
+
+
+ @Probe(name="setCoreThreadsEvent")
+ public void setCoreThreadsEvent(
+ @ProbeParam("threadPoolName") String threadPoolName,
+ @ProbeParam("coreNumberOfThreads") int coreNumberOfThreads) {}
+
/**
* Emits notification that new thread was created and added to the
* thread pool.
*/
- @Probe(name="newThreadsAllocatedEvent")
- public void newThreadsAllocatedEvent(
+ @Probe(name="threadAllocatedEvent")
+ public void threadAllocatedEvent(
@ProbeParam("threadPoolName") String threadPoolName,
- @ProbeParam("increment") int increment,
- @ProbeParam("startThread") boolean startThread) {}
+ @ProbeParam("threadId") String threadId) {}
+ @Probe(name="threadReleasedEvent")
+ public void threadReleasedEvent(
+ @ProbeParam("threadPoolName") String threadPoolName,
+ @ProbeParam("threadId") String threadId) {}
+
+
@Probe(name="maxNumberOfThreadsReachedEvent")
public void maxNumberOfThreadsReachedEvent(
@ProbeParam("threadPoolName") String threadPoolName,
Index: src/main/java/com/sun/enterprise/v3/services/impl/monitor/stats/ConnectionQueueStatsProvider.java
--- src/main/java/com/sun/enterprise/v3/services/impl/monitor/stats/ConnectionQueueStatsProvider.java Locally New
+++ src/main/java/com/sun/enterprise/v3/services/impl/monitor/stats/ConnectionQueueStatsProvider.java Locally New
@@ -0,0 +1,301 @@
+/*
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
+ *
+ * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
+ *
+ * The contents of this file are subject to the terms of either the GNU
+ * General Public License Version 2 only ("GPL") or the Common Development
+ * and Distribution License("CDDL") (collectively, the "License"). You
+ * may not use this file except in compliance with the License. You can obtain
+ * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
+ * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
+ * language governing permissions and limitations under the License.
+ *
+ * When distributing the software, include this License Header Notice in each
+ * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
+ * Sun designates this particular file as subject to the "Classpath" exception
+ * as provided by Sun in the GPL Version 2 section of the License file that
+ * accompanied this code. If applicable, add the following below the License
+ * Header, with the fields enclosed by brackets [] replaced by your own
+ * identifying information: "Portions Copyrighted [year]
+ * [name of copyright owner]"
+ *
+ * Contributor(s):
+ *
+ * If you wish your version of this file to be governed by only the CDDL or
+ * only the GPL Version 2, indicate your decision by adding "[Contributor]
+ * elects to include this software in this distribution under the [CDDL or GPL
+ * Version 2] license." If you don't indicate a single choice of license, a
+ * recipient has the option to distribute your version of this file under
+ * either the CDDL, the GPL Version 2 or to extend the choice of license to
+ * its licensees as provided above. However, if you add GPL Version 2 code
+ * and therefore, elected the GPL Version 2 license, then the option applies
+ * only if the new code is made subject to such option by the copyright
+ * holder.
+ */
+package com.sun.enterprise.v3.services.impl.monitor.stats;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.atomic.AtomicInteger;
+import org.glassfish.external.probe.provider.annotations.ProbeListener;
+import org.glassfish.external.probe.provider.annotations.ProbeParam;
+import org.glassfish.external.statistics.CountStatistic;
+import org.glassfish.external.statistics.impl.CountStatisticImpl;
+import org.glassfish.gmbal.AMXMetadata;
+import org.glassfish.gmbal.Description;
+import org.glassfish.gmbal.ManagedAttribute;
+import org.glassfish.gmbal.ManagedObject;
+
+/**
+ * Connection Queue statistics
+ *
+ * @author Alexey Stashok
+ */
+@AMXMetadata(type = "connection-queue-mon", group = "monitoring")
+@ManagedObject
+@Description("Connection Queue Statistics")
+public class ConnectionQueueStatsProvider {
+ private static final long MINUTE = 60 * 1000;
+
+ private final String name;
+
+ private final CountStatisticImpl countTotalConnections = new CountStatisticImpl("CountTotalConnections", "count", "Total number of connections that have been accepted");
+ private final Map openConnectionsCount = new ConcurrentHashMap();
+
+ private final CountStatisticImpl countOverflows = new CountStatisticImpl("CountOverflows", "count", "Number of times the queue has been too full to accommodate a connection");
+
+ private final AtomicInteger countQueuedAtomic = new AtomicInteger();
+ private final CountStatisticImpl countQueued = new CountStatisticImpl("CountQueued", "count", "Number of connections currently in the queue");
+
+ private final CountStatisticImpl countTotalQueued = new CountStatisticImpl("CountTotalQueued", "count", "Total number of connections that have been queued");
+
+ private final CountStatisticImpl maxQueued = new CountStatisticImpl("MaxQueued", "count", "Maximum size of the connection queue");
+
+ private final AtomicInteger peakQueuedAtomic = new AtomicInteger();
+ private final CountStatisticImpl peakQueued = new CountStatisticImpl("PeakQueued", "count", "Largest number of connections that were in the queue simultaneously");
+
+ private final CountStatisticImpl ticksTotalQueued = new CountStatisticImpl("TicksTotalQueued", "count", "(Unsupported) Total number of ticks that connections have spent in the queue");
+
+ private final int[] averageStatsPerMinute = new int[15];
+ private long averageLastShift;
+ private int averageMinuteCounter;
+
+ public ConnectionQueueStatsProvider(String name) {
+ this.name = name;
+ }
+
+ @ManagedAttribute(id = "counttotalconnections")
+ @Description("Total number of connections that have been accepted")
+ public CountStatistic getTotalConnectionsCount() {
+ return countTotalConnections;
+ }
+
+ @ManagedAttribute(id = "countopenconnections")
+ @Description("The number of open/active connections")
+ public CountStatistic getOpenConnectionsCount() {
+ final CountStatisticImpl stats =
+ new CountStatisticImpl("CountOpenConnections",
+ "count", "The number of open/active connections");
+ stats.setCount(openConnectionsCount.size());
+ return stats;
+ }
+
+ @ManagedAttribute(id = "countoverflows")
+ @Description("Number of times the queue has been too full to accommodate a connection")
+ public CountStatistic getCountOverflows() {
+ return countOverflows;
+ }
+
+ @ManagedAttribute(id = "countqueued")
+ @Description("Number of connections currently in the queue")
+ public CountStatistic getCountQueued() {
+ return countQueued;
+ }
+
+ @ManagedAttribute(id = "countqueued1minuteaverage")
+ @Description("Average number of connections queued in the last 1 minute")
+ public CountStatistic getCountQueued1MinuteAverage() {
+ final CountStatisticImpl stats = new CountStatisticImpl(
+ "CountQueued1MinuteAverage", "count",
+ "Average number of connections queued in the last 1 minute");
+ stats.setCount(getAverageBy(1));
+ return stats;
+ }
+
+ @ManagedAttribute(id = "countqueued5minutesaverage")
+ @Description("Average number of connections queued in the last 5 minutes")
+ public CountStatistic getCountQueued5MinutesAverage() {
+ final CountStatisticImpl stats = new CountStatisticImpl(
+ "CountQueued5MinutesAverage", "count",
+ "Average number of connections queued in the last 5 minutes");
+ stats.setCount(getAverageBy(5));
+ return stats;
+ }
+
+ @ManagedAttribute(id = "countqueued15minutesaverage")
+ @Description("Average number of connections queued in the last 15 minutes")
+ public CountStatistic getCountQueued15MinutesAverage() {
+ final CountStatisticImpl stats = new CountStatisticImpl(
+ "CountQueued15MinutesAverage", "count",
+ "Average number of connections queued in the last 15 minutes");
+ stats.setCount(getAverageBy(15));
+ return stats;
+ }
+
+ @ManagedAttribute(id = "counttotalqueued")
+ @Description("Total number of connections that have been queued")
+ public CountStatistic getCountTotalQueued() {
+ return countTotalQueued;
+ }
+
+ @ManagedAttribute(id = "maxqueued")
+ @Description("Maximum size of the connection queue")
+ public CountStatistic getMaxQueued() {
+ return maxQueued;
+ }
+
+ @ManagedAttribute(id = "peakqueued")
+ @Description("Largest number of connections that were in the queue simultaneously")
+ public CountStatistic getPeakQueued() {
+ return peakQueued;
+ }
+
+ @ManagedAttribute(id = "tickstotalqueued")
+ @Description("(Unsupported) Total number of ticks that connections have spent in the queue")
+ public CountStatistic getTicksTotalQueued() {
+ return ticksTotalQueued;
+ }
+
+ // ---------------- Connection related listeners -----------
+ @ProbeListener("glassfish:kernel:connection-queue:connectionAcceptedEvent")
+ public void connectionAcceptedEvent(
+ @ProbeParam("listenerName") String listenerName,
+ @ProbeParam("connection") int connectionId) {
+
+ if (name.equals(listenerName)) {
+ countTotalConnections.increment();
+ openConnectionsCount.put(connectionId, System.currentTimeMillis());
+ }
+ }
+
+// We're not interested in client connections, created via Grizzly
+// @ProbeListener("glassfish:kernel:connection-queue:connectionConnectedEvent")
+// public void connectionConnectedEvent(
+// @ProbeParam("listenerName") String listenerName,
+// @ProbeParam("connection") int connectionId) {
+// }
+ @ProbeListener("glassfish:kernel:connection-queue:connectionClosedEvent")
+ public void connectionClosedEvent(
+ @ProbeParam("listenerName") String listenerName,
+ @ProbeParam("connection") int connectionId) {
+ if (name.equals(listenerName)) {
+ openConnectionsCount.remove(connectionId);
+ }
+ }
+
+ // -----------------------------------------------------------------------
+
+ @ProbeListener("glassfish:kernel:connection-queue:setMaxTaskQueueSizeEvent")
+ public void setMaxTaskQueueSizeEvent(
+ @ProbeParam("listenerName") String listenerName,
+ @ProbeParam("size") int size) {
+ if (name.equals(listenerName)) {
+ maxQueued.setCount(size);
+ }
+ }
+
+ @ProbeListener("glassfish:kernel:connection-queue:onTaskQueuedEvent")
+ public void onTaskQueuedEvent(
+ @ProbeParam("listenerName") String listenerName,
+ @ProbeParam("task") Runnable task) {
+ if (name.equals(listenerName)) {
+ int queued = countQueuedAtomic.incrementAndGet();
+ countQueued.setCount(queued);
+
+ do {
+ final int peakQueue = peakQueuedAtomic.get();
+ if (queued <= peakQueue) break;
+
+ if (peakQueuedAtomic.compareAndSet(peakQueue, queued)) {
+ peakQueued.setCount(queued);
+ break;
+ }
+ } while (true);
+
+ countTotalQueued.increment();
+
+ incAverageMinute();
+ }
+ }
+
+ @ProbeListener("glassfish:kernel:connection-queue:onTaskDequeuedEvent")
+ public void onTaskDequeuedEvent(
+ @ProbeParam("listenerName") String listenerName,
+ @ProbeParam("task") Runnable task) {
+ if (name.equals(listenerName)) {
+ countQueued.setCount(countQueuedAtomic.decrementAndGet());
+ }
+ }
+
+ @ProbeListener("glassfish:kernel:connection-queue:onTaskQueueOverflowEvent")
+ public void onTaskQueueOverflowEvent(
+ @ProbeParam("listenerName") String listenerName) {
+ if (name.equals(listenerName)) {
+ countOverflows.increment();
+ }
+ }
+
+ private void incAverageMinute() {
+ synchronized(averageStatsPerMinute) {
+ final long currentTime = System.currentTimeMillis();
+ if (currentTime - averageLastShift >= MINUTE) {
+ shiftAverage(currentTime);
+ }
+
+ averageMinuteCounter++;
+ }
+ }
+
+ private int getAverageBy(int mins) {
+ synchronized(averageStatsPerMinute) {
+ final long currentTime = System.currentTimeMillis();
+ if (currentTime - averageLastShift >= MINUTE) {
+ shiftAverage(currentTime);
+ }
+
+ int result = averageMinuteCounter;
+ final int statsToCount = Math.min(mins - 1, averageStatsPerMinute.length);
+ for(int i = 0; i < statsToCount; i++) {
+ result += averageStatsPerMinute[i];
+ }
+
+ return result;
+ }
+ }
+
+ private void shiftAverage(long currentTime) {
+ final int shift = (int) ((currentTime - averageLastShift) / MINUTE);
+ if (shift == 0) {
+ return;
+ }
+
+ final int statsSize = averageStatsPerMinute.length;
+ for(int i = statsSize - 1; i >= 0; i--) {
+ final int newIndex = shift + i;
+ if (newIndex < statsSize) {
+ averageStatsPerMinute[newIndex] = averageStatsPerMinute[i];
+ }
+
+ averageStatsPerMinute[i] = 0;
+ }
+
+ if (shift <= statsSize) {
+ averageStatsPerMinute[shift - 1] = averageMinuteCounter;
+ }
+
+ averageMinuteCounter = 0;
+ averageLastShift += (shift * MINUTE);
+ }
+
+}
Index: src/main/java/com/sun/enterprise/v3/services/impl/monitor/stats/ConnectionsStatsProvider.java
--- src/main/java/com/sun/enterprise/v3/services/impl/monitor/stats/ConnectionsStatsProvider.java Base (BASE)
+++ src/main/java/com/sun/enterprise/v3/services/impl/monitor/stats/ConnectionsStatsProvider.java Locally Deleted
@@ -1,106 +0,0 @@
-/*
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
- *
- * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
- *
- * The contents of this file are subject to the terms of either the GNU
- * General Public License Version 2 only ("GPL") or the Common Development
- * and Distribution License("CDDL") (collectively, the "License"). You
- * may not use this file except in compliance with the License. You can obtain
- * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
- * or glassfish/bootstrap/legal/LICENSE.txt. See the License for the specific
- * language governing permissions and limitations under the License.
- *
- * When distributing the software, include this License Header Notice in each
- * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
- * Sun designates this particular file as subject to the "Classpath" exception
- * as provided by Sun in the GPL Version 2 section of the License file that
- * accompanied this code. If applicable, add the following below the License
- * Header, with the fields enclosed by brackets [] replaced by your own
- * identifying information: "Portions Copyrighted [year]
- * [name of copyright owner]"
- *
- * Contributor(s):
- *
- * If you wish your version of this file to be governed by only the CDDL or
- * only the GPL Version 2, indicate your decision by adding "[Contributor]
- * elects to include this software in this distribution under the [CDDL or GPL
- * Version 2] license." If you don't indicate a single choice of license, a
- * recipient has the option to distribute your version of this file under
- * either the CDDL, the GPL Version 2 or to extend the choice of license to
- * its licensees as provided above. However, if you add GPL Version 2 code
- * and therefore, elected the GPL Version 2 license, then the option applies
- * only if the new code is made subject to such option by the copyright
- * holder.
- */
-package com.sun.enterprise.v3.services.impl.monitor.stats;
-
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import org.glassfish.external.probe.provider.annotations.ProbeListener;
-import org.glassfish.external.probe.provider.annotations.ProbeParam;
-import org.glassfish.external.statistics.CountStatistic;
-import org.glassfish.external.statistics.impl.CountStatisticImpl;
-import org.glassfish.gmbal.AMXMetadata;
-import org.glassfish.gmbal.Description;
-import org.glassfish.gmbal.ManagedAttribute;
-import org.glassfish.gmbal.ManagedObject;
-
-/**
- * Network Connections Statistics
- *
- * @author Alexey Stashok
- */
-@AMXMetadata(type="connection-manager-mon", group="monitoring")
-@ManagedObject
-@Description("Network Connections Statistics")
-public class ConnectionsStatsProvider {
-
- private final String name;
- private final CountStatisticImpl totalConnectionsCount = new CountStatisticImpl("TotalConnectionsCount", "count", "The total number of connections accepted");
- private final Map openConnectionsCount = new ConcurrentHashMap();
-
- public ConnectionsStatsProvider(String name) {
- this.name = name;
- }
-
- @ManagedAttribute(id = "totalconnections")
- @Description("The total number of connections accepted")
- public CountStatistic getTotalConnectionsCount() {
- return totalConnectionsCount;
- }
-
- @ManagedAttribute(id = "openconnections")
- @Description("The number of open connections")
- public CountStatistic getOpenConnectionsCount() {
- CountStatisticImpl stats = new CountStatisticImpl("OpenConnectionsCount", "count", "The number of open connections");
- stats.setCount(openConnectionsCount.size());
- return stats;
- }
-
- @ProbeListener("glassfish:kernel:connections:connectionAcceptedEvent")
- public void connectionAcceptedEvent(
- @ProbeParam("listenerName") String listenerName,
- @ProbeParam("connection") int connectionId) {
-
- if (name.equals(listenerName)) {
- totalConnectionsCount.increment();
- openConnectionsCount.put(connectionId, System.currentTimeMillis());
- }
- }
-
-// We're not interested in client connections, created via Grizzly
-// @ProbeListener("glassfish:kernel:connections:connectionConnectedEvent")
-// public void connectionConnectedEvent(
-// @ProbeParam("listenerName") String listenerName,
-// @ProbeParam("connection") int connectionId) {
-// }
- @ProbeListener("glassfish:kernel:connections:connectionClosedEvent")
- public void connectionClosedEvent(
- @ProbeParam("listenerName") String listenerName,
- @ProbeParam("connection") int connectionId) {
- if (name.equals(listenerName)) {
- openConnectionsCount.remove(connectionId);
- }
- }
-}
Index: src/main/java/com/sun/enterprise/v3/services/impl/monitor/stats/KeepAliveStatsProvider.java
--- src/main/java/com/sun/enterprise/v3/services/impl/monitor/stats/KeepAliveStatsProvider.java Base (BASE)
+++ src/main/java/com/sun/enterprise/v3/services/impl/monitor/stats/KeepAliveStatsProvider.java Locally Modified (Based On LOCAL)
@@ -55,47 +55,78 @@
public class KeepAliveStatsProvider {
private final String name;
- private final CountStatisticImpl keepAliveConnectionsCount = new CountStatisticImpl("KeepAliveConnectionsCount", "count", "Number of connections in keep-alive mode");
- private final CountStatisticImpl flushesCount = new CountStatisticImpl("FlushesCount", "count", "Number of keep-alive connections that were closed");
- private final CountStatisticImpl hitsCount = new CountStatisticImpl("HitsCount", "count", "Number of requests received by connections in keep-alive mode");
- private final CountStatisticImpl refusalsCount = new CountStatisticImpl("RefusalsCount", "count", "Number of keep-alive connections that were rejected");
- private final CountStatisticImpl timeoutsCount = new CountStatisticImpl("TimeoutsCount", "count", "Number of keep-alive connections that timed out");
+ private final CountStatisticImpl maxRequestsCount = new CountStatisticImpl("MaxRequests", "count", "Maximum number of requests allowed on a single keep-alive connection");
+ private final CountStatisticImpl timeoutInSeconds = new CountStatisticImpl("SecondsTimeouts", "seconds", "Keep-alive timeout value in seconds");
+ private final CountStatisticImpl keepAliveConnectionsCount = new CountStatisticImpl("CountConnections", "count", "Number of connections in keep-alive mode");
+ private final CountStatisticImpl flushesCount = new CountStatisticImpl("CountFlushes", "count", "Number of keep-alive connections that were closed");
+ private final CountStatisticImpl hitsCount = new CountStatisticImpl("CountHits", "count", "Number of requests received by connections in keep-alive mode");
+ private final CountStatisticImpl refusalsCount = new CountStatisticImpl("CountRefusals", "count", "Number of keep-alive connections that were rejected");
+ private final CountStatisticImpl timeoutsCount = new CountStatisticImpl("CountTimeouts", "count", "Number of keep-alive connections that timed out");
public KeepAliveStatsProvider(String name) {
this.name = name;
}
- @ManagedAttribute(id = "keepaliveconnections")
+ @ManagedAttribute(id = "maxrequests")
+ @Description("Maximum number of requests allowed on a single keep-alive connection")
+ public CountStatistic getMaxKeepAliveRequestsCount() {
+ return maxRequestsCount;
+ }
+
+ @ManagedAttribute(id = "secondstimeouts")
+ @Description("Keep-alive timeout value in seconds")
+ public CountStatistic getKeepAliveTimeoutInSeconds() {
+ return timeoutInSeconds;
+ }
+
+ @ManagedAttribute(id = "countconnections")
@Description("Number of connections in keep-alive mode")
public CountStatistic getKeepAliveConnectionsCount() {
return keepAliveConnectionsCount;
}
- @ManagedAttribute(id = "flushes")
+ @ManagedAttribute(id = "countflushes")
@Description("Number of keep-alive connections that were closed")
public CountStatistic getFlushesCount() {
return flushesCount;
}
- @ManagedAttribute(id = "hits")
+ @ManagedAttribute(id = "counthits")
@Description("Number of requests received by connections in keep-alive mode")
public CountStatistic getHitsCount() {
return hitsCount;
}
- @ManagedAttribute(id = "refusals")
+ @ManagedAttribute(id = "countrefusals")
@Description("Number of keep-alive connections that were rejected")
public CountStatistic getRefusalsCount() {
return refusalsCount;
}
- @ManagedAttribute(id = "timeouts")
+ @ManagedAttribute(id = "counttimeouts")
@Description("Number of keep-alive connections that timed out")
public CountStatistic getTimeoutsCount() {
return timeoutsCount;
}
+ @ProbeListener("glassfish:kernel:connections-keep-alive:setMaxCountRequestsEvent")
+ public void setMaxCountRequestsEvent(
+ @ProbeParam("listenerName") String listenerName,
+ @ProbeParam("maxRequests") int max) {
+ if (name.equals(listenerName)) {
+ maxRequestsCount.setCount(max);
+ }
+ }
+ @ProbeListener("glassfish:kernel:connections-keep-alive:setTimeoutInSecondsEvent")
+ public void setTimeoutInSecondsEvent(
+ @ProbeParam("listenerName") String listenerName,
+ @ProbeParam("timeoutInSeconds") int timeoutInSeconds) {
+ if (name.equals(listenerName)) {
+ this.timeoutInSeconds.setCount(timeoutInSeconds);
+ }
+ }
+
@ProbeListener("glassfish:kernel:connections-keep-alive:incrementCountConnectionsEvent")
public void incrementCountConnectionsEvent(@ProbeParam("listenerName") String listenerName) {
if (name.equals(listenerName)) {
Index: src/main/java/com/sun/enterprise/v3/services/impl/monitor/stats/ThreadPoolStatsProvider.java
--- src/main/java/com/sun/enterprise/v3/services/impl/monitor/stats/ThreadPoolStatsProvider.java Base (BASE)
+++ src/main/java/com/sun/enterprise/v3/services/impl/monitor/stats/ThreadPoolStatsProvider.java Locally Modified (Based On LOCAL)
@@ -33,7 +33,6 @@
* only if the new code is made subject to such option by the copyright
* holder.
*/
-
package com.sun.enterprise.v3.services.impl.monitor.stats;
import org.glassfish.external.probe.provider.annotations.ProbeListener;
@@ -50,56 +49,100 @@
*
* @author Alexey Stashok
*/
-@AMXMetadata(type="thread-pool-mon", group="monitoring")
+@AMXMetadata(type = "thread-pool-mon", group = "monitoring")
@ManagedObject
@Description("Thread Pool Statistics")
public class ThreadPoolStatsProvider {
+
private final String name;
+ private final CountStatisticImpl maxThreadsCount = new CountStatisticImpl("MaxThreads", "count", "Maximum number of threads allowed in the thread pool");
+ private final CountStatisticImpl coreThreadsCount = new CountStatisticImpl("CoreThreads", "count", "Core number of threads in the thread pool");
- private final CountStatisticImpl totalExecutedTasksCount = new CountStatisticImpl("TotalExecutedTasksCount", "count", "Total number of tasks, which were executed by the thread-pool");
- private final CountStatisticImpl currentThreadPoolSize = new CountStatisticImpl("CurrentThreadPoolSize", "count", "Current number of threads running by the thread-pool");
- private final CountStatisticImpl numberOfActiveThreads = new CountStatisticImpl("NumberOfActiveThreads", "count", "Number of threads, which are currently executing tasks");
+ private final CountStatisticImpl totalExecutedTasksCount = new CountStatisticImpl("TotalExecutedTasksCount", "count", "Provides the total number of tasks, which were executed by the thread pool");
+ private final CountStatisticImpl currentThreadCount = new CountStatisticImpl("CurrentThreadCount", "count", "Provides the number of request processing threads currently in the listener thread pool");
+ private final CountStatisticImpl currentThreadsBusy = new CountStatisticImpl("CurrentThreadsBusy", "count", "Provides the number of request processing threads currently in use in the listener thread pool serving requests");
public ThreadPoolStatsProvider(String name) {
this.name = name;
}
- @ManagedAttribute(id="totalexecutedtasks")
- @Description("Total number of tasks, which were executed by the thread-pool")
- public CountStatistic getTotalExecutedTasksCount(){
+ @ManagedAttribute(id = "maxthreads")
+ @Description("Maximum number of threads allowed in the thread pool")
+ public CountStatistic getMaxThreadsCount() {
+ return maxThreadsCount;
+ }
+
+ @ManagedAttribute(id = "corethreads")
+ @Description("Core number of threads in the thread pool")
+ public CountStatistic getCoreThreadsCount() {
+ return coreThreadsCount;
+ }
+
+ @ManagedAttribute(id = "totalexecutedtasks")
+ @Description("Provides the total number of tasks, which were executed by the thread pool")
+ public CountStatistic getTotalExecutedTasksCount() {
return totalExecutedTasksCount;
}
- @ManagedAttribute(id="currentthreadpoolsize")
- @Description("Current number of threads running by the thread-pool")
- public CountStatistic getCurrentThreadPoolSize(){
- return currentThreadPoolSize;
+ @ManagedAttribute(id = "currentthreadcount")
+ @Description("Provides the number of request processing threads currently in the listener thread pool")
+ public CountStatistic getCurrentThreadCount() {
+ return currentThreadCount;
}
- @ManagedAttribute(id="numberofactivethreads")
- @Description("Number of threads, which are currently executing tasks")
- public CountStatistic getNumberOfActiveThreads(){
- return numberOfActiveThreads;
+ @ManagedAttribute(id = "currentthreadsbusy")
+ @Description("Provides the number of request processing threads currently in use in the listener thread pool serving requests.")
+ public CountStatistic getCurrentThreadsBusy() {
+ return currentThreadsBusy;
}
- @ProbeListener("glassfish:kernel:thread-pool:newThreadsAllocatedEvent")
- public void newThreadsAllocatedEvent(
+ @ProbeListener("glassfish:kernel:thread-pool:setMaxThreadsEvent")
+ public void setMaxThreadsEvent(
@ProbeParam("threadPoolName") String threadPoolName,
- @ProbeParam("increment") int increment,
- @ProbeParam("startThread") boolean startThread) {
+ @ProbeParam("maxNumberOfThreads") int maxNumberOfThreads) {
if (name.equals(threadPoolName)) {
- currentThreadPoolSize.increment();
+ maxThreadsCount.setCount(maxNumberOfThreads);
}
}
+ @ProbeListener("glassfish:kernel:thread-pool:setCoreThreadsEvent")
+ public void setCoreThreadsEvent(
+ @ProbeParam("threadPoolName") String threadPoolName,
+ @ProbeParam("coreNumberOfThreads") int coreNumberOfThreads) {
+
+ if (name.equals(threadPoolName)) {
+ coreThreadsCount.setCount(coreNumberOfThreads);
+ }
+ }
+
+ @ProbeListener("glassfish:kernel:thread-pool:threadAllocatedEvent")
+ public void threadAllocatedEvent(
+ @ProbeParam("threadPoolName") String threadPoolName,
+ @ProbeParam("threadId") String threadId) {
+
+ if (name.equals(threadPoolName)) {
+ currentThreadCount.increment();
+ }
+ }
+
+ @ProbeListener("glassfish:kernel:thread-pool:threadReleasedEvent")
+ public void threadReleasedEvent(
+ @ProbeParam("threadPoolName") String threadPoolName,
+ @ProbeParam("threadId") String threadId) {
+
+ if (name.equals(threadPoolName)) {
+ currentThreadCount.decrement();
+ }
+ }
+
@ProbeListener("glassfish:kernel:thread-pool:threadDispatchedFromPoolEvent")
public void threadDispatchedFromPoolEvent(
@ProbeParam("threadPoolName") String threadPoolName,
@ProbeParam("threadId") String threadId) {
if (name.equals(threadPoolName)) {
- numberOfActiveThreads.increment();
+ currentThreadsBusy.increment();
}
}
@@ -110,7 +153,7 @@
if (name.equals(threadPoolName)) {
totalExecutedTasksCount.increment();
- numberOfActiveThreads.decrement();
+ currentThreadsBusy.decrement();
}
}
}