Fix mismatch in types of Predicates being used

We're going to need to switch away from Guava's Functions and Predicates for
everything and replace them with the java.util versions. Unfortunately there
does not appear to be an automated tool to do this all at once. Refaster got
close but doesn't seem to care about these particular types of mismatch (I
suspect we're using a different version of the JDK than the outside world;
ours is OK with Guava classes).

This also bumps up Guava to 0.23, which is needed for some new functionality
used in combination with Java 8 features.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=170531539
This commit is contained in:
mcilwain 2017-09-29 14:20:02 -07:00 committed by Ben McIlwain
parent 447b83f7db
commit a50ef39c04
9 changed files with 80 additions and 68 deletions

View file

@ -21,6 +21,7 @@ import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Optional;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableSortedSet;
import com.google.common.util.concurrent.UncheckedExecutionException;
import google.registry.model.server.Lock;
import google.registry.util.AppEngineTimeLimiter;
import google.registry.util.FormattingLogger;
@ -28,6 +29,7 @@ import google.registry.util.RequestStatusChecker;
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import javax.annotation.Nullable;
import javax.inject.Inject;
@ -67,8 +69,12 @@ public class LockHandlerImpl implements LockHandler {
return AppEngineTimeLimiter.create().callWithTimeout(
new LockingCallable(callable, Strings.emptyToNull(tld), leaseLength, lockNames),
leaseLength.minus(LOCK_TIMEOUT_FUDGE).getMillis(),
TimeUnit.MILLISECONDS,
true);
TimeUnit.MILLISECONDS);
} catch (ExecutionException | UncheckedExecutionException e) {
// Unwrap the execution exception and throw its root cause.
Throwable cause = e.getCause();
throwIfUnchecked(cause);
throw new RuntimeException(cause);
} catch (Exception e) {
throwIfUnchecked(e);
throw new RuntimeException(e);