Package org.apache.commons.lang.time

Examples of org.apache.commons.lang.time.StopWatch


  private JSplitPane verticalSplitPane;
  private JSplitPane horizSplitPane;
  private JLogPanel logPanel;
 
  public JMainFrame(){
    StopWatch stopWatch = new StopWatch();
    stopWatch.start();
    log.info("Starting "+GuiClient.getApplicationName()+" Ver. "+GuiClient.getVersion());
    runSplash();
    ToolTipManager.sharedInstance().setDismissDelay (300000);
    initialize();
    closeSplash();
    stopWatch.stop();
    log.info(GuiClient.getApplicationName()+" Ver. "+GuiClient.getVersion()+" "+GettextResource.gettext(Configuration.getInstance().getI18nResourceBundle(),"started in ")+DurationFormatUtils.formatDurationWords(stopWatch.getTime(), true, true));
  }
View Full Code Here


    CompleteIndexBuilder> builders) throws IOException {
    ObjectArrayList<KeyValue> newKeys = this.keys == null ?
      new ObjectArrayList<KeyValue>() :
      new ObjectArrayList<KeyValue>(this.keys.size());

    StopWatch stopWatch = new StopWatch();
    stopWatch.start();

    InternalScanner scanner = region.getScanner(new Scan());
    boolean moreRows;
    int id = 0;
    do {
      List<KeyValue> nextRow = new ArrayList<KeyValue>();
      moreRows = scanner.next(nextRow);
      if (nextRow.size() > 0) {
        KeyValue
          firstOnRow = KeyValue.createFirstOnRow(nextRow.get(0).getRow());
        newKeys.add(firstOnRow);
        // add keyvalue to the heapsize
        heapSize += firstOnRow.heapSize();
        for (KeyValue keyValue : nextRow) {
          CompleteIndexBuilder idx = builders.get(Pair.of(keyValue.getFamily(),
            keyValue.getQualifier()));
          if (idx != null) {
            idx.addKeyValue(keyValue, id);
          }
        }
        id++;
      }
    } while (moreRows);

    stopWatch.stop();
    LOG.info("Filled indices for region: '" + region.getRegionNameAsString()
      + "' with " + id + " entries in " + stopWatch.toString());
    return newKeys;
  }
