diff --git a/module-client/src/main/java/org/apache/http/conn/ManagedClientConnection.java b/module-client/src/main/java/org/apache/http/conn/ManagedClientConnection.java
index 8f526e65f..262ab9d7b 100644
--- a/module-client/src/main/java/org/apache/http/conn/ManagedClientConnection.java
+++ b/module-client/src/main/java/org/apache/http/conn/ManagedClientConnection.java
@@ -229,5 +229,11 @@ public interface ManagedClientConnection extends
boolean isMarkedReusable()
;
+ void setState(Object state)
+ ;
+
+ boolean isStateful()
+ ;
+
} // interface ManagedClientConnection
diff --git a/module-client/src/main/java/org/apache/http/impl/conn/AbstractPoolEntry.java b/module-client/src/main/java/org/apache/http/impl/conn/AbstractPoolEntry.java
index b1d306fa4..7eeaa7f4e 100644
--- a/module-client/src/main/java/org/apache/http/impl/conn/AbstractPoolEntry.java
+++ b/module-client/src/main/java/org/apache/http/impl/conn/AbstractPoolEntry.java
@@ -75,7 +75,10 @@ public abstract class AbstractPoolEntry {
//@@@ currently accessed from connection manager(s) as attribute
//@@@ avoid that, derived classes should decide whether update is allowed
//@@@ SCCM: yes, TSCCM: no
- protected volatile ConnRoute route;
+ protected volatile HttpRoute route;
+
+ /** Connection state object */
+ protected volatile Object state;
/** The tracked route, or null
before tracking starts. */
protected volatile RouteTracker tracker;
@@ -89,7 +92,7 @@ public abstract class AbstractPoolEntry {
* or null
*/
protected AbstractPoolEntry(OperatedClientConnection occ,
- ConnRoute route) {
+ HttpRoute route) {
this.connection = occ;
this.route = route;
this.tracker = null;
diff --git a/module-client/src/main/java/org/apache/http/impl/conn/AbstractPooledConnAdapter.java b/module-client/src/main/java/org/apache/http/impl/conn/AbstractPooledConnAdapter.java
index 5b54be38f..9a8c19b69 100644
--- a/module-client/src/main/java/org/apache/http/impl/conn/AbstractPooledConnAdapter.java
+++ b/module-client/src/main/java/org/apache/http/impl/conn/AbstractPooledConnAdapter.java
@@ -170,5 +170,16 @@ public abstract class AbstractPooledConnAdapter extends AbstractClientConnAdapte
}
}
+ // non-javadoc, see interface ManagedClientConnection
+ public boolean isStateful() {
+ assertAttached();
+ return poolEntry.state != null;
+ }
+
+ // non-javadoc, see interface ManagedClientConnection
+ public void setState(final Object state) {
+ poolEntry.state = state;
+ }
+
} // class AbstractPooledConnAdapter
diff --git a/module-client/src/main/java/org/apache/http/impl/conn/ConnRoute.java b/module-client/src/main/java/org/apache/http/impl/conn/ConnRoute.java
deleted file mode 100644
index b358799f1..000000000
--- a/module-client/src/main/java/org/apache/http/impl/conn/ConnRoute.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * $HeadURL$
- * $Revision$
- * $Date$
- *
- * ====================================================================
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ====================================================================
- *
- * This software consists of voluntary contributions made by many
- * individuals on behalf of the Apache Software Foundation. For more
- * information on the Apache Software Foundation, please see
- * .
- *
- */
-
-package org.apache.http.impl.conn;
-
-import org.apache.http.conn.routing.HttpRoute;
-import org.apache.http.util.LangUtils;
-
-/**
- * A route for {@link ManagedClientConnection} along with the state information
- * associated with that connection.
- *
- * @author Oleg Kalnichevski
- *
- */
-public class ConnRoute {
-
- private final HttpRoute route;
- private final Object state;
-
- public ConnRoute(final HttpRoute route, final Object state) {
- super();
- if (route == null) {
- throw new IllegalArgumentException("HTTP route may not be null");
- }
- this.route = route;
- this.state = state;
- }
-
- public HttpRoute getRoute() {
- return this.route;
- }
-
- public Object getState() {
- return this.state;
- }
-
- @Override
- public boolean equals(final Object obj) {
- if (obj == null) return false;
- if (this == obj) return true;
- if (obj instanceof ConnRoute) {
- ConnRoute that = (ConnRoute) obj;
- return this.route.equals(that.route)
- && LangUtils.equals(this.state, that.state);
- } else {
- return false;
- }
- }
-
- @Override
- public int hashCode() {
- int hash = LangUtils.HASH_SEED;
- hash = LangUtils.hashCode(hash, this.route);
- hash = LangUtils.hashCode(hash, this.state);
- return hash;
- }
-
- @Override
- public String toString() {
- StringBuilder buffer = new StringBuilder();
- buffer.append(this.route);
- if (this.state != null) {
- buffer.append(" [");
- buffer.append(this.state);
- buffer.append("]");
- }
- return buffer.toString();
- }
-
-}
diff --git a/module-client/src/main/java/org/apache/http/impl/conn/SingleClientConnManager.java b/module-client/src/main/java/org/apache/http/impl/conn/SingleClientConnManager.java
index 34638bafb..1b45f21a2 100644
--- a/module-client/src/main/java/org/apache/http/impl/conn/SingleClientConnManager.java
+++ b/module-client/src/main/java/org/apache/http/impl/conn/SingleClientConnManager.java
@@ -239,7 +239,7 @@ public class SingleClientConnManager implements ClientConnectionManager {
}
}
- managedConn = new ConnAdapter(uniquePoolEntry, new ConnRoute(route, state));
+ managedConn = new ConnAdapter(uniquePoolEntry, route);
return managedConn;
}
@@ -420,11 +420,12 @@ public class SingleClientConnManager implements ClientConnectionManager {
* @param entry the pool entry for the connection being wrapped
* @param plan the planned route for this connection
*/
- protected ConnAdapter(PoolEntry entry, ConnRoute route) {
+ protected ConnAdapter(PoolEntry entry, HttpRoute route) {
super(SingleClientConnManager.this, entry);
markReusable();
entry.route = route;
}
+
}
diff --git a/module-client/src/main/java/org/apache/http/impl/conn/tsccm/AbstractConnPool.java b/module-client/src/main/java/org/apache/http/impl/conn/tsccm/AbstractConnPool.java
index 666a31b77..3214107da 100644
--- a/module-client/src/main/java/org/apache/http/impl/conn/tsccm/AbstractConnPool.java
+++ b/module-client/src/main/java/org/apache/http/impl/conn/tsccm/AbstractConnPool.java
@@ -47,9 +47,9 @@ import org.apache.http.conn.ClientConnectionOperator;
import org.apache.http.conn.ClientConnectionManager;
import org.apache.http.conn.ConnectionPoolTimeoutException;
import org.apache.http.conn.OperatedClientConnection;
+import org.apache.http.conn.routing.HttpRoute;
import org.apache.http.params.HttpParams;
import org.apache.http.impl.conn.IdleConnectionHandler;
-import org.apache.http.impl.conn.ConnRoute;
@@ -209,10 +209,14 @@ public abstract class AbstractConnPool implements RefQueueHandler {
* if the calling thread was interrupted
*/
public final
- BasicPoolEntry getEntry(ConnRoute route, long timeout, TimeUnit tunit,
- ClientConnectionOperator operator)
- throws ConnectionPoolTimeoutException, InterruptedException {
- return newPoolEntryRequest().getPoolEntry(route, timeout, tunit, operator);
+ BasicPoolEntry getEntry(
+ HttpRoute route,
+ Object state,
+ long timeout,
+ TimeUnit tunit,
+ ClientConnectionOperator operator)
+ throws ConnectionPoolTimeoutException, InterruptedException {
+ return newPoolEntryRequest().getPoolEntry(route, state, timeout, tunit, operator);
}
/**
@@ -247,7 +251,7 @@ public abstract class AbstractConnPool implements RefQueueHandler {
//@@@ flag in the BasicPoolEntryRef, to be reset when freed?
final boolean lost = issuedConnections.remove(ref);
if (lost) {
- final ConnRoute route =
+ final HttpRoute route =
((BasicPoolEntryRef)ref).getRoute();
if (LOG.isDebugEnabled()) {
LOG.debug("Connection garbage collected. " + route);
@@ -274,7 +278,7 @@ public abstract class AbstractConnPool implements RefQueueHandler {
*
* @param route the route of the pool entry that was lost
*/
- protected abstract void handleLostEntry(ConnRoute route)
+ protected abstract void handleLostEntry(HttpRoute route)
;
diff --git a/module-client/src/main/java/org/apache/http/impl/conn/tsccm/BasicPoolEntry.java b/module-client/src/main/java/org/apache/http/impl/conn/tsccm/BasicPoolEntry.java
index dc3ff3ffe..3b1d72d80 100644
--- a/module-client/src/main/java/org/apache/http/impl/conn/tsccm/BasicPoolEntry.java
+++ b/module-client/src/main/java/org/apache/http/impl/conn/tsccm/BasicPoolEntry.java
@@ -35,8 +35,8 @@ import java.lang.ref.ReferenceQueue;
import org.apache.http.conn.OperatedClientConnection;
import org.apache.http.conn.ClientConnectionOperator;
+import org.apache.http.conn.routing.HttpRoute;
import org.apache.http.impl.conn.AbstractPoolEntry;
-import org.apache.http.impl.conn.ConnRoute;
@@ -67,7 +67,7 @@ public class BasicPoolEntry extends AbstractPoolEntry {
* or null
*/
public BasicPoolEntry(ClientConnectionOperator op,
- ConnRoute route,
+ HttpRoute route,
ReferenceQueue