File tree Expand file tree Collapse file tree 5 files changed +9
-22
lines changed
queue-based-load-leveling/src/main/java/com/iluwatar/queue/load/leveling
src/main/java/com/iluwatar/sessionserver
src/main/java/com/iluwatar/twin Expand file tree Collapse file tree 5 files changed +9
-22
lines changed Original file line number Diff line number Diff line change 3636public class MessageQueue {
3737
3838 private final BlockingQueue <Message > blkQueue ;
39- public Object serviceExecutorWait =new Object ();
39+ public final Object serviceExecutorWait =new Object ();
4040
4141 // Default constructor when called creates Blocking Queue object.
4242 public MessageQueue () {
Original file line number Diff line number Diff line change 4949 <scope >test</scope >
5050 </dependency >
5151 </dependencies >
52- <build >
53- <plugins >
54- <plugin >
55- <groupId >org.apache.maven.plugins</groupId >
56- <artifactId >maven-compiler-plugin</artifactId >
57- <configuration >
58- <source >8</source >
59- <target >8</target >
60- </configuration >
61- </plugin >
62- </plugins >
63- </build >
64-
6552</project >
Original file line number Diff line number Diff line change @@ -59,7 +59,7 @@ public class App {
5959 private static Map <String , Integer > sessions = new HashMap <String ,Integer >();
6060 private static Map <String , Instant > sessionCreationTimes = new HashMap <String ,Instant >();
6161 private static final long SESSION_EXPIRATION_TIME = 10000 ;
62- private static Object sessionExpirationWait =new Object (); // used to make expiration task wait or work based on event (login request sent or not)
62+ private static final Object sessionExpirationWait =new Object (); // used to make expiration task wait or work based on event (login request sent or not)
6363
6464 /**
6565 * Main entry point.
@@ -89,11 +89,11 @@ private static void sessionExpirationTask() {
8989 try {
9090 synchronized (sessions )
9191 {
92- if (sessions .isEmpty ())
93- synchronized (sessionExpirationWait )
94- {
95- sessionExpirationWait .wait (); // Make Session expiration Checker wait until at least a single login request is sent.
96- }
92+ if (sessions .isEmpty ())
93+ synchronized (sessionExpirationWait )
94+ {
95+ sessionExpirationWait .wait (); // Make Session expiration Checker wait until at least a single login request is sent.
96+ }
9797 }
9898 LOGGER .info ("Session expiration checker started..." );
9999 Thread .sleep (SESSION_EXPIRATION_TIME ); // Sleep for expiration time
Original file line number Diff line number Diff line change @@ -90,7 +90,7 @@ public class BallThread extends Thread {
9090
9191 private volatile boolean isRunning = true ;
9292
93- private Object lock= new Object ();
93+ private final Object lock= new Object ();
9494
9595 /**
9696 * Run the thread.
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ public class BallThread extends Thread {
4242
4343 private volatile boolean isRunning = true ;
4444
45- private Object lock =new Object ();
45+ private final Object lock =new Object ();
4646
4747 /**
4848 * Run the thread.
You can’t perform that action at this time.
0 commit comments