可以在jetty里面设的
org.mortbay.jetty.nio.SelectChannelConnector#setMaxIdleTime()方法就是设socket通信的过期时间
javaDoc是这样的:
Description copied from class: AbstractConnector
Set the maximum Idle time for a connection, which roughly translates to the Socket.setSoTimeout(int) call, although with NIO implementations other mechanisms may be used to implement the timeout. The max idle time is applied:
When waiting for a new request to be received on a connection
When reading the headers and content of a request
When writing the headers and content of a response
Jetty interprets this value as the maximum time between some progress being made on the connection. So if a single byte is read or written, then the timeout (if implemented by jetty) is reset. However, in many instances, the reading/writing is delegated to the JVM, and the semantic is more strictly enforced as the maximum time a single read/write operation can take. Note, that as Jetty supports writes of memory mapped file buffers, then a write may take many 10s of seconds for large content written to a slow device.
Previously, Jetty supported separate idle timeouts and IO operation timeouts, however the expense of changing the value of soTimeout was significant, so these timeouts were merged. With the advent of NIO, it may be possible to again differentiate these values (if there is demand).
所以只需要在xml配置文件里面设定这个值就可以了