Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Wilkins2011-03-02 12:21:12 +0000
committerGreg Wilkins2011-03-02 12:21:12 +0000
commitd0b4ddcb28cf772ddf1fd7ec48ac90ca162397e9 (patch)
tree1fcca94421ae8811dec8499906c73ab4e7486a83
parentd77069a8ea69655de4c660f62eaaca292b645d06 (diff)
downloadorg.eclipse.jetty.project-d0b4ddcb28cf772ddf1fd7ec48ac90ca162397e9.tar.gz
org.eclipse.jetty.project-d0b4ddcb28cf772ddf1fd7ec48ac90ca162397e9.tar.xz
org.eclipse.jetty.project-d0b4ddcb28cf772ddf1fd7ec48ac90ca162397e9.zip
rolled back the API changes for 7.3.1, will redo for 7.4.0
git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@2846 7e9141cc-0065-0410-87d8-b60c137991c4
-rw-r--r--jetty-client/src/main/java/org/eclipse/jetty/client/HttpConnection.java20
-rw-r--r--jetty-client/src/main/java/org/eclipse/jetty/client/HttpDestination.java3
-rw-r--r--jetty-client/src/main/java/org/eclipse/jetty/client/HttpExchange.java4
-rw-r--r--jetty-client/src/test/java/org/eclipse/jetty/client/HttpExchangeTest.java3
-rw-r--r--jetty-io/src/main/java/org/eclipse/jetty/io/AbstractConnection.java2
-rw-r--r--jetty-io/src/main/java/org/eclipse/jetty/io/Connection.java6
-rw-r--r--jetty-io/src/main/java/org/eclipse/jetty/io/Idleable.java28
-rw-r--r--jetty-io/src/main/java/org/eclipse/jetty/io/nio/SelectChannelEndPoint.java15
-rw-r--r--jetty-server/src/main/java/org/eclipse/jetty/server/HttpConnection.java23
9 files changed, 88 insertions, 16 deletions
diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/HttpConnection.java b/jetty-client/src/main/java/org/eclipse/jetty/client/HttpConnection.java
index 3c4fa833e4..8340b5b7be 100644
--- a/jetty-client/src/main/java/org/eclipse/jetty/client/HttpConnection.java
+++ b/jetty-client/src/main/java/org/eclipse/jetty/client/HttpConnection.java
@@ -45,7 +45,7 @@ import org.eclipse.jetty.util.thread.Timeout;
*
* @version $Revision: 879 $ $Date: 2009-09-11 16:13:28 +0200 (Fri, 11 Sep 2009) $
*/
-public class HttpConnection extends AbstractConnection implements Connection
+public class HttpConnection /* extends AbstractConnection */ implements Connection
{
private HttpDestination _destination;
private HttpGenerator _generator;
@@ -76,7 +76,9 @@ public class HttpConnection extends AbstractConnection implements Connection
HttpConnection(Buffers requestBuffers, Buffers responseBuffers, EndPoint endp)
{
- super(endp);
+ _endp=endp;
+ _timeStamp = System.currentTimeMillis();
+
_generator = new HttpGenerator(requestBuffers,endp);
_parser = new HttpParser(responseBuffers,endp,new Handler());
}
@@ -709,4 +711,18 @@ public class HttpConnection extends AbstractConnection implements Connection
}
}
}
+
+
+
+ // TODO remove and use AbstractConnection for 7.4
+ private final long _timeStamp;
+ protected final EndPoint _endp;
+ public long getTimeStamp()
+ {
+ return _timeStamp;
+ }
+ public EndPoint getEndPoint()
+ {
+ return _endp;
+ }
}
diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/HttpDestination.java b/jetty-client/src/main/java/org/eclipse/jetty/client/HttpDestination.java
index 3135e44bdf..c96a4553ae 100644
--- a/jetty-client/src/main/java/org/eclipse/jetty/client/HttpDestination.java
+++ b/jetty-client/src/main/java/org/eclipse/jetty/client/HttpDestination.java
@@ -31,6 +31,7 @@ import org.eclipse.jetty.http.PathMap;
import org.eclipse.jetty.io.AbstractConnection;
import org.eclipse.jetty.io.Buffer;
import org.eclipse.jetty.io.ByteArrayBuffer;
+import org.eclipse.jetty.io.Connection;
import org.eclipse.jetty.io.EndPoint;
import org.eclipse.jetty.util.log.Log;
@@ -313,7 +314,7 @@ public class HttpDestination
public void onNewConnection(final HttpConnection connection) throws IOException
{
- AbstractConnection q_connection = null;
+ Connection q_connection = null;
synchronized (this)
{
diff --git a/jetty-client/src/main/java/org/eclipse/jetty/client/HttpExchange.java b/jetty-client/src/main/java/org/eclipse/jetty/client/HttpExchange.java
index 3f758a428c..c5dcb5bec7 100644
--- a/jetty-client/src/main/java/org/eclipse/jetty/client/HttpExchange.java
+++ b/jetty-client/src/main/java/org/eclipse/jetty/client/HttpExchange.java
@@ -691,9 +691,9 @@ public class HttpExchange
return this._connection != null;
}
- AbstractConnection disassociate()
+ Connection disassociate()
{
- AbstractConnection result = _connection;
+ Connection result = _connection;
this._connection = null;
if (getStatus() == STATUS_CANCELLING)
setStatus(STATUS_CANCELLED);
diff --git a/jetty-client/src/test/java/org/eclipse/jetty/client/HttpExchangeTest.java b/jetty-client/src/test/java/org/eclipse/jetty/client/HttpExchangeTest.java
index 3f88d5177c..b0c3462210 100644
--- a/jetty-client/src/test/java/org/eclipse/jetty/client/HttpExchangeTest.java
+++ b/jetty-client/src/test/java/org/eclipse/jetty/client/HttpExchangeTest.java
@@ -33,6 +33,7 @@ import org.eclipse.jetty.http.HttpMethods;
import org.eclipse.jetty.io.AbstractConnection;
import org.eclipse.jetty.io.Buffer;
import org.eclipse.jetty.io.ByteArrayBuffer;
+import org.eclipse.jetty.io.Connection;
import org.eclipse.jetty.io.EofException;
import org.eclipse.jetty.io.nio.DirectNIOBuffer;
import org.eclipse.jetty.server.Connector;
@@ -474,7 +475,7 @@ public class HttpExchangeTest extends TestCase
//try to get a connection, and only wait 500ms, as we have
//already reserved the max, should return null
- AbstractConnection c = destination.reserveConnection(500);
+ Connection c = destination.reserveConnection(500);
assertNull(c);
//unreserve first connection
diff --git a/jetty-io/src/main/java/org/eclipse/jetty/io/AbstractConnection.java b/jetty-io/src/main/java/org/eclipse/jetty/io/AbstractConnection.java
index c957da76ee..e1a5125d22 100644
--- a/jetty-io/src/main/java/org/eclipse/jetty/io/AbstractConnection.java
+++ b/jetty-io/src/main/java/org/eclipse/jetty/io/AbstractConnection.java
@@ -5,7 +5,7 @@ import java.io.IOException;
import org.eclipse.jetty.util.log.Log;
-public abstract class AbstractConnection implements Connection
+public abstract class AbstractConnection implements Connection, Idleable
{
private final long _timeStamp;
protected final EndPoint _endp;
diff --git a/jetty-io/src/main/java/org/eclipse/jetty/io/Connection.java b/jetty-io/src/main/java/org/eclipse/jetty/io/Connection.java
index e5961c8647..926db3a3d4 100644
--- a/jetty-io/src/main/java/org/eclipse/jetty/io/Connection.java
+++ b/jetty-io/src/main/java/org/eclipse/jetty/io/Connection.java
@@ -44,12 +44,8 @@ public interface Connection
long getTimeStamp();
boolean isIdle();
+
boolean isSuspended();
-
- /**
- * Called when the connection idle timeout expires
- */
- void idleExpired();
/**
* Called when the connection is closed
diff --git a/jetty-io/src/main/java/org/eclipse/jetty/io/Idleable.java b/jetty-io/src/main/java/org/eclipse/jetty/io/Idleable.java
new file mode 100644
index 0000000000..f5a1e93d2f
--- /dev/null
+++ b/jetty-io/src/main/java/org/eclipse/jetty/io/Idleable.java
@@ -0,0 +1,28 @@
+// ========================================================================
+// Copyright (c) 2006-2009 Mort Bay Consulting Pty. Ltd.
+// ------------------------------------------------------------------------
+// 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
+// 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.
+// ========================================================================
+
+package org.eclipse.jetty.io;
+
+import java.io.IOException;
+
+/* ------------------------------------------------------------ */
+/** Idleable.
+ * @deprecated Merge this into Connection at the next point release
+ */
+public interface Idleable
+{
+ /**
+ * Called when the connection idle timeout expires
+ */
+ void idleExpired();
+}
diff --git a/jetty-io/src/main/java/org/eclipse/jetty/io/nio/SelectChannelEndPoint.java b/jetty-io/src/main/java/org/eclipse/jetty/io/nio/SelectChannelEndPoint.java
index 219b1baacc..7aed2cff22 100644
--- a/jetty-io/src/main/java/org/eclipse/jetty/io/nio/SelectChannelEndPoint.java
+++ b/jetty-io/src/main/java/org/eclipse/jetty/io/nio/SelectChannelEndPoint.java
@@ -24,6 +24,7 @@ import org.eclipse.jetty.io.Buffer;
import org.eclipse.jetty.io.ConnectedEndPoint;
import org.eclipse.jetty.io.Connection;
import org.eclipse.jetty.io.EofException;
+import org.eclipse.jetty.io.Idleable;
import org.eclipse.jetty.io.nio.SelectorManager.SelectSet;
import org.eclipse.jetty.util.log.Log;
@@ -248,7 +249,19 @@ public class SelectChannelEndPoint extends ChannelEndPoint implements AsyncEndPo
/* ------------------------------------------------------------ */
protected void idleExpired()
{
- _connection.idleExpired();
+ if (_connection instanceof Idleable)
+ ((Idleable)_connection).idleExpired();
+ else
+ {
+ try
+ {
+ close();
+ }
+ catch(IOException e)
+ {
+ Log.ignore(e);
+ }
+ }
}
/* ------------------------------------------------------------ */
diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConnection.java b/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConnection.java
index 535f417577..1cf690c79e 100644
--- a/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConnection.java
+++ b/jetty-server/src/main/java/org/eclipse/jetty/server/HttpConnection.java
@@ -87,7 +87,7 @@ import org.eclipse.jetty.util.thread.Timeout;
* </p>
*
*/
-public class HttpConnection extends AbstractConnection implements Connection
+public class HttpConnection /* TODO extends AbstractConnection*/ implements Connection
{
private static final int UNKNOWN = -2;
private static final ThreadLocal<HttpConnection> __currentConnection = new ThreadLocal<HttpConnection>();
@@ -142,7 +142,9 @@ public class HttpConnection extends AbstractConnection implements Connection
*/
public HttpConnection(Connector connector, EndPoint endpoint, Server server)
{
- super(endpoint);
+ _endp=endpoint;
+ _timeStamp = System.currentTimeMillis();
+
_uri = StringUtil.__UTF8.equals(URIUtil.__CHARSET)?new HttpURI():new EncodedHttpURI(URIUtil.__CHARSET);
_connector = connector;
HttpBuffers ab = (HttpBuffers)_connector;
@@ -160,7 +162,9 @@ public class HttpConnection extends AbstractConnection implements Connection
protected HttpConnection(Connector connector, EndPoint endpoint, Server server,
Parser parser, Generator generator, Request request)
{
- super(endpoint);
+ _endp=endpoint;
+ _timeStamp = System.currentTimeMillis();
+
_uri = URIUtil.__CHARSET.equals(StringUtil.__UTF8)?new HttpURI():new EncodedHttpURI(URIUtil.__CHARSET);
_connector = connector;
_parser = parser;
@@ -1267,4 +1271,17 @@ public class HttpConnection extends AbstractConnection implements Connection
}
}
+
+
+ // TODO remove and use AbstractConnection for 7.4
+ private final long _timeStamp;
+ protected final EndPoint _endp;
+ public long getTimeStamp()
+ {
+ return _timeStamp;
+ }
+ public EndPoint getEndPoint()
+ {
+ return _endp;
+ }
}

Back to the top