Skip to content

Commit

Permalink
backports from 10.0.x websocket refactor
Browse files Browse the repository at this point in the history
Signed-off-by: Greg Wilkins <gregw@webtide.com>
  • Loading branch information
gregw committed Nov 3, 2018
1 parent 5a17a33 commit 4a9265d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,8 @@ protected void doStart() throws Exception
QueuedThreadPool threadPool = new QueuedThreadPool();
threadPool.setName(name);
executor = threadPool;
addBean(executor);
}
addBean(executor);

if (byteBufferPool == null)
byteBufferPool = new MappedByteBufferPool(2048,
Expand Down Expand Up @@ -796,6 +796,7 @@ public Executor getExecutor()
*/
public void setExecutor(Executor executor)
{
updateBean(this.executor, executor);
this.executor = executor;
}

Expand Down
13 changes: 6 additions & 7 deletions jetty-io/src/main/java/org/eclipse/jetty/io/ChannelEndPoint.java
Original file line number Diff line number Diff line change
Expand Up @@ -229,29 +229,28 @@ public int fill(ByteBuffer buffer) throws IOException
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -403,7 +403,7 @@ public void failed(Throwable x)

public void close()
{
boolean failure=false;
String failure=null;
try(Locker.Lock lock = _locker.lock())
{
switch (_state)
Expand All @@ -418,13 +418,13 @@ public void close()
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));
}

/*
Expand Down

0 comments on commit 4a9265d

Please sign in to comment.