Close resources before exiting JFrame and TCP communication in Java
Posted
by
Oz Molaim
on Stack Overflow
See other posts from Stack Overflow
or by Oz Molaim
Published on 2011-04-16T21:41:50Z
Indexed on
2012/03/20
17:29 UTC
Read the original article
Hit count: 279
1. I'm writing a chat based application on TCP communication. I'm using NetBeans and I want to add functionality to the default EXIT_ON_CLOSE when exiting JFrame. The reason of course is because I want to clean resources and end threads safely. How can I call a method that clear resources and only then close the JFrame safely and end the process.
2. I need to implement the server side. The server has List/HashMap/Queue of 'Socket' with their chat nick-names. Is there any simple design pattern to do it correctly because I don't want to re-invent the wheel.
thanks.
© Stack Overflow or respective owner