View Full Code Here

            @Override
            public ExecutionResult call() throws Exception {
                Thread.currentThread().setName("HealthCheck " + metadata.getTitle());
                LOG.debug("Starting check {}", metadata);

                final StopWatch stopWatch = new StopWatch();
                stopWatch.start();
                Result resultFromHealthCheck = null;
                ExecutionResult executionResult = null;

                final HealthCheck healthCheck = (HealthCheck) bundleContext.getService(metadata.getServiceReference());

                try {
                    if (healthCheck != null) {
                        resultFromHealthCheck = healthCheck.execute();
                    } else {
                        throw new IllegalStateException("Service for " + metadata + " is gone");
                    }

                } catch (final Exception e) {
                    resultFromHealthCheck = new Result(Result.Status.CRITICAL, "Exception during execution of " + this + ": " + e, e);
                } finally {
                    // unget service ref
                    bundleContext.ungetService(metadata.getServiceReference());

                    // update result with information about this run
                    stopWatch.stop();
                    long elapsedTime = stopWatch.getTime();
                    if (resultFromHealthCheck != null) {
                        // wrap the result in an execution result
                        executionResult = new ExecutionResult(metadata, resultFromHealthCheck, elapsedTime);
                    }
                    LOG.debug("Time consumed for {}: {}", metadata, HealthCheckExecutorImpl.msHumanReadable(elapsedTime));
View Full Code Here

    /**
     * Execute a set of health checks
     */
    private List<HealthCheckExecutionResult> execute(final ServiceReference[] healthCheckReferences) {
        final StopWatch stopWatch = new StopWatch();
        stopWatch.start();

        final List<HealthCheckExecutionResult> results = new ArrayList<HealthCheckExecutionResult>();
        final List<HealthCheckMetadata> healthCheckDescriptors = getHealthCheckMetadata(healthCheckReferences);

       
        createResultsForDescriptors(healthCheckDescriptors, results);

        stopWatch.stop();
        if ( logger.isDebugEnabled() ) {
            logger.debug("Time consumed for all checks: {}", msHumanReadable(stopWatch.getTime()));
        }
        // sort result
        Collections.sort(results, new Comparator<HealthCheckExecutionResult>() {

            @Override
View Full Code Here

    /**
     * Wait for the futures until the timeout is reached
     */
    private void waitForFuturesRespectingTimeout(final List<HealthCheckFuture> futuresForResultOfThisCall) {
        final StopWatch callExcutionTimeStopWatch = new StopWatch();
        callExcutionTimeStopWatch.start();
        boolean allFuturesDone;
        do {
            try {
                Thread.sleep(50);
            } catch (final InterruptedException ie) {
                logger.warn("Unexpected InterruptedException while waiting for healthCheckContributors", ie);
            }

            allFuturesDone = true;
            for (final HealthCheckFuture healthCheckFuture : futuresForResultOfThisCall) {
                allFuturesDone &= healthCheckFuture.isDone();
            }
        } while (!allFuturesDone && callExcutionTimeStopWatch.getTime() < this.timeoutInMs);
    }
View Full Code Here

  private IntersectionGrid<SiteWithPolynomial> siteGrid; //TODO: rename IntersectionGrid to something more generic
 
  @Override
  public void setKnownSites(Collection<VectorXYZ> siteVectors) {
   
    StopWatch stopWatch = new StopWatch();
    stopWatch.start();
   
    sites = new ArrayList<SiteWithPolynomial>(siteVectors.size());
   
    siteGrid = new IntersectionGrid<SiteWithPolynomial>(
        new AxisAlignedBoundingBoxXZ(siteVectors).pad(CELL_SIZE/2),
        CELL_SIZE, CELL_SIZE);
   
    for (VectorXYZ siteVector : siteVectors) {
      SiteWithPolynomial s = new SiteWithPolynomial(siteVector);
      sites.add(s);
      siteGrid.insert(s);
    }
   
    System.out.println("  time grid: " + stopWatch);
    stopWatch.reset();
    stopWatch.start();
   
    /* approximate a polynomial at each site */

    Map<SiteWithPolynomial, List<SiteWithPolynomial>> nearestSiteMap
      = new HashMap<SiteWithPolynomial, List<SiteWithPolynomial>>();

    for (SiteWithPolynomial site : sites) {
     
      List<SiteWithPolynomial> nearestSites =
          findNearestSites(site.pos.xz(), SITES_FOR_APPROX, false);

      nearestSiteMap.put(site, nearestSites);
     
    }
   
    System.out.println("  time nearest sites: " + stopWatch);
    stopWatch.reset();
    stopWatch.start();

    calculatePolynomials:
    for (SiteWithPolynomial site : sites) {
     
      List<SiteWithPolynomial> nearestSites =
          nearestSiteMap.get(site);
     
      RealVector vector = new ArrayRealVector(SITES_FOR_APPROX);
      RealMatrix matrix = new Array2DRowRealMatrix(
          SITES_FOR_APPROX, DefaultPolynomial.NUM_COEFFS);
     
      for (int row = 0; row < SITES_FOR_APPROX; row++) {
        SiteWithPolynomial nearSite = nearestSites.get(row);
        DefaultPolynomial.populateMatrix(matrix, row, nearSite.pos.x, nearSite.pos.z);
        vector.setEntry(row, nearSite.pos.y);
      }
     
      QRDecomposition qr = new QRDecomposition(matrix);
      RealVector solution = qr.getSolver().solve(vector);
       
      double[] coeffs = solution.toArray();
     
      for (double coeff : coeffs) {
        if (coeff > 10e3) {
          continue calculatePolynomials;
        }
      }
     
      site.setPolynomial(new DefaultPolynomial(coeffs));
     
    }

    System.out.println("  time polyonmials: " + stopWatch);
    stopWatch.reset();
    stopWatch.start();
   
  }
View Full Code Here

        ? terrainEleInterpolatorFactory.make()
        : new ZeroInterpolator();
   
    /* provide known elevations from eleData to the interpolator */
   
    StopWatch stopWatch = new StopWatch();
    stopWatch.start();
       
    if (!(interpolator instanceof ZeroInterpolator)) {
   
      Collection<VectorXYZ> sites = emptyList();
     
      try {
             
        sites = eleData.getSites(mapData);
       
        System.out.println("time getSites: " + stopWatch);
        stopWatch.reset();
        stopWatch.start();
       
      } catch (IOException e) {
        e.printStackTrace();
      }
     
      interpolator.setKnownSites(sites);
     
      System.out.println("time setKnownSites: " + stopWatch);
      stopWatch.reset();
      stopWatch.start();
     
    }
   
    /* interpolate connectors' elevations */
   
    final List<EleConnector> connectors = new ArrayList<EleConnector>();
   
    FaultTolerantIterationUtil.iterate(mapData.getWorldObjects(),
        new Operation<WorldObject>() {
      @Override public void perform(WorldObject worldObject) {
       
        for (EleConnector conn : worldObject.getEleConnectors()) {
          conn.setPosXYZ(interpolator.interpolateEle(conn.pos));
          connectors.add(conn);
        }
       
      }
    });
   
    System.out.println("time terrain interpolation: " + stopWatch);
    stopWatch.reset();
    stopWatch.start();
   
    /* enforce constraints defined by WorldObjects */
   
    boolean debugConstraints = config.getBoolean("debugConstraints", false);
   
    final EleConstraintEnforcer enforcer = debugConstraints
        ? new EleConstraintValidator(mapData,
            eleConstraintEnforcerFactory.make())
        : eleConstraintEnforcerFactory.make();
   
    enforcer.addConnectors(connectors);
   
    if (!(enforcer instanceof NoneEleConstraintEnforcer)) {
     
      FaultTolerantIterationUtil.iterate(mapData.getWorldObjects(),
          new Operation<WorldObject>() {
        @Override public void perform(WorldObject worldObject) {
         
          worldObject.defineEleConstraints(enforcer);
         
        }
      });
     
    }
   
    System.out.println("time add constraints: " + stopWatch);
    stopWatch.reset();
    stopWatch.start();
   
    enforcer.enforceConstraints();
   
    System.out.println("time enforce constraints: " + stopWatch);
    stopWatch.reset();
    stopWatch.start();
   
  }
View Full Code Here

 
  DateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
  Date startDate = formatter.parse("01/01/2010");
  Date endDate = formatter.parse("01/01/2011");
 
  StopWatch stopWatch = new StopWatch();
  stopWatch.start();
  Assert.assertEquals(dao.getTotalNumberOfSalesForPaymentTypeUsingBatch(PaymentType.VISA, startDate, endDate).intValue(), 5448);
  stopWatch.stop();
 
  LOGGER.info("SaleRecordsDAOTest.testGetTotalNumberOfSalesForPaymentTypeUsingBatch - batch fetching took " + stopWatch);
 
    }
View Full Code Here

 
  DateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
  Date startDate = formatter.parse("01/01/2010");
  Date endDate = formatter.parse("01/01/2011");
 
  StopWatch stopWatch = new StopWatch();
  stopWatch.start();
  Assert.assertEquals(dao.getTotalNumberOfSalesForPaymentTypeUsingFethcAll(PaymentType.VISA, startDate, endDate).intValue(), 5448);
  stopWatch.stop();
 
  LOGGER.info("SaleRecordsDAOTest.testGetTotalNumberOfSalesForPaymentTypeUsingFetchAll - batch fetching took " + stopWatch);
 
    }
View Full Code Here

        }

        // Holds any exception that was thrown during startup
        final ObjectHolder errorHolder = new ObjectHolder();

        StopWatch watch = new StopWatch();
        watch.start();

        // Start the server int a seperate thread
        Thread t = new Thread("Geronimo Server Runner") {
            public void run() {
                try {
View Full Code Here

TOP

Related Classes of org.apache.commons.lang.time.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.