Migrate to Flogger (green)

This is a 'green' Flogger migration CL. Green CLs are intended to be as
safe as possible and should be easy to review and submit.

No changes should be necessary to the code itself prior to submission,
but small changes to BUILD files may be required.

Changes within files are completely independent of each other, so this CL
can be safely split up for review using tools such as Rosie.

For more information, see []
Base CL: 197826149

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=198560170
This commit is contained in:
jianglai 2018-05-30 07:58:51 -07:00
parent 0d2fb3a8f0
commit 70b13596e4
178 changed files with 984 additions and 988 deletions

View file

@ -8,11 +8,12 @@ java_library(
name = "lock",
srcs = glob(["*.java"]),
deps = [
"//java/com/google/common/logging:formatting_logger",
"//java/google/registry/model",
"//java/google/registry/util",
"@com_google_code_findbugs_jsr305",
"@com_google_dagger",
"@com_google_flogger",
"@com_google_flogger_system_backend",
"@com_google_guava",
"@joda_time",
],

View file

@ -20,7 +20,7 @@ import static com.google.common.base.Throwables.throwIfUnchecked;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableSortedSet;
import com.google.common.logging.FormattingLogger;
import com.google.common.flogger.FluentLogger;
import com.google.common.util.concurrent.UncheckedExecutionException;
import google.registry.model.server.Lock;
import google.registry.util.AppEngineTimeLimiter;
@ -40,7 +40,7 @@ public class LockHandlerImpl implements LockHandler {
private static final long serialVersionUID = 6551645164118637767L;
private static final FormattingLogger logger = FormattingLogger.getLoggerForCallerClass();
private static final FluentLogger logger = FluentLogger.forEnclosingClass();
/** Fudge factor to make sure we kill threads before a lock actually expires. */
private static final Duration LOCK_TIMEOUT_FUDGE = Duration.standardSeconds(5);
@ -114,10 +114,10 @@ public class LockHandlerImpl implements LockHandler {
for (String lockName : lockNames) {
Optional<Lock> lock = acquire(lockName, tld, leaseLength);
if (!lock.isPresent()) {
logger.infofmt("Couldn't acquire lock named: %s for TLD: %s", lockName, tld);
logger.atInfo().log("Couldn't acquire lock named: %s for TLD: %s", lockName, tld);
return false;
}
logger.infofmt("Acquired lock: %s", lock);
logger.atInfo().log("Acquired lock: %s", lock);
acquiredLocks.add(lock.get());
}
delegate.call();
@ -125,7 +125,7 @@ public class LockHandlerImpl implements LockHandler {
} finally {
for (Lock lock : acquiredLocks) {
lock.release();
logger.infofmt("Released lock: %s", lock);
logger.atInfo().log("Released lock: %s", lock);
}
}
}