jetty-9 cleanups and fixes after merge

This commit is contained in:
Greg Wilkins 2012-07-20 14:58:32 +10:00
parent 581829e04e
commit 0e896d4204
10 changed files with 33 additions and 66 deletions

View File

@ -151,15 +151,6 @@ public class AsyncByteArrayEndPoint extends ByteArrayEndPoint implements AsyncEn
{
}
@Override
public void close()
{
boolean was_open=isOpen();
super.close();
if (was_open)
onClose();
}
@Override
public void onClose()
{

View File

@ -156,7 +156,6 @@ public abstract class SelectorManager extends AbstractLifeCycle implements Dumpa
*/
protected void endPointClosed(AsyncEndPoint endpoint)
{
endpoint.getAsyncConnection().onClose();
endpoint.onClose();
}
@ -166,6 +165,8 @@ public abstract class SelectorManager extends AbstractLifeCycle implements Dumpa
*/
protected void endPointUpgraded(AsyncEndPoint endpoint, AsyncConnection oldConnection)
{
oldConnection.onClose();
endpoint.getAsyncConnection().onOpen();
}
/**
@ -451,18 +452,20 @@ public abstract class SelectorManager extends AbstractLifeCycle implements Dumpa
private AsyncEndPoint createEndPoint(SocketChannel channel, SelectionKey sKey) throws IOException
{
Selectable asyncEndPoint = newEndPoint(channel, this, sKey);
asyncEndPoint.setAsyncConnection(newConnection(channel, asyncEndPoint, sKey.attachment()));
_endPoints.put(asyncEndPoint, this);
LOG.debug("Created {}", asyncEndPoint);
endPointOpened(asyncEndPoint);
return asyncEndPoint;
Selectable endp = newEndPoint(channel, this, sKey);
endp.setAsyncConnection(newConnection(channel, endp, sKey.attachment()));
_endPoints.put(endp, this);
LOG.debug("Created {}", endp);
endPointOpened(endp);
endp.getAsyncConnection().onOpen();
return endp;
}
public void destroyEndPoint(Selectable endp)
{
LOG.debug("Destroyed {}", endp);
_endPoints.remove(endp);
endp.getAsyncConnection().onClose();
endPointClosed(endp);
}

View File

@ -437,7 +437,6 @@ public abstract class AbstractConnector extends AggregateLifeCycle implements Co
/* ------------------------------------------------------------ */
protected void connectionOpened(AsyncConnection connection)
{
connection.onOpen();
_stats.connectionOpened();
}

View File

@ -291,10 +291,7 @@ public class HttpConnection extends AbstractAsyncConnection
// return if the connection has been changed
if (getEndPoint().getAsyncConnection()!=this)
{
getEndPoint().getAsyncConnection().onOpen();
return;
}
}
else if (_headerBytes>= _connector.getRequestHeaderSize())
{

View File

@ -103,6 +103,7 @@ public class LocalHttpConnector extends HttpConnector
LocalEndPoint endp = _connects.take();
HttpConnection connection=new HttpConnection(this,endp,getServer());
endp.setAsyncConnection(connection);
endp.onOpen();
connectionOpened(connection);
_executor._phaser.arriveAndDeregister(); // arrive for the register done in getResponses
}
@ -199,6 +200,19 @@ public class LocalHttpConnector extends HttpConnector
setInput(BufferUtil.toBuffer(s,StringUtil.__UTF8_CHARSET));
}
/* ------------------------------------------------------------ */
@Override
public void close()
{
boolean was_open=isOpen();
super.close();
if (was_open)
{
connectionClosed(getAsyncConnection());
onClose();
}
}
/* ------------------------------------------------------------ */
@Override
public void onClose()

View File

@ -242,8 +242,8 @@ public class SelectChannelConnector extends HttpConnector implements NetConnecto
@Override
protected void endPointClosed(AsyncEndPoint endpoint)
{
connectionClosed(endpoint.getAsyncConnection());
super.endPointClosed(endpoint);
SelectChannelConnector.this.endPointClosed(endpoint);
}
@Override

27
pom.xml
View File

@ -517,7 +517,6 @@
<!--
Usage:
configure settings.xml for jetty.eclipse.website server entry
> mvn -Paggregate-site javadoc:aggregate jxr:jxr
> mvn -N site:deploy
or
> mvn -N site:sshdeploy (for ssh users w/passphrase and ssh-agent)
@ -557,29 +556,9 @@
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<!--
Moves the jetty-aggregate build tree to a profile called 'aggregates'.
It is active by default, but being in a profile allows it to be
disabled via the "-P-aggregates" command line on maven.
(Useful for running site plugin with deep reporting and avoiding
duplicate hits on aggregated classes) -->
<id>aggregates</id>
<activation>
<activeByDefault>false</activeByDefault>
<!--
<file>
<exists>${basedir}/pom.xml</exists>
</file>
-->
</activation>
<modules>
<module>jetty-aggregate</module>
</modules>
</profile>
<profile>
</build>
</profile>
<profile>
<!--
Moves the jetty-osgi build tree to a profile called 'osgi'.
It is active by default, but being in a profile allows it to be

