Skip to content

Commit

Permalink
Use logger instead of println
Browse files Browse the repository at this point in the history
  • Loading branch information
grishka committed Oct 31, 2023
1 parent 7ddb2da commit ec27cca
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/test/java/smithereen/NamedMutexCollectionTest.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package smithereen;

import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.time.Duration;
import java.util.ArrayList;
Expand All @@ -10,6 +12,7 @@
import smithereen.util.NamedMutexCollection;

public class NamedMutexCollectionTest{
private static final Logger LOG=LoggerFactory.getLogger(NamedMutexCollectionTest.class);

@Test
public void testSingleThread(){
Expand Down Expand Up @@ -78,9 +81,9 @@ private CounterTask(NamedMutexCollection mutex, String name){

@Override
public void run(){
System.out.println("Starting thread "+Thread.currentThread().getName());
LOG.debug("Starting thread {}", Thread.currentThread().getName());
mutex.acquire(name);
System.out.println("Thread "+Thread.currentThread().getName()+" acquired mutex");
LOG.debug("Thread {} acquired mutex", Thread.currentThread().getName());
try{
try{Thread.sleep(500);}catch(InterruptedException ignore){}
if(count==0){
Expand All @@ -90,7 +93,7 @@ public void run(){
}finally{
mutex.release(name);
}
System.out.println("Exiting thread "+Thread.currentThread().getName());
LOG.debug("Exiting thread {}", Thread.currentThread().getName());
}
}
}

0 comments on commit ec27cca

Please sign in to comment.