292814 Make QoSFilter and DoSFilter JMX manageable

git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@1915 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
Michael Gorovoy 2010-06-02 21:19:47 +00:00
parent 4130f68f98
commit 8542e6c7ae
4 changed files with 30 additions and 6 deletions

View File

@ -1,5 +1,6 @@
jetty-7.1.4-SNAPSHOT jetty-7.1.4-SNAPSHOT
+ 292326 Stop continuations if server is stopped. + 292326 Stop continuations if server is stopped.
+ 292814 Make QoSFilter and DoSFilter JMX manageable
+ 294212 Can not customize session cookie path + 294212 Can not customize session cookie path
+ 302350 org.eclipse.jetty.server.NCSARequestLog is missing JavaDoc + 302350 org.eclipse.jetty.server.NCSARequestLog is missing JavaDoc
+ 304100 Better document JMX setup in jetty-jmx.xml + 304100 Better document JMX setup in jetty-jmx.xml

View File

@ -53,6 +53,7 @@ import org.eclipse.jetty.util.LazyList;
import org.eclipse.jetty.util.MultiException; import org.eclipse.jetty.util.MultiException;
import org.eclipse.jetty.util.MultiMap; import org.eclipse.jetty.util.MultiMap;
import org.eclipse.jetty.util.URIUtil; import org.eclipse.jetty.util.URIUtil;
import org.eclipse.jetty.util.component.Container;
import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Log;
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
@ -661,11 +662,23 @@ public class ServletHandler extends ScopedHandler
{ {
MultiException mx = new MultiException(); MultiException mx = new MultiException();
Container beanContainer = getServer()==null? null: getServer().getContainer();
// Start filters // Start filters
if (_filters!=null) if (_filters!=null)
{ {
for (int i=0;i<_filters.length; i++) for (int i=0;i<_filters.length; i++)
{
_filters[i].start(); _filters[i].start();
if (beanContainer != null)
{
Filter filter = _filters[i].getFilter();
if (filter != null && filter.getClass().getName().startsWith("org.eclipse.jetty."))
{
beanContainer.addBean(filter);
}
}
}
} }
if (_servlets!=null) if (_servlets!=null)
@ -689,6 +702,14 @@ public class ServletHandler extends ScopedHandler
} }
servlets[i].start(); servlets[i].start();
if (beanContainer != null)
{
Servlet servlet = servlets[i].getServletInstance();
if (servlet != null && servlet.getClass().getName().startsWith("org.eclipse.jetty."))
{
beanContainer.addBean(servlet);
}
}
} }
catch(Throwable e) catch(Throwable e)
{ {

View File

@ -183,10 +183,11 @@ public class DoSFilter implements Filter
delay = Integer.parseInt(filterConfig.getInitParameter(DELAY_MS_INIT_PARAM)); delay = Integer.parseInt(filterConfig.getInitParameter(DELAY_MS_INIT_PARAM));
_delayMs = delay; _delayMs = delay;
_throttledRequests = __DEFAULT_THROTTLE; int throttledRequests = __DEFAULT_THROTTLE;
if (filterConfig.getInitParameter(THROTTLED_REQUESTS_INIT_PARAM) != null) if (filterConfig.getInitParameter(THROTTLED_REQUESTS_INIT_PARAM) != null)
_throttledRequests = Integer.parseInt(filterConfig.getInitParameter(THROTTLED_REQUESTS_INIT_PARAM)); throttledRequests = Integer.parseInt(filterConfig.getInitParameter(THROTTLED_REQUESTS_INIT_PARAM));
_passes = new Semaphore(_throttledRequests,true); _passes = new Semaphore(throttledRequests,true);
_throttledRequests = throttledRequests;
long wait = __DEFAULT_WAIT_MS; long wait = __DEFAULT_WAIT_MS;
if (filterConfig.getInitParameter(MAX_WAIT_INIT_PARAM) != null) if (filterConfig.getInitParameter(MAX_WAIT_INIT_PARAM) != null)

View File

@ -116,10 +116,11 @@ public class QoSFilter implements Filter
}; };
} }
int _maxRequests=__DEFAULT_PASSES; int maxRequests=__DEFAULT_PASSES;
if (filterConfig.getInitParameter(MAX_REQUESTS_INIT_PARAM)!=null) if (filterConfig.getInitParameter(MAX_REQUESTS_INIT_PARAM)!=null)
_maxRequests=Integer.parseInt(filterConfig.getInitParameter(MAX_REQUESTS_INIT_PARAM)); maxRequests=Integer.parseInt(filterConfig.getInitParameter(MAX_REQUESTS_INIT_PARAM));
_passes=new Semaphore(_maxRequests,true); _passes=new Semaphore(maxRequests,true);
_maxRequests = maxRequests;
long wait = __DEFAULT_WAIT_MS; long wait = __DEFAULT_WAIT_MS;
if (filterConfig.getInitParameter(MAX_WAIT_INIT_PARAM)!=null) if (filterConfig.getInitParameter(MAX_WAIT_INIT_PARAM)!=null)