JVM abnormal output - cleaning system resources

I have a java program that listens on a socket server endlessly. In case the JVM exits anonymously through kill pid, what happens to the system resources in this case, the socket object? Will the connectors be released or will they be blocked?

What is the best way to handle cleaning up system resources, such as file descriptors / network connection / socket / jdbc, in the event of an abnormal JVM exit.

I know about finalizers, finally, but there is some uncertainty and performance degradation using finalization.

Pls provide some ideas

+3
source share
2 answers

, JVM , , . .

, , , , . ( JDBC ).

, JVM .

+4

, , , JVM. , - .

JDBC , , . Keep-alive . .

+1

Source: https://habr.com/ru/post/1766898/


All Articles