From 297625b44692bd8f86fd1c20675abce2481dc3f2 Mon Sep 17 00:00:00 2001 From: Simone Bordet Date: Tue, 10 Jan 2012 17:42:52 +0100 Subject: [PATCH] Removed redundant code and cleaned up. --- .../jetty/rewrite/handler/ProxyRuleTest.java | 8 +++---- .../server/nio/AbstractNIOConnector.java | 15 +++++-------- .../server/nio/SelectChannelConnector.java | 22 +------------------ 3 files changed, 9 insertions(+), 36 deletions(-) diff --git a/jetty-rewrite/src/test/java/org/eclipse/jetty/rewrite/handler/ProxyRuleTest.java b/jetty-rewrite/src/test/java/org/eclipse/jetty/rewrite/handler/ProxyRuleTest.java index 9cb9def596a..b56b1bebc96 100644 --- a/jetty-rewrite/src/test/java/org/eclipse/jetty/rewrite/handler/ProxyRuleTest.java +++ b/jetty-rewrite/src/test/java/org/eclipse/jetty/rewrite/handler/ProxyRuleTest.java @@ -1,5 +1,3 @@ -package org.eclipse.jetty.rewrite.handler; - //======================================================================== //Copyright (c) 2006-2009 Mort Bay Consulting Pty. Ltd. //------------------------------------------------------------------------ @@ -12,12 +10,10 @@ package org.eclipse.jetty.rewrite.handler; //http://www.opensource.org/licenses/apache2.0.php //You may elect to redistribute this code under either of these licenses. //======================================================================== - -import static org.junit.Assert.assertEquals; +package org.eclipse.jetty.rewrite.handler; import java.io.IOException; import java.net.URLEncoder; - import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -35,6 +31,8 @@ import org.junit.AfterClass; import org.junit.BeforeClass; import org.junit.Test; +import static org.junit.Assert.assertEquals; + public class ProxyRuleTest { private static ProxyRule _rule; diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/nio/AbstractNIOConnector.java b/jetty-server/src/main/java/org/eclipse/jetty/server/nio/AbstractNIOConnector.java index 2083c5d3714..8e24a8c5eb5 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/nio/AbstractNIOConnector.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/nio/AbstractNIOConnector.java @@ -4,35 +4,31 @@ // All rights reserved. This program and the accompanying materials // are made available under the terms of the Eclipse Public License v1.0 // and Apache License v2.0 which accompanies this distribution. -// The Eclipse Public License is available at +// The Eclipse Public License is available at // http://www.eclipse.org/legal/epl-v10.html // The Apache License v2.0 is available at // http://www.opensource.org/licenses/apache2.0.php -// You may elect to redistribute this code under either of these licenses. +// You may elect to redistribute this code under either of these licenses. // ======================================================================== /** - * + * */ package org.eclipse.jetty.server.nio; import org.eclipse.jetty.io.Buffers.Type; import org.eclipse.jetty.server.AbstractConnector; -/* ------------------------------------------------------------ */ -/** - * - * - */ public abstract class AbstractNIOConnector extends AbstractConnector implements NIOConnector { + public AbstractNIOConnector() { _buffers.setRequestBufferType(Type.DIRECT); _buffers.setRequestHeaderType(Type.INDIRECT); _buffers.setResponseBufferType(Type.DIRECT); _buffers.setResponseHeaderType(Type.INDIRECT); } - + /* ------------------------------------------------------------------------------- */ public boolean getUseDirectBuffers() { @@ -49,5 +45,4 @@ public abstract class AbstractNIOConnector extends AbstractConnector implements _buffers.setRequestBufferType(direct?Type.DIRECT:Type.INDIRECT); _buffers.setResponseBufferType(direct?Type.DIRECT:Type.INDIRECT); } - } diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/nio/SelectChannelConnector.java b/jetty-server/src/main/java/org/eclipse/jetty/server/nio/SelectChannelConnector.java index 9cf3ede1fef..c5618a6e97c 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/nio/SelectChannelConnector.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/nio/SelectChannelConnector.java @@ -19,7 +19,6 @@ import java.net.Socket; import java.nio.channels.SelectionKey; import java.nio.channels.ServerSocketChannel; import java.nio.channels.SocketChannel; -import java.util.Arrays; import org.eclipse.jetty.continuation.Continuation; import org.eclipse.jetty.io.AsyncEndPoint; @@ -32,9 +31,6 @@ import org.eclipse.jetty.io.nio.SelectorManager; import org.eclipse.jetty.io.nio.SelectorManager.SelectSet; import org.eclipse.jetty.server.AsyncHttpConnection; import org.eclipse.jetty.server.Request; -import org.eclipse.jetty.util.component.AggregateLifeCycle; -import org.eclipse.jetty.util.log.Log; -import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.util.thread.ThreadPool; /* ------------------------------------------------------------------------------- */ @@ -65,8 +61,6 @@ import org.eclipse.jetty.util.thread.ThreadPool; */ public class SelectChannelConnector extends AbstractNIOConnector { - private static final Logger LOG = Log.getLogger(SelectChannelConnector.class); - protected ServerSocketChannel _acceptChannel; private int _lowResourcesConnections; private int _lowResourcesMaxIdleTime; @@ -126,7 +120,6 @@ public class SelectChannelConnector extends AbstractNIOConnector @Override public void customize(EndPoint endpoint, Request request) throws IOException { - AsyncEndPoint aEndp = ((AsyncEndPoint)endpoint); request.setTimeStamp(System.currentTimeMillis()); endpoint.setMaxIdleTime(_maxIdleTime); super.customize(endpoint, request); @@ -182,9 +175,8 @@ public class SelectChannelConnector extends AbstractNIOConnector _localPort=_acceptChannel.socket().getLocalPort(); if (_localPort<=0) throw new IOException("Server channel not bound"); - - addBean(_acceptChannel); + addBean(_acceptChannel); } } } @@ -259,17 +251,6 @@ public class SelectChannelConnector extends AbstractNIOConnector super.doStart(); } - /* ------------------------------------------------------------ */ - /* - * @see org.eclipse.jetty.server.server.AbstractConnector#doStop() - */ - @Override - protected void doStop() throws Exception - { - close(); - super.doStop(); - } - /* ------------------------------------------------------------ */ protected SelectChannelEndPoint newEndPoint(SocketChannel channel, SelectSet selectSet, SelectionKey key) throws IOException { @@ -336,5 +317,4 @@ public class SelectChannelConnector extends AbstractNIOConnector return SelectChannelConnector.this.newEndPoint(channel,selectSet,sKey); } } - }