Adjust checkstyle rules. Make checkstyle fail the build when violations are found. Correct all current checkstyle violations.
This commit is contained in:
@ -7,6 +7,9 @@ package com.iluwatar.lazy.loading;
|
||||
*/
|
||||
public class Heavy {
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public Heavy() {
|
||||
System.out.println("Creating Heavy ...");
|
||||
try {
|
||||
|
@ -9,10 +9,16 @@ public class HolderNaive {
|
||||
|
||||
private Heavy heavy;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public HolderNaive() {
|
||||
System.out.println("HolderNaive created");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get heavy object
|
||||
*/
|
||||
public Heavy getHeavy() {
|
||||
if (heavy == null) {
|
||||
heavy = new Heavy();
|
||||
|
@ -10,10 +10,16 @@ public class HolderThreadSafe {
|
||||
|
||||
private Heavy heavy;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public HolderThreadSafe() {
|
||||
System.out.println("HolderThreadSafe created");
|
||||
}
|
||||
|
||||
/**
|
||||
* Get heavy object
|
||||
*/
|
||||
public synchronized Heavy getHeavy() {
|
||||
if (heavy == null) {
|
||||
heavy = new Heavy();
|
||||
|
@ -5,7 +5,7 @@ import java.util.function.Supplier;
|
||||
/**
|
||||
*
|
||||
* This lazy loader is thread safe and more efficient than {@link HolderThreadSafe}. It utilizes
|
||||
* Java 8 functional interface {@link Supplier<T>} as {@link Heavy} factory.
|
||||
* Java 8 functional interface {@link Supplier} as {@link Heavy} factory.
|
||||
*
|
||||
*/
|
||||
public class Java8Holder {
|
||||
|
Reference in New Issue
Block a user