Since close is public method, If the client code close the database by calling the method, the server database can not support the other clients. For my code,I close the database in the server and I do not close database in the client. but method close is public method, do we need to do something on it for the client to close the database? Thanks,
I was thinking in this way! Use a SingleTon to open and close the data file. The data file may be opened when the first request from the client comes to the server or during server startup (is not the former logical?). And close the data file during server shut down or when the current active client request count is zero (is not the later logical?).
Ashik Uzzaman Lead Member of Technical Staff, Salesforce.com, San Francisco, CA, USA.
Joined: Jul 24, 2002
Thanks, the current active client request count is zero This means that the client who close the database can still access the database if the count is not zero. unless we have a static set in the server to store all connected client... too complicated?
Well, I haven't decided on it yet. But it may be like ---- One client accesses the file, reads/writes and the server decides whether the file should be closed now depending on whether any other client is still working on that file. If none, close the file else let it remain opended. Repeat it in a loop till the active client count is zero and when zero close the file.
My server opens the DB file when it starts up and closes the DB file when it shuts down. A server is a server... Even if no clients are connected, there is no reason to close the DB... Imagine a web server closing a back-end DB because no clients have made a request :roll:
Actually what Valentin said is correct. Even though it is public, its purpose is for the server to open and close that database at startup and shutdown. Just don't have the client call close and you are fine. Mark