mirror of
https://github.com/google/nomulus.git
synced 2025-06-01 02:04:04 +02:00
Make LockHandlerImpl.clock transient
SystemClock isn't Serializable (for obvious reasons), whereas LockHandlerImpl is used as a field on some Serializable mapreduce classes. So mark it transient and then re-generate it on first use following de-serialization when it happens to be null. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=201707209
This commit is contained in:
parent
0422205d84
commit
8245d2f1c4
3 changed files with 25 additions and 14 deletions
|
@ -23,6 +23,7 @@ import static org.mockito.Mockito.verify;
|
|||
import google.registry.model.server.Lock;
|
||||
import google.registry.testing.AppEngineRule;
|
||||
import google.registry.testing.FakeClock;
|
||||
import google.registry.util.RequestStatusCheckerImpl;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
@ -72,7 +73,7 @@ public final class LockHandlerImplTest {
|
|||
}
|
||||
|
||||
private boolean executeWithLocks(Callable<Void> callable, final @Nullable Lock acquiredLock) {
|
||||
LockHandlerImpl lockHandler = new LockHandlerImpl() {
|
||||
LockHandlerImpl lockHandler = new LockHandlerImpl(new RequestStatusCheckerImpl(), clock) {
|
||||
private static final long serialVersionUID = 0L;
|
||||
@Override
|
||||
Optional<Lock> acquire(String resourceName, String tld, Duration leaseLength) {
|
||||
|
@ -82,7 +83,6 @@ public final class LockHandlerImplTest {
|
|||
return Optional.ofNullable(acquiredLock);
|
||||
}
|
||||
};
|
||||
lockHandler.clock = clock;
|
||||
|
||||
return lockHandler.executeWithLocks(callable, "tld", ONE_DAY, "resourceName");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue