To implement a production level java socket server, what are the potential gotchas that I have to be aware of?
For now I have got a basic code structure using the ServerSocket
and Socket
classes of core java.net
package. The server waits for a client and spawns a new thread for it.
I was wondering whether this is the way to go or are there other issues that I have to consider before launching the code out in the wild.
A few things that I have thought of with my limited knowledge and experience is:
- Client disconnection detection and releasing client resources.
- Connection pooling, is this necessary or should I stick to the existing design.
- Server monitoring, logging and error recovery etc.
- Go with ready made framework like Apache Mina..??
What does your experience have to say?...