Top Description Fields Constructors Methods
org.eclipse.jgit.util.time

public Class MonotonicSystemClock

extends Object
implements MonotonicClock
Class Inheritance
All Implemented Interfaces
org.eclipse.jgit.util.time.MonotonicClock
Static Imports
java.util.concurrent.TimeUnit.MICROSECONDS, .TimeUnit.MILLISECONDS

A org.eclipse.jgit.util.time.MonotonicClock based on System.currentTimeMillis.
Since
4.6

Field Summary

Modifier and TypeField and Description
private static final AtomicLong

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private static long
public ProposedTimestamp
propose()

Implements org.eclipse.jgit.util.time.MonotonicClock.propose.

Obtain a timestamp close to "now".

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

beforeback to summary
private static final AtomicLong before

Constructor Detail

MonotonicSystemClockback to summary
public MonotonicSystemClock()

Method Detail

nowMicrosback to summary
private static long nowMicros()
proposeback to summary
public ProposedTimestamp propose()

Implements org.eclipse.jgit.util.time.MonotonicClock.propose.

Doc from org.eclipse.jgit.util.time.MonotonicClock.propose.

Obtain a timestamp close to "now".

Proposed times are close to "now", but may not yet be certainly in the past. This allows the calling thread to interleave other useful work while waiting for the clock instance to create an assurance it will never in the future propose a time earlier than the returned time.

A hypothetical implementation could read the local system clock (managed by NTP) and return that proposal, concurrently sending network messages to closely collaborating peers in the same cluster to also ensure their system clocks are ahead of this time. In such an implementation the org.eclipse.jgit.util.time.ProposedTimestamp#blockUntil(Duration) method would wait for replies from the peers indicating their own system clocks have moved past the proposed time.

Returns:ProposedTimestamp

a org.eclipse.jgit.util.time.ProposedTimestamp object.

Annotations
@Override