* #496 Add pipeline module to parent pom ✨ * #496: Add main application class and test for pipeline * #496: Checkstyle format and add log messages on pipeline stages 🎨 * #496: Fill readme sections of pipeline ✨ * #496: Javadocs and checkstyle formatting 🎨 * #496: Follow PMD checks and add more explanation as block comment on App.java * #496: Apply requested PR changes by iluwatar 🎨 * #970: Replace log4j usage on commander pattern to Slf4j API 🎨 * #970: Replace log4j usage on dao pattern to Slf4j API 🎨 * #970: Replace log4j usage on data mapper pattern to Slf4j API 🎨 * #970: Remove log4j dependency on data transfer object pom 🔥 * #970: Replace log4j usage on module pattern to Slf4j API 🎨 * #970: Replace log4j usage on serverless pattern to Slf4j API 🎨 This also removes the aws log4j dependency * #970: Remove unnecessary gitignore line for log4j.xml 🔥 * #970: Remove remaining remnants of log4j 🔥 * #970: Replace System.out logging with appropriate logging methods 🎨 * #970: Replace System.out method references to Logger::info 🎨
This commit is contained in:
committed by
Ilkka Seppälä
parent
72b174619f
commit
cfdfedbd2e
@ -22,6 +22,9 @@
|
||||
*/
|
||||
package com.iluwatar.dirtyflag;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
@ -48,6 +51,8 @@ import java.util.concurrent.TimeUnit;
|
||||
* when needed. {@link World} mainly serves the data to the front-end.
|
||||
*/
|
||||
public class App {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(App.class);
|
||||
/**
|
||||
* Program execution point
|
||||
*/
|
||||
@ -59,9 +64,9 @@ public class App {
|
||||
@Override
|
||||
public void run() {
|
||||
List<String> countries = world.fetch();
|
||||
System.out.println("Our world currently has the following countries:-");
|
||||
LOGGER.info("Our world currently has the following countries:-");
|
||||
for (String country : countries) {
|
||||
System.out.println("\t" + country);
|
||||
LOGGER.info("\t" + country);
|
||||
}
|
||||
}
|
||||
}, 0, 15, TimeUnit.SECONDS); // Run at every 15 seconds.
|
||||
|
@ -22,6 +22,10 @@
|
||||
*/
|
||||
package com.iluwatar.dirtyflag;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import javax.xml.crypto.Data;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
@ -37,6 +41,8 @@ import java.util.List;
|
||||
*/
|
||||
public class DataFetcher {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(DataFetcher.class);
|
||||
|
||||
private final String filename = "world.txt";
|
||||
private long lastFetched;
|
||||
|
||||
@ -62,7 +68,7 @@ public class DataFetcher {
|
||||
File file = new File(classLoader.getResource(filename).getFile());
|
||||
|
||||
if (isDirty(file.lastModified())) {
|
||||
System.out.println(filename + " is dirty! Re-fetching file content...");
|
||||
LOGGER.info(filename + " is dirty! Re-fetching file content...");
|
||||
|
||||
List<String> data = new ArrayList<String>();
|
||||
try (BufferedReader br = new BufferedReader(new FileReader(file))) {
|
||||
|
Reference in New Issue
Block a user