aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Becker2012-10-12 04:39:46 (EDT)
committerThomas Becker2012-10-17 07:37:34 (EDT)
commitdd651b0d9f65ed511e7486976f87f9c65e84c9eb (patch)
treede463384b9f2ecff95ef70fd7b4859477b45e7ec
parent57492fe3ce8abaf63d737098f5d4c7b9b9d390cf (diff)
downloadorg.eclipse.jetty.project-dd651b0d9f65ed511e7486976f87f9c65e84c9eb.zip
org.eclipse.jetty.project-dd651b0d9f65ed511e7486976f87f9c65e84c9eb.tar.gz
org.eclipse.jetty.project-dd651b0d9f65ed511e7486976f87f9c65e84c9eb.tar.bz2
Expose more stuff via jmx like threadpool details, connector details, etc.
Enhance start.ini documentation for spdy.
-rw-r--r--jetty-distribution/src/main/resources/start.ini6
-rw-r--r--jetty-server/src/main/java/org/eclipse/jetty/server/AbstractConnector.java5
-rw-r--r--jetty-server/src/main/java/org/eclipse/jetty/server/AbstractNetworkConnector.java6
-rw-r--r--jetty-server/src/main/java/org/eclipse/jetty/server/ServerConnector.java4
-rw-r--r--jetty-spdy/spdy-server/src/main/java/org/eclipse/jetty/spdy/server/SPDYServerConnectionFactory.java7
-rw-r--r--jetty-util/src/main/java/org/eclipse/jetty/util/thread/QueuedThreadPool.java6
6 files changed, 28 insertions, 6 deletions
diff --git a/jetty-distribution/src/main/resources/start.ini b/jetty-distribution/src/main/resources/start.ini
index 561336a..ea608e9 100644
--- a/jetty-distribution/src/main/resources/start.ini
+++ b/jetty-distribution/src/main/resources/start.ini
@@ -117,7 +117,11 @@ etc/jetty-https.xml
# also provides HTTPS.
# The NPN jar must be separately downloaded from
# http://repo1.maven.org/maven2/org/mortbay/jetty/npn/npn-boot/1.1.0.v20120525/
-# Must also enable --exec or use --exec-print (see above)
+# Must also enable --exec or use --exec-print (see above) or
+# add -Xbootclasspath/p:lib/npn-boot-1.1.0.v20120525.jar to
+# the java commandline you use to start jetty.
+# Make sure that you either reconfigure ports or comment
+# jetty-http.xml/jetty-https.xml to avoid port conflicts.
#-----------------------------------------------------------
# OPTIONS=spdy
# -Xbootclasspath/p:lib/npn-boot-1.1.0.v20120525.jar
diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/AbstractConnector.java b/jetty-server/src/main/java/org/eclipse/jetty/server/AbstractConnector.java
index 5478f14..a07374b 100644
--- a/jetty-server/src/main/java/org/eclipse/jetty/server/AbstractConnector.java
+++ b/jetty-server/src/main/java/org/eclipse/jetty/server/AbstractConnector.java
@@ -124,8 +124,6 @@ import org.eclipse.jetty.util.thread.TimerScheduler;
* <li>perform any configuration of the connection (eg. socket linger times)
* <li>call the {@link #getDefaultConnectionFactory()} {@link ConnectionFactory#newConnection(Connector, org.eclipse.jetty.io.EndPoint)}
* method to create a new Connection instance.
- * <li>call the {@link #connectionOpened(Connection)} method to signal a new connection has been created.
- * <li>arrange for the {@link #connectionClosed(Connection)} method to be called once the connection is closed.
* </nl>
* The default number of acceptor tasks is the minimum of 1 and half the number of available CPUs. Having more acceptors may reduce
* the latency for servers that see a high rate of new connections (eg HTTP/1.0 without keep-alive). Typically the default is
@@ -205,6 +203,7 @@ public abstract class AbstractConnector extends ContainerLifeCycle implements Co
}
@Override
+ @ManagedAttribute("Idle timeout")
public long getIdleTimeout()
{
return _idleTimeout;
@@ -379,6 +378,7 @@ public abstract class AbstractConnector extends ContainerLifeCycle implements Co
@Override
+ @ManagedAttribute("Protocols supported by this connector")
public List<String> getProtocols()
{
synchronized (_factories)
@@ -395,6 +395,7 @@ public abstract class AbstractConnector extends ContainerLifeCycle implements Co
}
}
+ @ManagedAttribute("This connector's default protocol")
public String getDefaultProtocol()
{
return _defaultProtocol;
diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/AbstractNetworkConnector.java b/jetty-server/src/main/java/org/eclipse/jetty/server/AbstractNetworkConnector.java
index d01bad5..bb55fd5 100644
--- a/jetty-server/src/main/java/org/eclipse/jetty/server/AbstractNetworkConnector.java
+++ b/jetty-server/src/main/java/org/eclipse/jetty/server/AbstractNetworkConnector.java
@@ -23,6 +23,8 @@ import java.util.concurrent.Executor;
import java.util.concurrent.Future;
import org.eclipse.jetty.io.ByteBufferPool;
+import org.eclipse.jetty.util.annotation.ManagedAttribute;
+import org.eclipse.jetty.util.annotation.ManagedObject;
import org.eclipse.jetty.util.thread.Scheduler;
/**
@@ -30,8 +32,10 @@ import org.eclipse.jetty.util.thread.Scheduler;
* <p>
* Extends the {@link AbstractConnector} support for the {@link NetworkConnector} interface.
*/
+@ManagedObject("AbstractNetworkConnector")
public abstract class AbstractNetworkConnector extends AbstractConnector implements NetworkConnector
{
+
private volatile String _host;
private volatile int _port = 0;
@@ -46,6 +50,7 @@ public abstract class AbstractNetworkConnector extends AbstractConnector impleme
}
@Override
+ @ManagedAttribute("Host this connector binds to")
public String getHost()
{
return _host;
@@ -57,6 +62,7 @@ public abstract class AbstractNetworkConnector extends AbstractConnector impleme
}
@Override
+ @ManagedAttribute("Port this connector listens on")
public int getPort()
{
return _port;
diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/ServerConnector.java b/jetty-server/src/main/java/org/eclipse/jetty/server/ServerConnector.java
index 53a7b87..42483fa 100644
--- a/jetty-server/src/main/java/org/eclipse/jetty/server/ServerConnector.java
+++ b/jetty-server/src/main/java/org/eclipse/jetty/server/ServerConnector.java
@@ -38,6 +38,7 @@ import org.eclipse.jetty.io.SelectChannelEndPoint;
import org.eclipse.jetty.io.SelectorManager;
import org.eclipse.jetty.io.SelectorManager.ManagedSelector;
import org.eclipse.jetty.util.Callback;
+import org.eclipse.jetty.util.annotation.ManagedAttribute;
import org.eclipse.jetty.util.annotation.ManagedObject;
import org.eclipse.jetty.util.annotation.Name;
import org.eclipse.jetty.util.ssl.SslContextFactory;
@@ -282,6 +283,7 @@ public class ServerConnector extends AbstractNetworkConnector
}
@Override
+ @ManagedAttribute("local port")
public int getLocalPort()
{
return _localPort;
@@ -296,6 +298,7 @@ public class ServerConnector extends AbstractNetworkConnector
* @return the linger time
* @see Socket#getSoLinger()
*/
+ @ManagedAttribute("linger time")
public int getLingerTime()
{
return _lingerTime;
@@ -313,6 +316,7 @@ public class ServerConnector extends AbstractNetworkConnector
/**
* @return the accept queue size
*/
+ @ManagedAttribute("Accept Queue size")
public int getAcceptQueueSize()
{
return _acceptQueueSize;
diff --git a/jetty-spdy/spdy-server/src/main/java/org/eclipse/jetty/spdy/server/SPDYServerConnectionFactory.java b/jetty-spdy/spdy-server/src/main/java/org/eclipse/jetty/spdy/server/SPDYServerConnectionFactory.java
index 9e6e32e..5c90911 100644
--- a/jetty-spdy/spdy-server/src/main/java/org/eclipse/jetty/spdy/server/SPDYServerConnectionFactory.java
+++ b/jetty-spdy/spdy-server/src/main/java/org/eclipse/jetty/spdy/server/SPDYServerConnectionFactory.java
@@ -38,7 +38,10 @@ import org.eclipse.jetty.spdy.client.FlowControlStrategyFactory;
import org.eclipse.jetty.spdy.client.SPDYConnection;
import org.eclipse.jetty.spdy.generator.Generator;
import org.eclipse.jetty.spdy.parser.Parser;
+import org.eclipse.jetty.util.annotation.ManagedAttribute;
+import org.eclipse.jetty.util.annotation.ManagedObject;
+@ManagedObject("SPDY Server Connection Factory")
public class SPDYServerConnectionFactory extends AbstractConnectionFactory
{
// This method is placed here so as to provide a check for NPN before attempting to load any
@@ -75,6 +78,7 @@ public class SPDYServerConnectionFactory extends AbstractConnectionFactory
setInitialWindowSize(65536);
}
+ @ManagedAttribute("SPDY version")
public short getVersion()
{
return version;
@@ -118,6 +122,7 @@ public class SPDYServerConnectionFactory extends AbstractConnectionFactory
return listener;
}
+ @ManagedAttribute("Initial Window Size")
public int getInitialWindowSize()
{
return initialWindowSize;
@@ -155,7 +160,7 @@ public class SPDYServerConnectionFactory extends AbstractConnectionFactory
super.doStop();
}
- protected Collection<Session> getSessions()
+ public Collection<Session> getSessions()
{
return Collections.unmodifiableCollection(sessions);
}
diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/thread/QueuedThreadPool.java b/jetty-util/src/main/java/org/eclipse/jetty/util/thread/QueuedThreadPool.java
index f4636a5..0cab552 100644
--- a/jetty-util/src/main/java/org/eclipse/jetty/util/thread/QueuedThreadPool.java
+++ b/jetty-util/src/main/java/org/eclipse/jetty/util/thread/QueuedThreadPool.java
@@ -44,7 +44,6 @@ import org.eclipse.jetty.util.component.LifeCycle;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.util.thread.ThreadPool.SizedThreadPool;
-import org.omg.CORBA._IDLTypeStub;
@ManagedObject("A thread pool with no max bound by default")
public class QueuedThreadPool extends AbstractLifeCycle implements SizedThreadPool, Dumpable
@@ -110,7 +109,6 @@ public class QueuedThreadPool extends AbstractLifeCycle implements SizedThreadPo
protected void doStop() throws Exception
{
super.doStop();
- long start=System.currentTimeMillis();
long timeout=getStopTimeout();
BlockingQueue<Runnable> jobs = getQueue();
@@ -247,6 +245,7 @@ public class QueuedThreadPool extends AbstractLifeCycle implements SizedThreadPo
/**
* @return maximum queue size
*/
+ @ManagedAttribute("maximum queue size")
public int getMaxQueued()
{
return _maxQueued;
@@ -375,6 +374,7 @@ public class QueuedThreadPool extends AbstractLifeCycle implements SizedThreadPo
* @return The total number of threads currently in the pool
*/
@Override
+ @ManagedAttribute("total number of threads currently in the pool")
public int getThreads()
{
return _threadsStarted.get();
@@ -384,6 +384,7 @@ public class QueuedThreadPool extends AbstractLifeCycle implements SizedThreadPo
* @return The number of idle threads in the pool
*/
@Override
+ @ManagedAttribute("total number of idle threads in the pool")
public int getIdleThreads()
{
return _threadsIdle.get();
@@ -393,6 +394,7 @@ public class QueuedThreadPool extends AbstractLifeCycle implements SizedThreadPo
* @return True if the pool is at maxThreads and there are not more idle threads than queued jobs
*/
@Override
+ @ManagedAttribute("True if the pools is at maxThreads and there are not idle threads than queued jobs")
public boolean isLowOnThreads()
{
return _threadsStarted.get()==_maxThreads && _jobs.size()>=_threadsIdle.get();