mirror of
https://github.com/google/nomulus.git
synced 2025-05-12 22:38:16 +02:00
Make our Clock util Serializable
It doesn't entirely make semantic sense, since the actual state of the SystemClock isn't being preserved, but it makes injection into serializable classes (e.g. mapreduces) much simpler, so it's worth doing. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=201755949
This commit is contained in:
parent
481790bc91
commit
7d3cb3d426
4 changed files with 18 additions and 19 deletions
|
@ -14,12 +14,20 @@
|
|||
|
||||
package google.registry.util;
|
||||
|
||||
import java.io.Serializable;
|
||||
import javax.annotation.concurrent.ThreadSafe;
|
||||
import org.joda.time.DateTime;
|
||||
|
||||
/** A clock that tells the current time in milliseconds or nanoseconds. */
|
||||
/**
|
||||
* A clock that tells the current time in milliseconds or nanoseconds.
|
||||
*
|
||||
* <p>Clocks are technically serializable because they are either a stateless wrapper around the
|
||||
* system clock, or for testing, are just a wrapper around a DateTime. This means that if you
|
||||
* serialize a clock and deserialize it elsewhere, you won't necessarily get the same time or time
|
||||
* zone -- what you will get is a functioning clock.
|
||||
*/
|
||||
@ThreadSafe
|
||||
public interface Clock {
|
||||
public interface Clock extends Serializable {
|
||||
|
||||
/** Returns current time in UTC timezone. */
|
||||
DateTime nowUtc();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue