Package com.cetsoft.caudit.stopwatch

Examples of com.cetsoft.caudit.stopwatch.Stopwatch


     */
    public Audit create(AuditType type, int auditId) {
      String auditName = mapper.getAuditName(auditId);
      switch (type) {
      case BASIC_STOPWATCH:
        return new Stopwatch(auditId, auditName);
      case COUNTING_STOPWATCH:
        return new CountingStopwatch(auditId, auditName);
      case LONG_QUANTITY:
        return new LongQuantity(auditId, auditName);
      case DOUBLE_QUANTITY:
View Full Code Here


   *
   * @param args the arguments
   * @throws InterruptedException the interrupted exception
   */
  public static void main(String[] args) throws InterruptedException {
    final Stopwatch stopwatch = Audits.getBasicStopwatch(BASIC_STOPWATCH_ID);
    stopwatch.setShouldReset(false);
    stopwatch.setRemovalListener(new AuditRemovalListener() {
      public void onRemoval(AuditEvent auditEvent) {
        System.out.println(auditEvent);
      }
    });
    Audits.unmapAudit(stopwatch);
    new Thread(new Runnable() {
      public void run() {
        while (true) {
          stopwatch.start();
          try {
            Thread.sleep((long) (Math.random() * 100));
          } catch (InterruptedException e) {
            e.printStackTrace();
          }
          stopwatch.stop();
        }
      }
    }).start();
    for (int i=0;i<10;i++) {
      new Thread(new Runnable() {
        public void run() {
          while (true) {
            CountingStopwatch stopwatch = Audits.getCountingStopwatch(COUNTING_STOPWATCH_ID);
            stopwatch.start();
            try {
              Thread.sleep((long) (Math.random() * 100));
            } catch (InterruptedException e) {
              e.printStackTrace();
            }
            stopwatch.stop(23);
          }
        }
      }).start();
    }
    new Thread(new Runnable() {
View Full Code Here

TOP

Related Classes of com.cetsoft.caudit.stopwatch.Stopwatch

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.