Merge remote-tracking branch 'origin/jetty-10.0.x' into jetty-11.0.x
This commit is contained in:
commit
dcc58d5606
|
@ -486,7 +486,7 @@ public class ClientConnector extends ContainerLifeCycle
|
|||
catch (Throwable x)
|
||||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("Could not configure {} to {} on {}", option, value, channel);
|
||||
LOG.debug("Could not configure {} to {} on {}", option, value, channel, x);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ import java.net.InetSocketAddress;
|
|||
import java.net.ServerSocket;
|
||||
import java.net.Socket;
|
||||
import java.net.SocketException;
|
||||
import java.net.SocketOption;
|
||||
import java.net.StandardSocketOptions;
|
||||
import java.nio.channels.Channel;
|
||||
import java.nio.channels.SelectableChannel;
|
||||
|
@ -332,10 +333,10 @@ public class ServerConnector extends AbstractNetworkConnector
|
|||
{
|
||||
InetSocketAddress bindAddress = getHost() == null ? new InetSocketAddress(getPort()) : new InetSocketAddress(getHost(), getPort());
|
||||
serverChannel = ServerSocketChannel.open();
|
||||
setSocketOption(serverChannel, StandardSocketOptions.SO_REUSEADDR, getReuseAddress());
|
||||
setSocketOption(serverChannel, StandardSocketOptions.SO_REUSEPORT, isReusePort());
|
||||
try
|
||||
{
|
||||
serverChannel.setOption(StandardSocketOptions.SO_REUSEADDR, getReuseAddress());
|
||||
serverChannel.setOption(StandardSocketOptions.SO_REUSEPORT, isReusePort());
|
||||
serverChannel.bind(bindAddress, getAcceptQueueSize());
|
||||
}
|
||||
catch (Throwable e)
|
||||
|
@ -348,6 +349,19 @@ public class ServerConnector extends AbstractNetworkConnector
|
|||
return serverChannel;
|
||||
}
|
||||
|
||||
private <T> void setSocketOption(ServerSocketChannel channel, SocketOption<T> option, T value)
|
||||
{
|
||||
try
|
||||
{
|
||||
channel.setOption(option, value);
|
||||
}
|
||||
catch (Throwable x)
|
||||
{
|
||||
if (LOG.isDebugEnabled())
|
||||
LOG.debug("Could not configure {} to {} on {}", option, value, channel, x);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue