Skip to content

Commit

Permalink
Sonarcloud
Browse files Browse the repository at this point in the history
  • Loading branch information
TwoOfTwelve committed Jul 19, 2024
1 parent a648335 commit 5e89cd7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions cli/src/main/java/de/jplag/cli/logger/DelayablePrinter.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,22 @@ private DelayablePrinter() {
* Prints the given string to the terminal appending a line-break
* @param output The string to print
*/
synchronized public void println(String output) {
public synchronized void println(String output) {
this.outputQueue.offer(output);
this.printQueue();
}

/**
* Stops printing to the terminal until {@link #resume()} is called
*/
synchronized public void delay() {
public synchronized void delay() {
this.isDelayed = true;
}

/**
* Resumes printing if {@link #delay()} was called
*/
synchronized public void resume() {
public synchronized void resume() {
this.isDelayed = false;
this.printQueue();
}
Expand All @@ -62,7 +62,7 @@ public void setOutputStream(PrintStream printStream) {
this.targetStream = printStream;
}

synchronized private void printQueue() {
private synchronized void printQueue() {
if (!this.isDelayed) {
while (!this.outputQueue.isEmpty()) {
this.targetStream.println(this.outputQueue.poll());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import org.junit.jupiter.api.Test;

class DelayablePrinterTest {
private final static String TEST_MESSAGE = "Hello World";
private static final String TEST_MESSAGE = "Hello World";

private static ByteArrayOutputStream outputStream;

Expand Down

0 comments on commit 5e89cd7

Please sign in to comment.