My question is that isn't there any possiblity of 2 or more threads can execute statements belonging to if?
Shouldn't we put one more check after if statement? Something like (I do not know, just suggestion)
"Although the DvdFileAccess class is not a singleton..."
In addtion, if we were to make the DvdFileAccess class a singleton, any class that uses the DvdFile Access class
would have to be coded differently than if it is a standard class - if we were later to decide that the same class can
be used to process multiple data files (with some simple modifications)...
...
As mentionned earlier, DvdDatabase is the facade through which all other classes should access data,. Therefor, no other classes should call DvdFileAccess directly.
Just wondering, where would the caller be? I mean, you explain about a synchronized block and a getInstance()
method. Would that be in the client for example or elsewhere in the code from the book?
And then we all jump out and yell "surprise! we got you this tiny ad!"
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
|