#502 Replaced usages of System.out with logger.

This commit is contained in:
daniel-bryla
2016-10-23 19:59:03 +02:00
parent 4ca205c03c
commit 0438811489
154 changed files with 1155 additions and 792 deletions

View File

@@ -22,6 +22,9 @@
*/
package com.iluwatar.lazy.loading;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*
* Lazy loading idiom defers object creation until needed.
@@ -33,6 +36,9 @@ package com.iluwatar.lazy.loading;
*
*/
public class App {
private static final Logger LOGGER = LoggerFactory.getLogger(App.class);
/**
* Program entry point
*
@@ -43,16 +49,16 @@ public class App {
// Simple lazy loader - not thread safe
HolderNaive holderNaive = new HolderNaive();
Heavy heavy = holderNaive.getHeavy();
System.out.println("heavy=" + heavy);
LOGGER.info("heavy={}", heavy);
// Thread safe lazy loader, but with heavy synchronization on each access
HolderThreadSafe holderThreadSafe = new HolderThreadSafe();
Heavy another = holderThreadSafe.getHeavy();
System.out.println("another=" + another);
LOGGER.info("another={}", another);
// The most efficient lazy loader utilizing Java 8 features
Java8Holder java8Holder = new Java8Holder();
Heavy next = java8Holder.getHeavy();
System.out.println("next=" + next);
LOGGER.info("next={}", next);
}
}