Skip to content

Commit

Permalink
Added verbose check in printQueue
Browse files Browse the repository at this point in the history
  • Loading branch information
nsingh-branch committed Apr 19, 2024
1 parent a0e6fa3 commit b2bed10
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -183,12 +183,15 @@ ServerRequest peek() {
}

public void printQueue(){
synchronized (reqQueueLockObject){
StringBuilder stringBuilder = new StringBuilder();
for(int i = 0; i < queue.size(); i++){
stringBuilder.append(queue.get(i)).append(" with locks ").append(queue.get(i).printWaitLocks()).append("\n");
// Only print the queue if the log level is verbose
if (BranchLogger.getMinimumLogLevel().getLevel() == BranchLogger.BranchLogLevel.VERBOSE.getLevel()) {
synchronized (reqQueueLockObject) {
StringBuilder stringBuilder = new StringBuilder();
for (int i = 0; i < queue.size(); i++) {
stringBuilder.append(queue.get(i)).append(" with locks ").append(queue.get(i).printWaitLocks()).append("\n");
}
BranchLogger.v("Queue is: " + stringBuilder);
}
BranchLogger.v("Queue is: " + stringBuilder);
}
}

Expand Down

0 comments on commit b2bed10

Please sign in to comment.