* Clock: Synchronization, log large shifts to event log

This commit is contained in:
zzz
2012-09-09 15:45:29 +00:00
parent 74e753934c
commit 2f98d05e7c
3 changed files with 5 additions and 4 deletions

View File

@ -1056,6 +1056,7 @@ public class Router implements RouterClock.ClockShiftListener {
return;
if (delta > -60*1000 && delta < 60*1000)
return;
_eventLog.addEvent(EventLog.CLOCK_SHIFT, Long.toString(delta));
// update the routing key modifier
_context.routingKeyGenerator().generateDateBasedModData();
if (_context.commSystem().countActivePeers() <= 0)

View File

@ -91,7 +91,7 @@ public class RouterClock extends Clock {
* @since 0.7.12
* @param offsetMs the delta from System.currentTimeMillis() (NOT the delta from now())
*/
private void setOffset(long offsetMs, boolean force, int stratum) {
private synchronized void setOffset(long offsetMs, boolean force, int stratum) {
long delta = offsetMs - _offset;
if (!force) {
if ((offsetMs > MAX_OFFSET) || (offsetMs < 0 - MAX_OFFSET)) {
@ -236,7 +236,7 @@ public class RouterClock extends Clock {
*
* @since 0.8.8
*/
private void notifyMassive(long shift) {
private synchronized void notifyMassive(long shift) {
long nowNanos = System.nanoTime();
// try to prevent dups, not guaranteed
// nanoTime() isn't guaranteed to be monotonic either :(