Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse McConnell2012-08-15 19:17:04 +0000
committerJesse McConnell2012-08-15 19:17:04 +0000
commit129fb06f1f470dc91f908dd53cbf0fc706033f0e (patch)
treee5750921bc0ad568722243a02f3574e654ea73ec /jetty-monitor
parent2d9c4e823c4e2e93fb0c801d76ec7ed147361796 (diff)
downloadorg.eclipse.jetty.project-129fb06f1f470dc91f908dd53cbf0fc706033f0e.tar.gz
org.eclipse.jetty.project-129fb06f1f470dc91f908dd53cbf0fc706033f0e.tar.xz
org.eclipse.jetty.project-129fb06f1f470dc91f908dd53cbf0fc706033f0e.zip
migrate jetty-nosql and jetty-monitor to jmx annotations
Diffstat (limited to 'jetty-monitor')
-rw-r--r--jetty-monitor/src/main/java/org/eclipse/jetty/monitor/ThreadMonitor.java9
-rw-r--r--jetty-monitor/src/main/java/org/eclipse/jetty/monitor/integration/JavaMonitorTools.java13
-rw-r--r--jetty-monitor/src/main/resources/org/eclipse/jetty/monitor/integration/jmx/JavaMonitorTools-mbean.properties12
-rw-r--r--jetty-monitor/src/main/resources/org/eclipse/jetty/monitor/jmx/ThreadMonitor-mbean.properties1
4 files changed, 22 insertions, 13 deletions
diff --git a/jetty-monitor/src/main/java/org/eclipse/jetty/monitor/ThreadMonitor.java b/jetty-monitor/src/main/java/org/eclipse/jetty/monitor/ThreadMonitor.java
index 70c84fcf43..488abeff63 100644
--- a/jetty-monitor/src/main/java/org/eclipse/jetty/monitor/ThreadMonitor.java
+++ b/jetty-monitor/src/main/java/org/eclipse/jetty/monitor/ThreadMonitor.java
@@ -25,6 +25,8 @@ import java.util.Map;
import org.eclipse.jetty.monitor.thread.ThreadMonitorException;
import org.eclipse.jetty.monitor.thread.ThreadMonitorInfo;
+import org.eclipse.jetty.util.annotation.ManagedAttribute;
+import org.eclipse.jetty.util.annotation.ManagedObject;
import org.eclipse.jetty.util.component.AbstractLifeCycle;
import org.eclipse.jetty.util.component.Dumpable;
import org.eclipse.jetty.util.log.Log;
@@ -33,6 +35,7 @@ import org.eclipse.jetty.util.log.Logger;
/* ------------------------------------------------------------ */
+@ManagedObject("detect and report spinning and deadlocked threads")
public class ThreadMonitor extends AbstractLifeCycle implements Runnable
{
private static final Logger LOG = Log.getLogger(ThreadMonitor.class);
@@ -132,6 +135,7 @@ public class ThreadMonitor extends AbstractLifeCycle implements Runnable
*
* @return the scan interval
*/
+ @ManagedAttribute("scan interval")
public int getScanInterval()
{
return _scanInterval;
@@ -154,6 +158,7 @@ public class ThreadMonitor extends AbstractLifeCycle implements Runnable
*
* @return the log interval
*/
+ @ManagedAttribute("log interval")
public int getLogInterval()
{
return _logInterval;
@@ -176,6 +181,7 @@ public class ThreadMonitor extends AbstractLifeCycle implements Runnable
*
* @return the busy threshold
*/
+ @ManagedAttribute("busy threshold")
public int getBusyThreshold()
{
return _busyThreshold;
@@ -198,6 +204,7 @@ public class ThreadMonitor extends AbstractLifeCycle implements Runnable
*
* @return the log threshold
*/
+ @ManagedAttribute("log threshold")
public int getLogThreshold()
{
return _logThreshold;
@@ -220,6 +227,7 @@ public class ThreadMonitor extends AbstractLifeCycle implements Runnable
*
* @return the stack depth
*/
+ @ManagedAttribute("stack depth")
public int getStackDepth()
{
return _stackDepth;
@@ -242,6 +250,7 @@ public class ThreadMonitor extends AbstractLifeCycle implements Runnable
*
* @param trailLength the new trail length
*/
+ @ManagedAttribute("trail length")
public void setTrailLength(int trailLength)
{
_trailLength = trailLength;
diff --git a/jetty-monitor/src/main/java/org/eclipse/jetty/monitor/integration/JavaMonitorTools.java b/jetty-monitor/src/main/java/org/eclipse/jetty/monitor/integration/JavaMonitorTools.java
index a8d088622c..278e62209c 100644
--- a/jetty-monitor/src/main/java/org/eclipse/jetty/monitor/integration/JavaMonitorTools.java
+++ b/jetty-monitor/src/main/java/org/eclipse/jetty/monitor/integration/JavaMonitorTools.java
@@ -22,6 +22,9 @@ import java.security.Security;
import java.util.HashMap;
import java.util.Map;
+import org.eclipse.jetty.util.annotation.ManagedAttribute;
+import org.eclipse.jetty.util.annotation.ManagedObject;
+
/* ------------------------------------------------------------ */
/**
* Derived from the JMX bean classes created by Kees Jan Koster for the java-monitor
@@ -29,6 +32,7 @@ import java.util.Map;
*
* @author kjkoster <kjkoster@gmail.com>
*/
+@ManagedObject("retrieves information required by java-monitor")
public class JavaMonitorTools
{
private static final ThreadMXBean threadMXBean = ManagementFactory.getThreadMXBean();
@@ -74,6 +78,7 @@ public class JavaMonitorTools
return threads;
}
+ @ManagedAttribute("detailed report of deadlocked threads")
public String getDeadlockStacktraces()
{
try
@@ -136,6 +141,7 @@ public class JavaMonitorTools
return states.get(Thread.State.BLOCKED);
}
+ @ManagedAttribute("number of new threads")
public int getThreadsNew()
{
sampleThreads();
@@ -143,6 +149,7 @@ public class JavaMonitorTools
return states.get(Thread.State.NEW);
}
+ @ManagedAttribute("number of terminated threads")
public int getThreadsTerminated()
{
sampleThreads();
@@ -150,6 +157,7 @@ public class JavaMonitorTools
return states.get(Thread.State.TERMINATED);
}
+ @ManagedAttribute("number of sleeping and waiting threads")
public int getThreadsTimedWaiting()
{
sampleThreads();
@@ -157,6 +165,7 @@ public class JavaMonitorTools
return states.get(Thread.State.TIMED_WAITING);
}
+ @ManagedAttribute("number of waiting threads")
public int getThreadsWaiting()
{
sampleThreads();
@@ -198,6 +207,7 @@ public class JavaMonitorTools
private static final String POLICY = "sun.net.InetAddressCachePolicy";
+ @ManagedAttribute("amount of time successful dns queries are cached for")
public int getCacheSeconds() throws ClassNotFoundException,
IllegalAccessException, InvocationTargetException,
NoSuchMethodException {
@@ -209,6 +219,7 @@ public class JavaMonitorTools
return seconds.intValue();
}
+ @ManagedAttribute("Amount of time failed DNS queries are cached for")
public int getCacheNegativeSeconds() throws ClassNotFoundException,
IllegalAccessException, InvocationTargetException,
NoSuchMethodException {
@@ -236,6 +247,7 @@ public class JavaMonitorTools
private static final String SYSTEM_NEGATIVE_TTL = "sun.net.inetaddr.negative.ttl";
+ @ManagedAttribute("Cache policy for successful DNS lookups was changed from the hard-coded default")
public String getCacheTweakedFrom() {
if (Security.getProperty(SECURITY_TTL) != null) {
if (System.getProperty(SYSTEM_TTL) != null) {
@@ -252,6 +264,7 @@ public class JavaMonitorTools
return DEFAULT;
}
+ @ManagedAttribute("Cache policy for failed DNS lookups was changed from the hard-coded default")
public String getCacheNegativeTweakedFrom() {
if (Security.getProperty(SECURITY_NEGATIVE_TTL) != null) {
if (System.getProperty(SYSTEM_NEGATIVE_TTL) != null) {
diff --git a/jetty-monitor/src/main/resources/org/eclipse/jetty/monitor/integration/jmx/JavaMonitorTools-mbean.properties b/jetty-monitor/src/main/resources/org/eclipse/jetty/monitor/integration/jmx/JavaMonitorTools-mbean.properties
deleted file mode 100644
index 4722fdaa79..0000000000
--- a/jetty-monitor/src/main/resources/org/eclipse/jetty/monitor/integration/jmx/JavaMonitorTools-mbean.properties
+++ /dev/null
@@ -1,12 +0,0 @@
-JavaMonitorTools: Retrieves additional information required by java-monitor
-DeadlockStacktraces: RO:Detailed report on the deadlocked threads.
-ThreadsNew: RO:Number of new threads
-ThreadsRunnable: RO:Number of runnable threads
-ThreadsBlocked: RO:Number of blocked threads
-ThreadsWaiting: RO:Number of waiting threads
-ThreadsTimedWaiting: RO:Number of sleeping and waiting threads
-ThreadsTerminated: RO:Number of terminated threads
-CacheSeconds: RO:Amount of time successful DNS queries are cached for
-CacheTweakedFrom: RO:Cache policy for successful DNS lookups was changed from the hard-coded default
-CacheNegativeSeconds: RO:Amount of time failed DNS queries are cached for
-CacheNegativeTweakedFrom: RO:Cache policy for failed DNS lookups was changed from the hard-coded default
diff --git a/jetty-monitor/src/main/resources/org/eclipse/jetty/monitor/jmx/ThreadMonitor-mbean.properties b/jetty-monitor/src/main/resources/org/eclipse/jetty/monitor/jmx/ThreadMonitor-mbean.properties
deleted file mode 100644
index c6f5a04f2c..0000000000
--- a/jetty-monitor/src/main/resources/org/eclipse/jetty/monitor/jmx/ThreadMonitor-mbean.properties
+++ /dev/null
@@ -1 +0,0 @@
-ThreadMonitor: Detect and report spinning and deadlocked threads

Back to the top