package org.cache2k.core.util;

/*
 * #%L
 * cache2k core
 * %%
 * Copyright (C) 2000 - 2018 headissue GmbH, Munich
 * %%
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * #L%
 */

import org.cache2k.Clock;

/**
 * @author Jens Wilke
 */
public interface InternalClock extends Clock {

  /**
   * Returns the milliseconds since epoch.
   */
  long millis();

  /**
   * Wait for the specified amount of time in milliseconds.
   * The value of 0 means that the thread may sleep some tiny amount of time
   * or not at all.
   */
  void sleep(long _millis) throws InterruptedException;

  /**
   *
   */
  boolean isJobSchedulable();

  TimeReachedJob createJob(TimeReachedEvent ev);

  void schedule(TimeReachedJob j, long _millis);

  void disableJob(TimeReachedJob j);

  interface TimeReachedEvent {
    void timeIsReached(long _millis);
  }

  interface TimeReachedJob { }

}

@@ -723,126 +723,414 @@
 %0A * 
-@author Jens Wilke%0A */%0Apublic interface InternalClock extends Clock %7B%0A%0A  /**%0A   * Returns the milliseconds since epoch
+Abstraction for the system wall clock. A simulated clock implementation is used to%0A * test timing related code in a faster way.%0A *%0A * @author Jens Wilke%0A */%0Apublic interface InternalClock extends Clock %7B%0A%0A  /**%0A   * Returns the milliseconds since epoch. When using a simulated clock%0A   * either this method or #sleep needs to be called to make time pass and%0A   * make this method return an increased number
 .%0A  
@@ -1216,21 +1216,16 @@
 seconds.
-%0A   *
  The val
@@ -1242,16 +1242,21 @@
 ans that
+%0A   *
  the thr
@@ -1297,239 +1297,738 @@
 time
-%0A   * or not at all.%0A   */%0A  void sleep(long _millis) throws InterruptedException;%0A%0A  /**%0A   *%0A   */%0A  boolean isJobSchedulable();%0A%0A  TimeReachedJob createJob(TimeReachedEvent ev);%0A%0A  void schedule(TimeReachedJob j, long _millis);%0A
+ or not at all.%0A   *%0A   * %3Cp%3EWhen using a simulated clock either this method or #millis needs to be called to make time pass and%0A   * make #millis return an increased number.%0A   */%0A  void sleep(long _millis) throws InterruptedException;%0A%0A  /**%0A   * The clock is capable to execute code when a certain time is reached and before the time advances further.%0A   */%0A  boolean isJobSchedulable();%0A%0A  /**%0A   * Creates a job object for the specified event callback.%0A   */%0A  TimeReachedJob createJob(TimeReachedEvent ev);%0A%0A  /**%0A   * Schedules or reschedules the timer event job to be run at the%0A   * specified point in time.%0A   */%0A  void schedule(TimeReachedJob j, long _millis);%0A%0A  /**%0A   * Disable the job clearing used resources.%0A   */
 %0A  v

improve doc