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

View File

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

View File

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