Merged branch 'jetty-9.4.x' into 'jetty-10.0.x'.

This commit is contained in:
Simone Bordet 2020-05-08 15:23:00 +02:00
commit 63bfb43b2f
6 changed files with 109 additions and 1 deletions

View File

@ -38,6 +38,10 @@
<Set name="idleTimeout"><Property name="jetty.http.idleTimeout" default="30000"/></Set>
<Set name="acceptorPriorityDelta" property="jetty.http.acceptorPriorityDelta" />
<Set name="acceptQueueSize" property="jetty.http.acceptQueueSize" />
<Set name="reuseAddress"><Property name="jetty.http.reuseAddress" default="true"/></Set>
<Set name="acceptedTcpNoDelay"><Property name="jetty.http.acceptedTcpNoDelay" default="true"/></Set>
<Set name="acceptedReceiveBufferSize" property="jetty.http.acceptedReceiveBufferSize" />
<Set name="acceptedSendBufferSize" property="jetty.http.acceptedSendBufferSize" />
<Get name="SelectorManager">
<Set name="connectTimeout"><Property name="jetty.http.connectTimeout" default="15000"/></Set>
</Get>

View File

@ -31,6 +31,10 @@
<Set name="idleTimeout"><Property name="jetty.ssl.idleTimeout" default="30000"/></Set>
<Set name="acceptorPriorityDelta" property="jetty.ssl.acceptorPriorityDelta"/>
<Set name="acceptQueueSize" property="jetty.ssl.acceptQueueSize"/>
<Set name="reuseAddress"><Property name="jetty.ssl.reuseAddress" default="true"/></Set>
<Set name="acceptedTcpNoDelay"><Property name="jetty.ssl.acceptedTcpNoDelay" default="true"/></Set>
<Set name="acceptedReceiveBufferSize" property="jetty.ssl.acceptedReceiveBufferSize" />
<Set name="acceptedSendBufferSize" property="jetty.ssl.acceptedSendBufferSize" />
<Get name="SelectorManager">
<Set name="connectTimeout" property="jetty.ssl.connectTimeout"/>
</Get>

View File

@ -39,5 +39,20 @@ etc/jetty-http.xml
## Thread priority delta to give to acceptor threads
# jetty.http.acceptorPriorityDelta=0
## The requested maximum length of the queue of incoming connections.
# jetty.http.acceptQueueSize=0
## Enable/disable the SO_REUSEADDR socket option.
# jetty.http.reuseAddress=true
## Enable/disable TCP_NODELAY on accepted sockets.
# jetty.http.acceptedTcpNoDelay=true
## The SO_RCVBUF option to set on accepted sockets. A value of -1 indicates that it is left to its default value.
# jetty.http.acceptedReceiveBufferSize=-1
## The SO_SNDBUF option to set on accepted sockets. A value of -1 indicates that it is left to its default value.
# jetty.http.acceptedSendBufferSize=-1
## Connect Timeout in milliseconds
# jetty.http.connectTimeout=15000

View File

@ -40,6 +40,21 @@ etc/jetty-ssl-context.xml
## Thread priority delta to give to acceptor threads
# jetty.ssl.acceptorPriorityDelta=0
## The requested maximum length of the queue of incoming connections.
# jetty.ssl.acceptQueueSize=0
## Enable/disable the SO_REUSEADDR socket option.
# jetty.ssl.reuseAddress=true
## Enable/disable TCP_NODELAY on accepted sockets.
# jetty.ssl.acceptedTcpNoDelay=true
## The SO_RCVBUF option to set on accepted sockets. A value of -1 indicates that it is left to its default value.
# jetty.ssl.acceptedReceiveBufferSize=-1
## The SO_SNDBUF option to set on accepted sockets. A value of -1 indicates that it is left to its default value.
# jetty.ssl.acceptedSendBufferSize=-1
## Connect Timeout in milliseconds
# jetty.ssl.connectTimeout=15000

View File

