backports from 10.0.x websocket refactor

Signed-off-by: Greg Wilkins <gregw@webtide.com>
This commit is contained in:
Greg Wilkins 2018-11-03 17:53:32 +01:00
parent 5a17a33045
commit 4a9265d4b4
3 changed files with 13 additions and 13 deletions

View File

@ -212,8 +212,8 @@ 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);
} }
addBean(executor);
if (byteBufferPool == null) if (byteBufferPool == null)
byteBufferPool = new MappedByteBufferPool(2048, byteBufferPool = new MappedByteBufferPool(2048,
@ -796,6 +796,7 @@ public class HttpClient extends ContainerLifeCycle
*/ */
public void setExecutor(Executor executor) public void setExecutor(Executor executor)
{ {
updateBean(this.executor, executor);
this.executor = executor; this.executor = executor;
} }

View File

@ -229,29 +229,28 @@ public abstract class ChannelEndPoint extends AbstractEndPoint implements Manage
return -1; return -1;
int pos=BufferUtil.flipToFill(buffer); int pos=BufferUtil.flipToFill(buffer);
int filled;
try try
{ {
int filled = _channel.read(buffer); filled = _channel.read(buffer);
if (LOG.isDebugEnabled()) // Avoid boxing of variable 'filled'
LOG.debug("filled {} {}", filled, this);
if (filled>0) if (filled>0)
notIdle(); notIdle();
else if (filled==-1) else if (filled==-1)
shutdownInput(); shutdownInput();
return filled;
} }
catch(IOException e) catch(IOException e)
{ {
LOG.debug(e); LOG.debug(e);
shutdownInput(); shutdownInput();
return -1; filled = -1;
} }
finally finally
{ {
BufferUtil.flipToFlush(buffer,pos); BufferUtil.flipToFlush(buffer,pos);
} }
if (LOG.isDebugEnabled())
LOG.debug("filled {} {}", filled, BufferUtil.toDetailString(buffer));
return filled;
} }
@Override @Override

View File

@ -18,7 +18,7 @@
package org.eclipse.jetty.util; package org.eclipse.jetty.util;
import java.nio.channels.ClosedChannelException; import java.io.IOException;
import org.eclipse.jetty.util.thread.Locker; import org.eclipse.jetty.util.thread.Locker;
@ -403,7 +403,7 @@ public abstract class IteratingCallback implements Callback
public void close() public void close()
{ {
boolean failure=false; String failure=null;
try(Locker.Lock lock = _locker.lock()) try(Locker.Lock lock = _locker.lock())
{ {
switch (_state) switch (_state)
@ -418,13 +418,13 @@ public abstract class IteratingCallback implements Callback
break; break;
default: default:
failure=String.format("Close %s in state %s",this,_state);
_state=State.CLOSED; _state=State.CLOSED;
failure=true;
} }
} }
if(failure) if(failure!=null)
onCompleteFailure(new ClosedChannelException()); onCompleteFailure(new IOException(failure));
} }
/* /*