I've recently joined up for my SCJD exam and have been reading the many various interesting posts.
I have a couple of questions - sorry if they have been answered before.
I've decided to use the many instances of the Data class, and hold a static list of recIds that are currently locked. (as in M Habbibi's book). In my exam i'm told that Data must implement DBMain
1) Does this mean that I can't create an adapter class, which implements DBmain, and then have a reference to Data from the Adapter? How else could I get round this? I suppose I could have a DataManager which deals with locking etc.. with a reference to Data and note in the documentation that any new developments should use the DataManager class.
2) If I synchronize the list of RecIds, in the lock and unlock methods why would I need the isLocked method ?
Thanks v much Phil
SCJP 1.4<br />SCJD (Ongoing)
Philippe Maquet
Bartender
Joined: Jun 02, 2003
Posts: 1872
posted
0
Hi Phil,
Does this mean that I can't create an adapter class, which implements DBmain, and then have a reference to Data from the Adapter? How else could I get round this?
Your adapter could not implement DBmain and own a reference to Data which implements it. Where is the issue?
If I synchronize the list of RecIds, in the lock and unlock methods why would I need the isLocked method ?
Do you have an isLocked() method in your interface? (in my version there is no isLocked()).
Regards,
Phil.
Phil Harron
Greenhorn
Joined: Jun 21, 2002
Posts: 29
posted
0
Thanks Phil
Do you have an isLocked() method in your interface? (in my version there is no isLocked()).
Yes I have an isLocked() method in my interface. If I synchronize my static list in the lock() and unLock() methods then the JVM will know if its locked or not? I know I must implement the isLocked() method, but I dont want to do it for no good reason.
Your adapter could not implement DBmain and own a reference to Data which implements it. Where is the issue?
So, do you mean that Data could implement DBMain and my Adapter could implement DBMain as well?
Thanks again for your help
[ May 14, 2004: Message edited by: Phil Harron ] [ May 14, 2004: Message edited by: Phil Harron ]
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.