View File

@ -49,7 +49,7 @@ import javax.servlet.http.HttpServletResponseWrapper;
import org.eclipse.jetty.continuation.Continuation;
import org.eclipse.jetty.continuation.ContinuationListener;
import org.eclipse.jetty.continuation.ContinuationSupport;
import org.eclipse.jetty.http.HttpHeaders;
import org.eclipse.jetty.http.HttpHeader;
import org.eclipse.jetty.util.IO;
import org.eclipse.jetty.util.StringUtil;
import org.eclipse.jetty.util.log.Log;
@ -161,7 +161,7 @@ public class Dump extends HttpServlet
try
{
long s = Long.parseLong(request.getParameter("sleep"));
if (request.getHeader(HttpHeaders.EXPECT)!=null &&request.getHeader(HttpHeaders.EXPECT).indexOf("102")>=0)
if (request.getHeader(HttpHeader.EXPECT.asString())!=null && request.getHeader(HttpHeader.EXPECT.asString()).indexOf("102")>=0)
{
Thread.sleep(s/2);
response.sendError(102);

View File

@ -17,7 +17,7 @@ import junit.framework.TestCase;
import org.eclipse.jetty.servlet.DefaultServlet;
import org.eclipse.jetty.servlet.ServletHolder;
import org.eclipse.jetty.testing.ServletTester;
import org.eclipse.jetty.servlet.ServletTester;
import com.acme.DispatchServlet;

View File

@ -28,7 +28,6 @@ import org.eclipse.jetty.server.Handler;
import org.eclipse.jetty.server.NCSARequestLog;
import org.eclipse.jetty.server.Request;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.bio.SocketConnector;
import org.eclipse.jetty.server.handler.ContextHandler;
import org.eclipse.jetty.server.handler.ContextHandlerCollection;
import org.eclipse.jetty.server.handler.DefaultHandler;
@ -36,8 +35,7 @@ import org.eclipse.jetty.server.handler.HandlerCollection;
import org.eclipse.jetty.server.handler.HandlerWrapper;
import org.eclipse.jetty.server.handler.RequestLogHandler;
import org.eclipse.jetty.server.handler.ResourceHandler;
import org.eclipse.jetty.server.nio.BlockingChannelConnector;
import org.eclipse.jetty.server.nio.SelectChannelConnector;
import org.eclipse.jetty.server.SelectChannelConnector;
import org.eclipse.jetty.server.session.HashSessionManager;
import org.eclipse.jetty.server.ssl.SslSelectChannelConnector;
import org.eclipse.jetty.util.log.Log;
@ -77,7 +75,6 @@ public class TestServer
connector0.setPort(8080);
connector0.setMaxIdleTime(30000);
connector0.setConfidentialPort(8443);
connector0.setUseDirectBuffers(true);
server.addConnector(connector0);
// Setup Connectors
@ -85,27 +82,14 @@ public class TestServer
connector1.setPort(8081);
connector1.setMaxIdleTime(30000);
connector1.setConfidentialPort(8443);
connector1.setUseDirectBuffers(false);
server.addConnector(connector1);
// Setup Connectors
SocketConnector connector2 = new SocketConnector();
connector2.setPort(8082);
connector2.setMaxIdleTime(30000);
connector2.setConfidentialPort(8443);
server.addConnector(connector2);
// Setup Connectors
BlockingChannelConnector connector3 = new BlockingChannelConnector();
connector3.setPort(8083);
connector3.setMaxIdleTime(30000);
connector3.setConfidentialPort(8443);
server.addConnector(connector3);
SslSelectChannelConnector ssl_connector = new SslSelectChannelConnector();
ssl_connector.setPort(8443);
SslContextFactory cf = ssl_connector.getSslContextFactory();
cf.setKeyStore(jetty_root + "/jetty-server/src/main/config/etc/keystore");
cf.setKeyStorePath(jetty_root + "/jetty-server/src/main/config/etc/keystore");
cf.setKeyStorePassword("OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4");
cf.setKeyManagerPassword("OBF:1u2u1wml1z7s1z7a1wnl1u2g");
cf.setTrustStore(jetty_root + "/jetty-server/src/main/config/etc/keystore");