public UUIDTimer(Random rnd, TimestampSynchronizer sync) throws IOException { _random = rnd; _syncer = sync; initCounters(rnd); _lastSystemTimestamp = 0L; // This may get overwritten by the synchronizer _lastUsedTimestamp = 0L; /* Ok, now; synchronizer can tell us what is the first timestamp * value that definitely was NOT used by the previous incarnation. * This can serve as the last used time stamp, assuming it is not * less than value we are using now. */ if (sync != null) { long lastSaved = sync.initialize(); if (lastSaved > _lastUsedTimestamp) { _lastUsedTimestamp = lastSaved; } } /* Also, we need to make sure there are now no safe values (since * synchronizer is not yet requested to allocate any): */ _firstUnsafeTimestamp = 0L; // ie. will always trigger sync.update() }
_firstUnsafeTimestamp = _syncer.update(systime); } catch (IOException ioe) { throw new RuntimeException("Failed to synchronize timestamp: "+ioe);
public UUIDTimer(Random rnd, TimestampSynchronizer sync) throws IOException { _random = rnd; _syncer = sync; initCounters(rnd); _lastSystemTimestamp = 0L; // This may get overwritten by the synchronizer _lastUsedTimestamp = 0L; /* Ok, now; synchronizer can tell us what is the first timestamp * value that definitely was NOT used by the previous incarnation. * This can serve as the last used time stamp, assuming it is not * less than value we are using now. */ if (sync != null) { long lastSaved = sync.initialize(); if (lastSaved > _lastUsedTimestamp) { _lastUsedTimestamp = lastSaved; } } /* Also, we need to make sure there are now no safe values (since * synchronizer is not yet requested to allocate any): */ _firstUnsafeTimestamp = 0L; // ie. will always trigger sync.update() }
_firstUnsafeTimestamp = _syncer.update(systime); } catch (IOException ioe) { throw new RuntimeException("Failed to synchronize timestamp: "+ioe);