Skip to content

Commit 2552d1b

Browse files
committed
Merge branch 'master' of github.com:yusufaytas/java-design-patterns
2 parents 91a7980 + 8fb4d32 commit 2552d1b

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -241,11 +241,9 @@
241241

242242
![alt text](https://github.com/iluwatar/java-design-patterns/blob/master/double-checked-locking/etc/double_checked_locking.jpg "Double Checked Locking")
243243

244-
**Applicability:** Use the Visitor pattern when
245-
* an object structure contains many classes of objects with differing interfaces, and you want to perform operations on these objects that depend on their concrete classes
246-
* many distinct and unrelated operations need to be performed on objects in an object structure, and you want to avoid "polluting" their classes with these operations. Visitor lets you keep related operations together by defining them in one class. When the object structure is shared by many applications, use Visitor to put operations in just those applications that need them
247-
* the classes defining the object structure rarely change, but you often want to define new operations over the structure. Changing the object structure classes requires redefining the interface to all visitors, which is potentially costly. If the object structure classes change often, then it's probably better to define the operations in those classes
248-
244+
**Applicability:** Use the Double Checked Locking pattern when
245+
* there is a concurrent access in object creation, e.g. singleton, where you want to create single instance of the same class and checking if it's null or not maybe not be enough when there are two or more threads that checks if instance is null or not.
246+
* there is a concurrent access on a method where method's behaviour changes according to the some constraints and these constraint change within this method.
249247

250248
# Frequently asked questions
251249

0 commit comments

Comments
 (0)