~ubuntu-branches/ubuntu/trusty/ehcache/trusty

« back to all changes in this revision

Viewing changes to src/main/java/net/sf/ehcache/util/SlewClock.java

  • Committer: Package Import Robot
  • Author(s): Emmanuel Bourg
  • Date: 2013-05-06 14:53:07 UTC
  • mfrom: (1.1.7) (2.1.8 sid)
  • Revision ID: package-import@ubuntu.com-20130506145307-v5bhw5yu70re00l3
Tags: 2.6.7-1
* Team upload.
* New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/**
2
 
 *  Copyright 2003-2010 Terracotta, Inc.
 
2
 *  Copyright Terracotta, Inc.
3
3
 *
4
4
 *  Licensed under the Apache License, Version 2.0 (the "License");
5
5
 *  you may not use this file except in compliance with the License.
19
19
 
20
20
import java.util.concurrent.atomic.AtomicLong;
21
21
 
 
22
import org.slf4j.Logger;
 
23
import org.slf4j.LoggerFactory;
 
24
 
22
25
/**
23
26
 * SlewClock will return the current time in millis, but will never go back in time.
24
27
 * If it detects that a back movement in time, it will slew the results while keeping them incrementing until time has caught up
28
31
 */
29
32
final class SlewClock {
30
33
 
 
34
    private static final Logger LOG = LoggerFactory.getLogger(SlewClock.class);
 
35
 
31
36
    private static final TimeProvider PROVIDER = TimeProviderLoader.getTimeProvider();
32
37
 
33
38
    private static final long DRIFT_MAXIMAL = Integer.getInteger("net.sf.ehcache.util.Timestamper.drift.max", 50);
79
84
                            }
80
85
                        } else {
81
86
                            try {
82
 
                                Thread.sleep(sleepTime(delta, lastDelta));
 
87
                                long sleep = sleepTime(delta, lastDelta);
 
88
                                LOG.trace("{} sleeping for {}ms to adjust for wall-clock drift.", Thread.currentThread(), sleep);
 
89
                                Thread.sleep(sleep);
83
90
                            } catch (InterruptedException e) {
84
91
                                interrupted = true;
85
92
                            }