Fixes JETTY-1335 (HttpClient's SelectConnector clean-up)
git-svn-id: svn+ssh://dev.eclipse.org/svnroot/rt/org.eclipse.jetty/jetty/trunk@2815 7e9141cc-0065-0410-87d8-b60c137991c4
This commit is contained in:
parent
22e142a871
commit
0ace68632c
|
@ -15,6 +15,7 @@ jetty-7.3.1-SNAPSHOT
|
||||||
+ 337746 Fixed Session deIdle recursion
|
+ 337746 Fixed Session deIdle recursion
|
||||||
+ 337784 Improve HashSessionManager for session migrations
|
+ 337784 Improve HashSessionManager for session migrations
|
||||||
+ JETTY-1331 Allow alternate XML configuration processors (eg spring)
|
+ JETTY-1331 Allow alternate XML configuration processors (eg spring)
|
||||||
|
+ JETTY-1335 HttpClient's SelectConnector clean-up
|
||||||
|
|
||||||
jetty-7.3.0.v20110203 3 February 2011
|
jetty-7.3.0.v20110203 3 February 2011
|
||||||
+ JETTY-1259 NullPointerException in JDBCSessionIdManager when invalidating session (further update)
|
+ JETTY-1259 NullPointerException in JDBCSessionIdManager when invalidating session (further update)
|
||||||
|
|
|
@ -22,7 +22,6 @@ import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ConcurrentMap;
|
import java.util.concurrent.ConcurrentMap;
|
||||||
|
|
||||||
import javax.net.ssl.SSLContext;
|
import javax.net.ssl.SSLContext;
|
||||||
|
|
||||||
import org.eclipse.jetty.client.security.Authentication;
|
import org.eclipse.jetty.client.security.Authentication;
|
||||||
|
@ -75,7 +74,7 @@ public class HttpClient extends HttpBuffers implements Attributes
|
||||||
|
|
||||||
private int _connectorType = CONNECTOR_SELECT_CHANNEL;
|
private int _connectorType = CONNECTOR_SELECT_CHANNEL;
|
||||||
private boolean _useDirectBuffers = true;
|
private boolean _useDirectBuffers = true;
|
||||||
private boolean _asyncConnects = false;
|
private boolean _connectBlocking = true;
|
||||||
private int _maxConnectionsPerAddress = Integer.MAX_VALUE;
|
private int _maxConnectionsPerAddress = Integer.MAX_VALUE;
|
||||||
private ConcurrentMap<Address, HttpDestination> _destinations = new ConcurrentHashMap<Address, HttpDestination>();
|
private ConcurrentMap<Address, HttpDestination> _destinations = new ConcurrentHashMap<Address, HttpDestination>();
|
||||||
ThreadPool _threadPool;
|
ThreadPool _threadPool;
|
||||||
|
@ -112,9 +111,9 @@ public class HttpClient extends HttpBuffers implements Attributes
|
||||||
/**
|
/**
|
||||||
* @return True if connects will be in blocking mode.
|
* @return True if connects will be in blocking mode.
|
||||||
*/
|
*/
|
||||||
public boolean isAsyncConnects()
|
public boolean isConnectBlocking()
|
||||||
{
|
{
|
||||||
return _asyncConnects;
|
return _connectBlocking;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------------------- */
|
||||||
|
@ -123,7 +122,7 @@ public class HttpClient extends HttpBuffers implements Attributes
|
||||||
*/
|
*/
|
||||||
public void setAsyncConnects(boolean blockingConnects)
|
public void setAsyncConnects(boolean blockingConnects)
|
||||||
{
|
{
|
||||||
_asyncConnects = blockingConnects;
|
_connectBlocking = blockingConnects;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------------------------- */
|
/* ------------------------------------------------------------------------------- */
|
||||||
|
|
|
@ -19,7 +19,6 @@ import java.nio.channels.SelectionKey;
|
||||||
import java.nio.channels.SocketChannel;
|
import java.nio.channels.SocketChannel;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import javax.net.ssl.SSLContext;
|
import javax.net.ssl.SSLContext;
|
||||||
import javax.net.ssl.SSLEngine;
|
import javax.net.ssl.SSLEngine;
|
||||||
import javax.net.ssl.SSLSession;
|
import javax.net.ssl.SSLSession;
|
||||||
|
@ -49,7 +48,6 @@ class SelectConnector extends AbstractLifeCycle implements HttpClient.Connector,
|
||||||
private final Map<SocketChannel, Timeout.Task> _connectingChannels = new ConcurrentHashMap<SocketChannel, Timeout.Task>();
|
private final Map<SocketChannel, Timeout.Task> _connectingChannels = new ConcurrentHashMap<SocketChannel, Timeout.Task>();
|
||||||
private SSLContext _sslContext;
|
private SSLContext _sslContext;
|
||||||
private Buffers _sslBuffers;
|
private Buffers _sslBuffers;
|
||||||
private boolean _blockingConnect;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param httpClient
|
* @param httpClient
|
||||||
|
@ -59,24 +57,6 @@ class SelectConnector extends AbstractLifeCycle implements HttpClient.Connector,
|
||||||
_httpClient = httpClient;
|
_httpClient = httpClient;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
|
||||||
/** Get the blockingConnect.
|
|
||||||
* @return the blockingConnect
|
|
||||||
*/
|
|
||||||
public boolean isBlockingConnect()
|
|
||||||
{
|
|
||||||
return _blockingConnect;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
|
||||||
/** Set the blockingConnect.
|
|
||||||
* @param blockingConnect If true, connections are made in blocking mode.
|
|
||||||
*/
|
|
||||||
public void setBlockingConnect(boolean blockingConnect)
|
|
||||||
{
|
|
||||||
_blockingConnect = blockingConnect;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
@Override
|
@Override
|
||||||
protected void doStart() throws Exception
|
protected void doStart() throws Exception
|
||||||
|
@ -85,7 +65,7 @@ class SelectConnector extends AbstractLifeCycle implements HttpClient.Connector,
|
||||||
_connectTimer.setDuration(_httpClient.getConnectTimeout());
|
_connectTimer.setDuration(_httpClient.getConnectTimeout());
|
||||||
_connectTimer.setNow();
|
_connectTimer.setNow();
|
||||||
|
|
||||||
if (_httpClient.isAsyncConnects())
|
if (!_httpClient.isConnectBlocking())
|
||||||
{
|
{
|
||||||
_httpClient._threadPool.dispatch(new Runnable()
|
_httpClient._threadPool.dispatch(new Runnable()
|
||||||
{
|
{
|
||||||
|
@ -170,7 +150,7 @@ class SelectConnector extends AbstractLifeCycle implements HttpClient.Connector,
|
||||||
Address address = destination.isProxied() ? destination.getProxy() : destination.getAddress();
|
Address address = destination.isProxied() ? destination.getProxy() : destination.getAddress();
|
||||||
channel.socket().setTcpNoDelay(true);
|
channel.socket().setTcpNoDelay(true);
|
||||||
|
|
||||||
if (_httpClient.isAsyncConnects())
|
if (!_httpClient.isConnectBlocking())
|
||||||
{
|
{
|
||||||
channel.configureBlocking( false );
|
channel.configureBlocking( false );
|
||||||
channel.connect(address.toSocketAddress());
|
channel.connect(address.toSocketAddress());
|
||||||
|
|
Loading…
Reference in New Issue