| Author |
Design Question...
|
Daniel Pereira
Greenhorn
Joined: May 31, 2006
Posts: 2
|
|
I'm not planning on sending my solution to Sun like this, but if I synchronize a singleton data object like so: synchronized (myData) { switch(request.getAction()){ CASE SEARCH: myData.search_method... break; CASE UPDATE: myData.update_method... break; } } Wouldn't locking and unlocking individual records be redundant? Would I fail if I implemented the lock methods and called them even though concurrent threads would never be able to access the same record because they'd have to queue up through a synchronized bottleneck switch? Opinions? Is there a race condition scenario I'm not thinking about? I understand that I *must* implement locking the way described in the interface, but for a low-volume application this design seems like an arguable solution. DP
|
 |
 |
|
|
subject: Design Question...
|
|
|