client.close(); is not closing connection to end point immediately. netstat is showing that the connection is open for couple of seconds after client.close call is completed. Is there a way to force close the connection immediately?
This probably is due to the settings of the SO_LINGER value that defines the time between the close()
call and the real closing of the connection.
More info about this socket option can be found in this SO answer , in Java it is possible to set the value with Socket.setSOLinger()
.
I don't know if it is possible to set this value for Jersey, at least I cannot find something in org.glassfish.jersey.client.ClientProperties
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.