* #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ä
						Ilkka Seppälä
					
				
			
			
				
	
			
			
			
						parent
						
							72b174619f
						
					
				
				
					commit
					cfdfedbd2e
				
			| @@ -22,6 +22,9 @@ | ||||
|  */ | ||||
| package com.iluwatar.spatialpartition; | ||||
|  | ||||
| import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | ||||
|  | ||||
| import java.util.ArrayList; | ||||
| import java.util.Enumeration; | ||||
| import java.util.Hashtable; | ||||
| @@ -52,6 +55,7 @@ import java.util.Random; | ||||
|  */ | ||||
|  | ||||
| public class App { | ||||
|   private static final Logger LOGGER = LoggerFactory.getLogger(App.class); | ||||
|  | ||||
|   static void noSpatialPartition(int height, int width,  | ||||
|         int numOfMovements, Hashtable<Integer, Bubble> bubbles) { | ||||
| @@ -73,7 +77,7 @@ public class App { | ||||
|     } | ||||
|     for (Integer key : bubbles.keySet()) { | ||||
|       //bubbles not popped | ||||
|       System.out.println("Bubble " + key + " not popped"); | ||||
|       LOGGER.info("Bubble " + key + " not popped"); | ||||
|     } | ||||
|   } | ||||
|  | ||||
| @@ -101,7 +105,7 @@ public class App { | ||||
|     } | ||||
|     for (Integer key : bubbles.keySet()) { | ||||
|       //bubbles not popped | ||||
|       System.out.println("Bubble " + key + " not popped"); | ||||
|       LOGGER.info("Bubble " + key + " not popped"); | ||||
|     } | ||||
|   } | ||||
|    | ||||
| @@ -119,7 +123,7 @@ public class App { | ||||
|       Bubble b = new Bubble(rand.nextInt(300), rand.nextInt(300), i, rand.nextInt(2) + 1); | ||||
|       bubbles1.put(i, b); | ||||
|       bubbles2.put(i, b); | ||||
|       System.out.println("Bubble " + i + " with radius " + b.radius + " added at (" + b.x + "," + b.y + ")"); | ||||
|       LOGGER.info("Bubble " + i + " with radius " + b.radius + " added at (" + b.x + "," + b.y + ")"); | ||||
|     } | ||||
|  | ||||
|     long start1 = System.currentTimeMillis(); | ||||
| @@ -128,8 +132,8 @@ public class App { | ||||
|     long start2 = System.currentTimeMillis(); | ||||
|     App.withSpatialPartition(300,300,20,bubbles2); | ||||
|     long end2 = System.currentTimeMillis(); | ||||
|     System.out.println("Without spatial partition takes " + (end1 - start1) + "ms"); | ||||
|     System.out.println("With spatial partition takes " + (end2 - start2) + "ms"); | ||||
|     LOGGER.info("Without spatial partition takes " + (end1 - start1) + "ms"); | ||||
|     LOGGER.info("With spatial partition takes " + (end2 - start2) + "ms"); | ||||
|   } | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -22,6 +22,9 @@ | ||||
|  */ | ||||
| package com.iluwatar.spatialpartition; | ||||
|  | ||||
| import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | ||||
|  | ||||
| import java.util.ArrayList; | ||||
| import java.util.Hashtable; | ||||
| import java.util.Random; | ||||
| @@ -32,6 +35,7 @@ import java.util.Random; | ||||
|  */ | ||||
|  | ||||
| public class Bubble extends Point<Bubble> { | ||||
|   private static final Logger LOGGER = LoggerFactory.getLogger(Bubble.class); | ||||
|  | ||||
|   final int radius; | ||||
|  | ||||
| @@ -54,7 +58,7 @@ public class Bubble extends Point<Bubble> { | ||||
|   } | ||||
|  | ||||
|   void pop(Hashtable<Integer, Bubble> allBubbles) { | ||||
|     System.out.println("Bubble " + this.id + " popped at (" + this.x + "," + this.y + ")!"); | ||||
|     LOGGER.info("Bubble " + this.id + " popped at (" + this.x + "," + this.y + ")!"); | ||||
|     allBubbles.remove(this.id); | ||||
|   } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user