Skip to content

Tag: shutdown-hook

Is shutdown-hook a good practice?

I have a Service that makes requests via a RestClient. What is the Java best practice between: Opening and closing the connection every time I make a request Opening the connection at class initialization and closing it in a ShutdownHook Something I didn’t think of Answer What is the Java best practice …

Java detect when application is closing

I learned Java for about 1 year some years ago. Now I wanted to go back to it, but my skills got a bit rusty. So I’m using Eclipse with the WindowBuilder to make an easy Form Application to get started again. I wanted to get a popup window when I exit the application because in future projects I need

How netbeans stops a run?

I’m programming with Java in Linux using Netbeans 7 and as my program (sometimes) could not exit (not in this eon, maybe) I create a thread to handle shutdown But when I launch the code with netbeans (F6) and stop it through the “STOP” button the thread is not created; but if I run the progr…