Examples of Chronos


Examples of krati.util.Chronos

   * @param entryList
   * @throws IOException
   */
  public synchronized <T extends EntryValue> void update(List<Entry<T>> entryList)
  throws IOException {
    Chronos c = new Chronos();
   
    // Sort values by position in the array file
    T[] values = EntryUtility.sortEntriesToValues(entryList);
    if (values == null || values.length == 0) return;
   
    // Obtain maxScn
    long maxScn = _arrayHwmScn;
    for (Entry<?> e : entryList) {
      maxScn = Math.max(e.getMaxScn(), maxScn);
    }
   
    // Write hwmScn
    _log.info("write hwmScn:" + maxScn);
    _writer.writeLong(HWM_SCN_POSITION, maxScn);
    _writer.flush();
   
    // Write values
    for (T v : values) {
      v.updateArrayFile(_writer, getPosition(v.pos));
    }
    _writer.flush();
   
    // Write lwmScn
    _log.info("write lwmScn:" + maxScn);
    _writer.writeLong(LWM_SCN_POSITION, maxScn);
    _writer.flush();
   
    _arrayLwmScn = maxScn;
    _arrayHwmScn = maxScn;
   
    _log.info(entryList.size() + " entries flushed to " +
             _file.getAbsolutePath() + " in " + c.getElapsedTime());
  }
View Full Code Here

Examples of org.linkedin.util.clock.Chronos

  public int waitFor(long timeout) throws InterruptedException, TimeoutException
  {
    if(_process == null)
      throw new IllegalStateException("you must call start first");

    Chronos c = new Chronos();
    _out.join(timeout);
    timeout -= c.tick();
    if (timeout <= 0)
      throw new TimeoutException("Wait timed out");
    _err.join(timeout);
    timeout -= c.tick();
    if (timeout <= 0)
      throw new TimeoutException("Wait timed out");
   
    // there is no timeout in this API, not much we can do here
    // waiting on the other two threads should give us some safety
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.