Saturday, 10 August 2013

Double-checked locking Design Pattern - Implementation


Click here to watch in Youtube : https://www.youtube.com/watch?v=nL2n_NCl7TA

Click the below Image to Enlarge
Double-checked locking Design Pattern - Implementation














See also:

  • All Design Patterns Links
  • 1 comment:

    1. Thanks a lot. Nice explanation. One question. Threads born after instance is not Null will directly go to loc "return instance; " , but at same time there will be many threads(let us take Thread B) that are waiting for lock and after they get lock , they will run "if(instance==null)" and will go inside , if we don't use 'volatile' keyword for variable 'instance'. Am i correct here or else tell me where i am going wrong ?

      ReplyDelete