Hi Javaranchers,
I am almost done with my assignment but after reading some posts I decided to ask a question about a part of my solution that doesn't seem to be in line with what others have done.
I have URLyBird (1.1.3) and my area of concern is how the server is handling client connections. I have a single instance of Data in both the server and alone modes. I have another class that I called "ClientConnection" which is in charge of handling client (remote) requests and interfacing with the only instance of Data to fulfill them. (My server only provides the following services to clients: find records based on criteria, obtain the database scheme and book a record - I think it is called thin client here).
Now my concern. I have only one instance of "ClientConnection" and a reference to this object is passed to every client requesting it. The client can then use this reference to make booking or searching requests to the server. Most people here seems to have implemented a
thread per client and they even keep track of connected clients.
I have done some light
testing and having only one "ClientConnection" instance at the server doesn't seem to be a problem. Two clients can obtain the reference to this instance and send requests to the server. I know that for a more scalable server multiple threads would be probably the way to go but isn't my approach acceptable for a small number of clients?
In fact I do not use multiple threads whatsoever in my design. I used them only for testing but there are no multiple threads in any of the official modes, clien, standalone or server. Should I have used them somewhere?
I am planning on performing stress testing on the server by automatically generating multiple client requests in multiple machines and I might end up uncovering issues then.
Is there a limit on the number of times the reference to my only instance of the 'ClientConnection' object can be passed to clients?
Thanks a lot for your thoughts, comments and questions,
Ed