Skip to content

Commit

Permalink
queue; CR to change logging to SLF4J in DefaultQueueLifecycle. See #73
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrossie committed Oct 1, 2019
1 parent dea84b7 commit cb6d288
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions queue/src/main/java/org/killbill/queue/DefaultQueueLifecycle.java
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public boolean startQueue() {
this.executor = Executors.newFixedThreadPool(config.geNbLifecycleDispatchThreads() + config.geNbLifecycleCompleteThreads(),
config.getTableName() + "-lifecycle-th");

log.info(String.format("%s: Starting...", svcQName));
log.info("{}: Starting...", svcQName);

isProcessingEvents = true;

Expand All @@ -122,12 +122,12 @@ public void stopQueue() {
try {
executor.awaitTermination(5, TimeUnit.SECONDS);
} catch (final InterruptedException e) {
log.info(String.format("%s: Stop sequence has been interrupted", svcQName));
log.info("{}: Stop sequence has been interrupted", svcQName);
} finally {
int remainingCompleted = completedOrFailedEvents.size();
int remainingRetried = retriedEvents.size();
if (remainingCompleted > 0 || remainingRetried > 0) {
log.warn(String.format("%s: Stopped queue with %d event/notifications non completed ", svcQName, (remainingCompleted + remainingRetried)));
log.warn("{}: Stopped queue with {} event/notifications non completed ", svcQName, (remainingCompleted + remainingRetried));
}
}
}
Expand Down Expand Up @@ -175,10 +175,10 @@ private final class CompletionRunnable implements Runnable {
public void run() {

try {
log.info(String.format("%s: Thread %s-completion [%d] starting ",
log.info("{}: Thread {}-completion [{}] starting ",
svcQName,
Thread.currentThread().getName(),
Thread.currentThread().getId()));
Thread.currentThread().getId());

while (true) {

Expand Down Expand Up @@ -216,11 +216,11 @@ public void callback() throws InterruptedException {
});
}
} catch (final InterruptedException e) {
log.info(String.format("%s: Thread %s got interrupted, exiting... ", svcQName, Thread.currentThread().getName()));
log.info("{}: Thread {} got interrupted, exiting... ", svcQName, Thread.currentThread().getName());
} catch (final Error e) {
log.error(String.format("%s: Thread %s got an exception, exiting... ", svcQName, Thread.currentThread().getName()), e);
log.error("{}: Thread {} got an exception, exiting...", svcQName, Thread.currentThread().getName(), e);
} finally {
log.info(String.format("%s: Thread %s has exited", svcQName, Thread.currentThread().getName()));
log.info("{}: Thread {} has exited", svcQName, Thread.currentThread().getName());
}
}

Expand All @@ -241,10 +241,10 @@ private final class DispatcherRunnable implements Runnable {
public void run() {

try {
log.info(String.format("%s: Thread %s-dispatcher [%d] starting ",
log.info("{}: Thread {}-dispatcher [{}] starting ",
svcQName,
Thread.currentThread().getName(),
Thread.currentThread().getId()));
Thread.currentThread().getId());

while (true) {

Expand All @@ -264,11 +264,11 @@ public void callback() throws InterruptedException {
});
}
} catch (final InterruptedException e) {
log.info(String.format("%s: Thread %s got interrupted, exiting... ", svcQName, Thread.currentThread().getName()));
log.info("{}: Thread {} got interrupted, exiting... ", svcQName, Thread.currentThread().getName());
} catch (final Error e) {
log.error(String.format("%s: Thread %s got an exception, exiting... ", svcQName, Thread.currentThread().getName()), e);
log.error("{}: Thread {} got an exception, exiting... ", svcQName, Thread.currentThread().getName(), e);
} finally {
log.info(String.format("%s: Thread %s has exited", svcQName, Thread.currentThread().getName()));
log.info("{}: Thread {} has exited", svcQName, Thread.currentThread().getName());
}
}

Expand Down Expand Up @@ -310,11 +310,11 @@ private void withHandlingRuntimeException(final RunnableRawCallback cb) throws I
try {
cb.callback();
} catch (final DBIException e) {
log.warn(String.format("%s: Thread %s got DBIException exception: %s",
svcQName, Thread.currentThread().getName(), e));
log.warn("{}: Thread {} got DBIException exception: ",
svcQName, Thread.currentThread().getName(), e);
} catch (final RuntimeException e) {
log.warn(String.format("%s: Thread %s got Runtime exception: %s",
svcQName, Thread.currentThread().getName(), e));
log.warn("{}: Thread {} got Runtime exception: ",
svcQName, Thread.currentThread().getName(), e);
}
}

Expand Down

0 comments on commit cb6d288

Please sign in to comment.