java - What happens if a thread opens a socket and the main program exits? -


this question has answer here:

what happens if thread opens socket , main program exits? have seen threads run second or 2 after main program exits, socket thread opened closed when main program exits, or when thread cleans dies?

when program (ie. jvm process) stops, resources released. if there system.exit() call made, jvm stops. if on other hand, main thread finish execution, jvm continues run until there no more non-daemon threads running. if thread handles socket communication non-daemon thread, continue run.


Comments

Popular posts from this blog

How to access named pipes using JavaScript in Firefox add-on? -

multithreading - OPAL (Open Phone Abstraction Library) Transport not terminated when reattaching thread? -

node.js - req param returns an empty array -