Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

facade pattern

 
Maksym Odintsov
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys. I wanted to ask whether I need to implement this pattern in my case or could I live without it ?
My interface for the data class provides following lock method

>>public long lock(int recNo) throws RecordNotFoundException;

So in order to throw recordnotfoundexception I have to access the database file. And I think locking class in facade pattern must provide only locking, but not accessing the database.
If I will not throw this exception in the lock method, than delete and update methods will have to unlock record before throwing RecordNotFoundException. If they will not unlock the record then the exception will be trown and threads that have been already locked will stay locked forever. So in this case my data accessing class will be using unlock method from the lockmanager class.

So in both cases one class in facade pattern will have to use functionallity of another class.
So can I do it all in one class without this facade pattern ?
 
Kevin Florish
Ranch Hand
Posts: 182
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Maksym.

I didn't use a seperate class for locking.

My lock and unlock methods are done as part of my Data class implementation, I dont provide a sperate lockManager class as I feel its unnecessary for the project.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic