Jetty Maxidletime

2019-06-21 04:35发布

问题:

When does maxidletime in jetty get triggered?

回答1:

The maxIdleTime setting is passed to the operating system's Socket handler and becomes the timeout value for that socket. If the other end of the connection keeps the connection alive, the connection will never be closed by the OS. Jetty's Thread will wait for as long as the OS deems the connection to be still 'alive'.



回答2:

The maxIdle time was originally passed to the socket sotimeout. However, now that jetty is asynchronous, it is not strictly used like that because the sotimeout only applies to blocking operations.

Instead the timeout is used in two circumstances:

1) if a connection is idle (no response outstanding), then if that timeout expires the connection will be closed.

2) if an IO operation is being attempted (normally a blocking read or write from a servlet), then the timeout is applied almost as if it were implemented with a blocking socket read and it was an soTimeout - ie if the IO read/write makes no progress for the timeout period, the operation will fail with a TimeoutException.

Note in jetty-9, maxIldeTime has been renamed idleTimeout



标签: Jetty