0

I am learning design patterns, and after going through the text book examples, I am focusing on JDK implementation of design patterns.

ReentrantLock class in java.concurrent.Lock package use AbstractQueueSynchronizer(AQS) for providing locking features. I think this is example of Facade pattern, but want to get other's view about this.

Reason why this is Facade is that It provides a simplified interface for dealing with locks, using another subsystem AQS, and AQS can be used directly for other purposes also.

Please put your comments if question is not clear(Simply downvoting does not help )

Adam Arold
  • 29,285
  • 22
  • 112
  • 207
AKS
  • 1,393
  • 3
  • 19
  • 29
  • I wouldn't say that ReentrantLock example of Facade pattern. Take a look at [this question](http://stackoverflow.com/questions/1673841/examples-of-gof-design-patterns) – nkukhar Sep 30 '13 at 08:45
  • You should definitely check [this](http://stackoverflow.com/questions/1673841/examples-of-gof-design-patterns) link. – Adam Arold Oct 01 '13 at 07:54

1 Answers1

0

No its not.

Facade is used to present a single and consistent view to the clients, often callers of a complex big system, so the callers don't have to know anything inside that big system e.g. which module is this request redirect to and that request goes to another module/component etc.

Compare this to your example you would find lock is merely a specific implementation of Lock interface.

Alex Suo
  • 2,977
  • 1
  • 14
  • 22
  • Here in ReentrantLock, caller does not have to know about underlying implementation, they can just go by the contract of Lock interface, and AQS complexity will be dealt by ReentrantLock. so it's Facade,right? – AKS Sep 30 '13 at 11:11