Expose more stuff via jmx like threadpool details, connector details, etc.

Enhance start.ini documentation for spdy.
This commit is contained in:
Thomas Becker 2012-10-12 10:39:46 +02:00
parent 57492fe3ce
commit dd651b0d9f
6 changed files with 28 additions and 6 deletions

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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);
}

View File

@ -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();