#108 Consistent package naming throughout the examples

This commit is contained in:
Ilkka Seppala
2015-07-24 11:32:22 +03:00
parent af92d8dde5
commit 3d488ec15a
128 changed files with 963 additions and 873 deletions

View File

@ -0,0 +1,24 @@
package com.iluwatar.lazy.loading;
/**
*
* Same as HolderNaive but with added synchronization.
* This implementation is thread safe, but each {@link #getHeavy()}
* call costs additional synchronization overhead.
*
*/
public class HolderThreadSafe {
private Heavy heavy;
public HolderThreadSafe() {
System.out.println("HolderThreadSafe created");
}
public synchronized Heavy getHeavy() {
if (heavy == null) {
heavy = new Heavy();
}
return heavy;
}
}