Package com.google.common.base

Examples of com.google.common.base.Stopwatch.elapsedTime()


    Stopwatch sw = new Stopwatch();
    sw.start();
    curSegment.flush(shouldFsync);
    sw.stop();
   
    metrics.addSync(sw.elapsedTime(TimeUnit.MICROSECONDS));
    if (sw.elapsedTime(TimeUnit.MILLISECONDS) > WARN_SYNC_MILLIS_THRESHOLD) {
      LOG.warn("Sync of transaction range " + firstTxnId + "-" + lastTxnId +
               " took " + sw.elapsedTime(TimeUnit.MILLISECONDS) + "ms");
    }
View Full Code Here


    sw.start();
    curSegment.flush(shouldFsync);
    sw.stop();
   
    metrics.addSync(sw.elapsedTime(TimeUnit.MICROSECONDS));
    if (sw.elapsedTime(TimeUnit.MILLISECONDS) > WARN_SYNC_MILLIS_THRESHOLD) {
      LOG.warn("Sync of transaction range " + firstTxnId + "-" + lastTxnId +
               " took " + sw.elapsedTime(TimeUnit.MILLISECONDS) + "ms");
    }

    if (isLagging) {
View Full Code Here

    sw.stop();
   
    metrics.addSync(sw.elapsedTime(TimeUnit.MICROSECONDS));
    if (sw.elapsedTime(TimeUnit.MILLISECONDS) > WARN_SYNC_MILLIS_THRESHOLD) {
      LOG.warn("Sync of transaction range " + firstTxnId + "-" + lastTxnId +
               " took " + sw.elapsedTime(TimeUnit.MILLISECONDS) + "ms");
    }

    if (isLagging) {
      // This batch of edits has already been committed on a quorum of other
      // nodes. So, we are in "catch up" mode. This gets its own metric.
View Full Code Here

      throw new ExecutionException(e);
    } catch (Error e) {
      throw new ExecutionError(e);
    } finally {
      if (!success) {
        globalStatsCounter.recordLoadException(stopwatch.elapsedTime(NANOSECONDS));
      }
    }

    if (result == null) {
      globalStatsCounter.recordLoadException(stopwatch.elapsedTime(NANOSECONDS));
View Full Code Here

        globalStatsCounter.recordLoadException(stopwatch.elapsedTime(NANOSECONDS));
      }
    }

    if (result == null) {
      globalStatsCounter.recordLoadException(stopwatch.elapsedTime(NANOSECONDS));
      throw new InvalidCacheLoadException(loader + " returned null map from loadAll");
    }

    stopwatch.stop();
    // TODO(fry): batch by segment
View Full Code Here

        put(key, value);
      }
    }

    if (nullsPresent) {
      globalStatsCounter.recordLoadException(stopwatch.elapsedTime(NANOSECONDS));
      throw new InvalidCacheLoadException(loader + " returned null keys or values from loadAll");
    }

    // TODO(fry): record count of loaded entries
    globalStatsCounter.recordLoadSuccess(stopwatch.elapsedTime(NANOSECONDS));
View Full Code Here

      globalStatsCounter.recordLoadException(stopwatch.elapsedTime(NANOSECONDS));
      throw new InvalidCacheLoadException(loader + " returned null keys or values from loadAll");
    }

    // TODO(fry): record count of loaded entries
    globalStatsCounter.recordLoadSuccess(stopwatch.elapsedTime(NANOSECONDS));
    return result;
  }

  /**
   * Returns the internal entry for the specified key. The entry may be loading, expired, or
View Full Code Here

        while (AlwaysFailTask.COUNTER.get() != 3 /* = 1 normal execution + 2 retries */) {
            TimeUnit.MILLISECONDS.sleep(100);
        }

        stopwatch.stop();
        assertThat(stopwatch.elapsedTime(TimeUnit.SECONDS)).isGreaterThanOrEqualTo(2);

        processEngine.close();
    }
}
View Full Code Here

            DescribeSpotInstanceRequestsRequest describeRequest = new DescribeSpotInstanceRequestsRequest()
                    .withFilters(new Filter()
                        .withName("launch-group").withValues(businessKey)
                        .withName("state").withValues("open", "active"));
            Stopwatch stopwatch = new Stopwatch().start();
            while (stopwatch.elapsedTime(TimeUnit.MINUTES) < 2) {
                DescribeSpotInstanceRequestsResult result = client.describeSpotInstanceRequests(describeRequest);
                List<SpotInstanceRequest> pending = result.getSpotInstanceRequests();
                if (pending.size() > 0) {
                    LOG.info("Not resending spot instance requests {} for businessKey: {}.", pending, businessKey);
                    execution.setVariable(ProcessVariables.SPOT_INSTANCE_REQUEST_IDS,
View Full Code Here

      if (!emptySources.isEmpty()) {
        prepareEmptySources(readFilter);
      }
      eventsRead += read(events, readFilter);

      if (eventSources.isEmpty() && stopwatch.elapsedTime(unit) > timeout) {
        break;
      }
    }

    return (eventsRead == 0 && emptySources.isEmpty() && eventSources.isEmpty()) ? -1 : eventsRead;
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.