Package winterwell.utils.time

Examples of winterwell.utils.time.Time


    String[] cBits = StrUtils.find("commit\\s*(\\w+)", output);
    assert tBits != null && tBits.length > 1 : f.getAbsolutePath() + "\n"
        + output;
    assert cBits != null && cBits.length > 1 : f.getAbsolutePath() + "\n"
        + output;
    Time time = new Time(tBits[1].trim());
    String key = cBits[1];
    return new Pair2<Time, String>(time, key);
  }
View Full Code Here


   */
  public Cache<Key, Value> setPersistence(File persistHere, Dt persistEvery) {
    assert persistHere.getParentFile().isDirectory() : persistHere;
    this.persist = persistHere;
    this.persistEvery = persistEvery;
    persistAt = new Time().plus(persistEvery);
    // load now?
    if (backing.isEmpty() && persist.exists()) {
      try {
        Map map = XStreamUtils
            .serialiseFromXml(FileUtils.read(persist));
View Full Code Here

  public final V call() throws Exception {
    TimeOut timeOut = null;
    try {
      if (status == QStatus.CANCELLED)
        throw new CancellationException();
      start = new Time();
      // set a timer running
      // - can lead to InterruptedExceptions
      if (maxTime > 0) {
        timeOut = new TimeOut(maxTime);
      }
      // assert runner != null;
      status = QStatus.RUNNING;
      thread = Thread.currentThread();
      // Set the thread name (but keep it short)
      // This will always be reset to Done: or Error: by the end of the
      // method call
      thread.setName(StrUtils.ellipsize(name == null ? toString() : name,
          32));
      if (captureStdOut) {
        sysOut = new SysOutCollectorStream();
      }

      // run!
      output = run();

      end = new Time();
      status = QStatus.DONE;
      thread.setName(StrUtils.ellipsize("Done: " + thread.getName(), 32));
      return output;
    } catch (Throwable e) {
      status = QStatus.ERROR;
View Full Code Here

  }

  public Dt getRunningTime() {
    if (start == null)
      return Dt.ZERO();
    return start.dt(end == null ? new Time() : end);
  }
View Full Code Here

   */
  public void setLogRotation(Dt interval, int history) {
    this.rotationInterval = interval;
    this.rotationHistory = history;
    // FIXME how do we get the file created time?
    Time created = file.exists() ? new Time(file.lastModified())
        : new Time();
    nextRotation = created.plus(interval);
  }
View Full Code Here

TOP

Related Classes of winterwell.utils.time.Time

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.