]> source.dussan.org Git - sonarqube.git/commitdiff
Utilize parameterized logging rather than String.format()
authorDaniel Trebbien <dtrebbien@gmail.com>
Mon, 9 Oct 2017 15:16:51 +0000 (10:16 -0500)
committerSébastien Lesaint <sebastien.lesaint@sonarsource.com>
Tue, 10 Oct 2017 11:28:44 +0000 (13:28 +0200)
server/sonar-main/src/main/java/org/sonar/application/cluster/health/HealthStateSharingImpl.java
server/sonar-main/src/main/java/org/sonar/application/process/SQProcess.java
server/sonar-process/src/main/java/org/sonar/process/StopperThread.java

index 1d2849545cf21b49ae9a9129aedb1e11980d63a3..14597ca6b3bb9e85e4b1ec312a65e40e65586319 100644 (file)
@@ -31,8 +31,6 @@ import org.sonar.process.cluster.health.NodeHealthProvider;
 import org.sonar.process.cluster.health.SharedHealthStateImpl;
 import org.sonar.process.cluster.hz.HazelcastMember;
 
-import static java.lang.String.format;
-
 public class HealthStateSharingImpl implements HealthStateSharing {
   private static final Logger LOG = LoggerFactory.getLogger(HealthStateSharingImpl.class);
 
@@ -78,7 +76,7 @@ public class HealthStateSharingImpl implements HealthStateSharing {
         }
       }
     } catch (InterruptedException ie) {
-      LOG.warn(format("Termination of pool %s failed", HealthStateSharingImpl.class.getSimpleName()), ie);
+      LOG.warn("Termination of pool {} failed", HealthStateSharingImpl.class.getSimpleName(), ie);
       // (Re-)Cancel if current thread also interrupted
       executorService.shutdownNow();
       Thread.currentThread().interrupt();
index 18f6d192d6c767a80d3a96550b0dc95d475d0b8f..f0ddfa3ce7a83cacd158d7f5db099c2e3fae0215 100644 (file)
@@ -68,7 +68,7 @@ public class SQProcess {
     try {
       this.process = commandLauncher.get();
     } catch (RuntimeException e) {
-      LOG.error(format("Fail to launch process [%s]", processId.getKey()), e);
+      LOG.error("Fail to launch process [{}]", processId.getKey(), e);
       lifecycle.tryToMoveTo(Lifecycle.State.STOPPED);
       throw e;
     }
@@ -131,7 +131,7 @@ public class SQProcess {
       process.waitFor(timeout, timeoutUnit);
     } catch (InterruptedException e) {
       // can't wait for the termination of process. Let's assume it's down.
-      LOG.warn(format("Interrupted while stopping process %s", processId), e);
+      LOG.warn("Interrupted while stopping process {}", processId, e);
       Thread.currentThread().interrupt();
     } catch (Throwable e) {
       LOG.error("Can not ask for graceful stop of process {}", processId, e);
index 14fe192cd9cbe15d2a14bee3db0c463f5075b925..00f81bf267a7dc99553477182257d0404ac95254 100644 (file)
@@ -27,8 +27,6 @@ import java.util.concurrent.Future;
 import java.util.concurrent.TimeUnit;
 import org.sonar.process.sharedmemoryfile.ProcessCommands;
 
-import static java.lang.String.format;
-
 /**
  * Gracefully stops process in a timely fashion
  */
@@ -52,7 +50,7 @@ class StopperThread extends Thread {
       Future future = executor.submit(monitored::stop);
       future.get(terminationTimeoutMs, TimeUnit.MILLISECONDS);
     } catch (Exception e) {
-      LoggerFactory.getLogger(getClass()).error(format("Can not stop in %dms", terminationTimeoutMs), e);
+      LoggerFactory.getLogger(getClass()).error("Can not stop in {}ms", terminationTimeoutMs, e);
     }
     executor.shutdownNow();
     commands.endWatch();