Revert backport of HttpClient executor bean handling. (#3088)
Revert to the not-so-good bean handling for the HttpClient executor Added TODOs so that the bean handling can be updated in future. Deprecated Websocket client setters that hide dependency on internal HttpClient instance. Signed-off-by: Greg Wilkins <gregw@webtide.com>
This commit is contained in:
parent
027cc240ca
commit
59dffebd1c
|
@ -204,6 +204,7 @@ public class HttpClient extends ContainerLifeCycle
|
||||||
@Override
|
@Override
|
||||||
protected void doStart() throws Exception
|
protected void doStart() throws Exception
|
||||||
{
|
{
|
||||||
|
// TODO use #addBean in constructor?
|
||||||
if (sslContextFactory != null)
|
if (sslContextFactory != null)
|
||||||
addBean(sslContextFactory);
|
addBean(sslContextFactory);
|
||||||
|
|
||||||
|
@ -212,18 +213,21 @@ public class HttpClient extends ContainerLifeCycle
|
||||||
QueuedThreadPool threadPool = new QueuedThreadPool();
|
QueuedThreadPool threadPool = new QueuedThreadPool();
|
||||||
threadPool.setName(name);
|
threadPool.setName(name);
|
||||||
executor = threadPool;
|
executor = threadPool;
|
||||||
addBean(executor);
|
|
||||||
}
|
}
|
||||||
|
// TODO use #updateBean in #setExecutor
|
||||||
|
addBean(executor);
|
||||||
|
|
||||||
if (byteBufferPool == null)
|
if (byteBufferPool == null)
|
||||||
byteBufferPool = new MappedByteBufferPool(2048,
|
byteBufferPool = new MappedByteBufferPool(2048,
|
||||||
executor instanceof ThreadPool.SizedThreadPool
|
executor instanceof ThreadPool.SizedThreadPool
|
||||||
? ((ThreadPool.SizedThreadPool)executor).getMaxThreads()/2
|
? ((ThreadPool.SizedThreadPool)executor).getMaxThreads()/2
|
||||||
: ProcessorUtils.availableProcessors()*2);
|
: ProcessorUtils.availableProcessors()*2);
|
||||||
|
// TODO use #updateBean in #setByteBufferPool?
|
||||||
addBean(byteBufferPool);
|
addBean(byteBufferPool);
|
||||||
|
|
||||||
if (scheduler == null)
|
if (scheduler == null)
|
||||||
scheduler = new ScheduledExecutorScheduler(name + "-scheduler", false);
|
scheduler = new ScheduledExecutorScheduler(name + "-scheduler", false);
|
||||||
|
// TODO use #updateBean in #setScheduler?
|
||||||
addBean(scheduler);
|
addBean(scheduler);
|
||||||
|
|
||||||
transport.setHttpClient(this);
|
transport.setHttpClient(this);
|
||||||
|
@ -796,7 +800,8 @@ public class HttpClient extends ContainerLifeCycle
|
||||||
*/
|
*/
|
||||||
public void setExecutor(Executor executor)
|
public void setExecutor(Executor executor)
|
||||||
{
|
{
|
||||||
updateBean(this.executor, executor);
|
if (isRunning())
|
||||||
|
LOG.warn("setExecutor called when in {} state",getState());
|
||||||
this.executor = executor;
|
this.executor = executor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -603,9 +603,9 @@ public class WebSocketClient extends ContainerLifeCycle implements WebSocketCont
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param bindAddress
|
* @param bindAddress the address to bind to
|
||||||
* the address to bind to
|
* @deprecated (this is a bad bad bad typo) use {@link HttpClient#setBindAddress(SocketAddress)}
|
||||||
* @deprecated (this is a bad bad bad typo) use {@link #setBindAddress(SocketAddress)} instead
|
* on instance passed to {@link #WebSocketClient(HttpClient)}
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public void setBindAdddress(SocketAddress bindAddress)
|
public void setBindAdddress(SocketAddress bindAddress)
|
||||||
|
@ -613,11 +613,23 @@ public class WebSocketClient extends ContainerLifeCycle implements WebSocketCont
|
||||||
setBindAddress(bindAddress);
|
setBindAddress(bindAddress);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param bindAddress the address to bind to
|
||||||
|
* @deprecated Use {@link HttpClient#setBindAddress(SocketAddress)}
|
||||||
|
* on instance passed to {@link #WebSocketClient(HttpClient)}
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public void setBindAddress(SocketAddress bindAddress)
|
public void setBindAddress(SocketAddress bindAddress)
|
||||||
{
|
{
|
||||||
this.httpClient.setBindAddress(bindAddress);
|
this.httpClient.setBindAddress(bindAddress);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param bufferPool The buffer pool
|
||||||
|
* @deprecated Use {@link HttpClient#setByteBufferPool(ByteBufferPool)}
|
||||||
|
* on the instance passed to {@link #WebSocketClient(HttpClient)}
|
||||||
|
*/
|
||||||
public void setBufferPool(ByteBufferPool bufferPool)
|
public void setBufferPool(ByteBufferPool bufferPool)
|
||||||
{
|
{
|
||||||
this.httpClient.setByteBufferPool(bufferPool);
|
this.httpClient.setByteBufferPool(bufferPool);
|
||||||
|
@ -625,15 +637,21 @@ public class WebSocketClient extends ContainerLifeCycle implements WebSocketCont
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the timeout for connecting to the remote server.
|
* Set the timeout for connecting to the remote server.
|
||||||
*
|
* @param ms the timeout in millisecondspool
|
||||||
* @param ms
|
* @deprecated Use {@link HttpClient#setConnectTimeout(long)}
|
||||||
* the timeout in milliseconds
|
* on the instance passed to {@link #WebSocketClient(HttpClient)}
|
||||||
*/
|
*/
|
||||||
public void setConnectTimeout(long ms)
|
public void setConnectTimeout(long ms)
|
||||||
{
|
{
|
||||||
this.httpClient.setConnectTimeout(ms);
|
this.httpClient.setConnectTimeout(ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param cookieStore The cookie store
|
||||||
|
* @deprecated Use {@link HttpClient#setCookieStore(CookieStore)} on the HttpClient instance passed
|
||||||
|
* to {@link #WebSocketClient(HttpClient)}
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public void setCookieStore(CookieStore cookieStore)
|
public void setCookieStore(CookieStore cookieStore)
|
||||||
{
|
{
|
||||||
this.httpClient.setCookieStore(cookieStore);
|
this.httpClient.setCookieStore(cookieStore);
|
||||||
|
@ -655,6 +673,12 @@ public class WebSocketClient extends ContainerLifeCycle implements WebSocketCont
|
||||||
this.httpClient.setDispatchIO(dispatchIO);
|
this.httpClient.setDispatchIO(dispatchIO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param executor The executor to use
|
||||||
|
* @deprecated Use {@link HttpClient#setExecutor(Executor)}
|
||||||
|
* on the instance passed to {@link #WebSocketClient(HttpClient)}
|
||||||
|
*/
|
||||||
|
@Deprecated
|
||||||
public void setExecutor(Executor executor)
|
public void setExecutor(Executor executor)
|
||||||
{
|
{
|
||||||
this.httpClient.setExecutor(executor);
|
this.httpClient.setExecutor(executor);
|
||||||
|
@ -680,8 +704,7 @@ public class WebSocketClient extends ContainerLifeCycle implements WebSocketCont
|
||||||
* <p>
|
* <p>
|
||||||
* Existing connections will not have their max idle timeout adjusted.
|
* Existing connections will not have their max idle timeout adjusted.
|
||||||
*
|
*
|
||||||
* @param ms
|
* @param ms the timeout in milliseconds
|
||||||
* the timeout in milliseconds
|
|
||||||
*/
|
*/
|
||||||
public void setMaxIdleTimeout(long ms)
|
public void setMaxIdleTimeout(long ms)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue