are we supposed to call close method in Data class in local mode when exiting the application or just set the client side objects to null hoping that garbage collector will call finalize method in Data class which in turn calls close method ?? Thanks
Definitely call close(). Finalizers are only run when you call System.runFinalizersOnExit(true), and this method is deprecated because daemon threads might still be running against the objects undergoing finalization. This may cause deadlocks and all kinds of weird behaviour. And even if it would work, relying on finalizers is bad style imho. Not only that, you should call close() in remote mode as well. After all, local and remote objects are implementing the same interface, that should imply they are used in the same way too. - Peter
If a client callsclose remotely, won't that close the database on the server which means other clients will no longer able to access the database?
Peter den Haan
posted 18 years ago
Originally posted by Richard Walter: If a client callsclose remotely, won't that close the database on the server which means other clients will no longer able to access the database?
Ha I'm saying remote clients should call close(). That does not mean that this call should cause the Data object on the server to be close()d. Put differently, the meaning (semantics) of the interface should be the same no matter if it's local or remote. The way in which the methods are implemented is rather different in places. More to the point, what does close() do? Don't be tempted to say "it closes the database file". That's what it happens to do in one particular implementation of the interface: the local Data class. In general, it indicates that the client has finished using the database, and releases the resources held for that client. In local mode, the resource in question is the database file itself. In remote mode, the file is a shared resource that cannot be released; in response to a client calling close() in networked mode, the server could perform some basic cleanup tasks, like removing any outstanding locks for that client. Should you have entangled local and networked mode in one and the same Data class, you're now finding out why that was a bad design decision - Peter [This message has been edited by Peter den Haan (edited November 14, 2001).]
Barry's not gonna like this. Barry's not gonna like this one bit. What is Barry's deal with tiny ads?