diff --git a/jetty-distribution/src/main/resources/start.ini b/jetty-distribution/src/main/resources/start.ini index 561336af6ed..ea608e9aefb 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 5478f14599e..a07374b29f1 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; *
  • perform any configuration of the connection (eg. socket linger times) *
  • call the {@link #getDefaultConnectionFactory()} {@link ConnectionFactory#newConnection(Connector, org.eclipse.jetty.io.EndPoint)} * method to create a new Connection instance. - *
  • call the {@link #connectionOpened(Connection)} method to signal a new connection has been created. - *
  • arrange for the {@link #connectionClosed(Connection)} method to be called once the connection is closed. * * 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 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 d01bad5b896..bb55fd50a1f 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; *

    * 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 53a7b876137..42483faa212 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 9e6e32ee79e..5c909117df0 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 getSessions() + public Collection 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 f4636a53e3d..0cab552d58d 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 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();