@ -82,6 +82,9 @@ public class ServerConnector extends AbstractNetworkConnector
private volatile int _localPort = -1;
private volatile int _acceptQueueSize = 0;
private volatile boolean _reuseAddress = true;
private volatile boolean _acceptedTcpNoDelay = true;
private volatile int _acceptedReceiveBufferSize = -1;
private volatile int _acceptedSendBufferSize = -1;
/**
* <p>Construct a ServerConnector with a private instance of {@link HttpConnectionFactory} as the only factory.</p>
@ -396,7 +399,11 @@ public class ServerConnector extends AbstractNetworkConnector
{
try
{
socket.setTcpNoDelay(true);
socket.setTcpNoDelay(_acceptedTcpNoDelay);
if (_acceptedReceiveBufferSize > -1)
socket.setReceiveBufferSize(_acceptedReceiveBufferSize);
if (_acceptedSendBufferSize > -1)
socket.setSendBufferSize(_acceptedSendBufferSize);
}
catch (SocketException e)
{
@ -451,6 +458,7 @@ public class ServerConnector extends AbstractNetworkConnector
* @return whether the server socket reuses addresses
* @see ServerSocket#getReuseAddress()
*/
@ManagedAttribute("Server Socket SO_REUSEADDR")
public boolean getReuseAddress()
{
return _reuseAddress;
@ -465,6 +473,67 @@ public class ServerConnector extends AbstractNetworkConnector
_reuseAddress = reuseAddress;
}
/**
* @return whether the accepted socket gets {@link java.net.SocketOptions#TCP_NODELAY TCP_NODELAY} enabled.
* @see Socket#getTcpNoDelay()
*/
@ManagedAttribute("Accepted Socket TCP_NODELAY")
public boolean getAcceptedTcpNoDelay()
{
return _acceptedTcpNoDelay;
}
/**
* @param tcpNoDelay whether {@link java.net.SocketOptions#TCP_NODELAY TCP_NODELAY} gets enabled on the the accepted socket.
* @see Socket#setTcpNoDelay(boolean)
*/
public void setAcceptedTcpNoDelay(boolean tcpNoDelay)
{
this._acceptedTcpNoDelay = tcpNoDelay;
}
/**
* @return the {@link java.net.SocketOptions#SO_RCVBUF SO_RCVBUF} size to set onto the accepted socket.
* A value of -1 indicates that it is left to its default value.
* @see Socket#getReceiveBufferSize()
*/
@ManagedAttribute("Accepted Socket SO_RCVBUF")
public int getAcceptedReceiveBufferSize()
{
return _acceptedReceiveBufferSize;
}
/**
* @param receiveBufferSize the {@link java.net.SocketOptions#SO_RCVBUF SO_RCVBUF} size to set onto the accepted socket.
* A value of -1 indicates that it is left to its default value.
* @see Socket#setReceiveBufferSize(int)
*/
public void setAcceptedReceiveBufferSize(int receiveBufferSize)
{
this._acceptedReceiveBufferSize = receiveBufferSize;
}
/**
* @return the {@link java.net.SocketOptions#SO_SNDBUF SO_SNDBUF} size to set onto the accepted socket.
* A value of -1 indicates that it is left to its default value.
* @see Socket#getSendBufferSize()
*/
@ManagedAttribute("Accepted Socket SO_SNDBUF")
public int getAcceptedSendBufferSize()
{
return _acceptedSendBufferSize;
}
/**
* @param sendBufferSize the {@link java.net.SocketOptions#SO_SNDBUF SO_SNDBUF} size to set onto the accepted socket.
* A value of -1 indicates that it is left to its default value.
* @see Socket#setSendBufferSize(int)
*/
public void setAcceptedSendBufferSize(int sendBufferSize)
{
this._acceptedSendBufferSize = sendBufferSize;
}
@Override
public void setAccepting(boolean accepting)
{

View File

@ -48,6 +48,7 @@ public class ShutdownThread extends Thread
*/
private ShutdownThread()
{
super("JettyShutdownThread");
}
private synchronized void hook()