Package com.google.common.base

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


        }
        ImmutableList.Builder<ChangeData<String>> list = ImmutableList.builder();
        Stopwatch stopwatch = new Stopwatch().start();
        do {
          list.add(result.next());
        } while (result.hasNext() && stopwatch.elapsedMillis() < MAX_MILLIS);
        return new HistoryResult(list.build(), result.hasNext());
      } finally {
        tx.rollback();
      }
    } catch (PermanentFailure e) {
View Full Code Here


    }
    byte[] compressed = compressBytesInflateDeflate(inBytes);
    if (LOG.isDebugEnabled()) {
      sw.stop();
      LOG.debug("UncompressedSize: " + inBytes.length + ", CompressedSize: " + compressed.length
          + ", CompressTime: " + sw.elapsedMillis());
    }
    return compressed;
  }

  public static byte[] uncompressBytes(byte[] inBytes) throws IOException {
View Full Code Here

    }
    byte[] uncompressed = uncompressBytesInflateDeflate(inBytes);
    if (LOG.isDebugEnabled()) {
      sw.stop();
      LOG.debug("CompressedSize: " + inBytes.length + ", UncompressedSize: " + uncompressed.length
          + ", UncompressTimeTaken: " + sw.elapsedMillis());
    }
    return uncompressed;
  }

  private static byte[] compressBytesInflateDeflate(byte[] inBytes) {
View Full Code Here

    }
    MRInputUserPayloadProto userPayloadProto = MRHelpers.parseMRInputPayload(rootInputContext.getUserPayload());
    if (LOG.isDebugEnabled()) {
      sw.stop();
      LOG.debug("Time to parse MRInput payload into prot: "
          + sw.elapsedMillis())
    }
    Configuration conf = MRHelpers.createConfFromByteString(userPayloadProto
        .getConfigurationBytes());
    JobConf jobConf = new JobConf(conf);
    boolean useNewApi = jobConf.getUseNewMapper();
View Full Code Here

    MRInputUserPayloadProto userPayloadProto = MRHelpers
        .parseMRInputPayload(rootInputContext.getUserPayload());
    if (LOG.isDebugEnabled()) {
      sw.stop();
      LOG.debug("Time to parse MRInput payload into prot: "
          + sw.elapsedMillis());
    }
    if (LOG.isDebugEnabled()) {
      sw.reset().start();
    }
    Configuration conf = MRHelpers.createConfFromByteString(userPayloadProto
View Full Code Here

        MRJobConfig.MR_TEZ_INPUT_INITIALIZER_SERIALIZE_EVENT_PAYLAOD,
        MRJobConfig.MR_TEZ_INPUT_INITIALIZER_SERIALIZE_EVENT_PAYLAOD_DEFAULT);
    LOG.info("Emitting serialized splits: " + sendSerializedEvents);
    if (LOG.isDebugEnabled()) {
      sw.stop();
      LOG.debug("Time converting ByteString to configuration: " + sw.elapsedMillis());
    }

    if (LOG.isDebugEnabled()) {
      sw.reset().start();
    }
View Full Code Here

    } else {
      inputSplitInfo = MRHelpers.generateInputSplitsToMem(jobConf);
    }
    if (LOG.isDebugEnabled()) {
      sw.stop();
      LOG.debug("Time to create splits to mem: " + sw.elapsedMillis());
    }

    List<Event> events = Lists.newArrayListWithCapacity(inputSplitInfo
        .getNumTasks() + 1);
   
View Full Code Here

        String url, String expectedContent, int timeoutInMilliseconds
    ) throws InterruptedException {

        final Stopwatch stopwatch = new Stopwatch().start();
        while (true) {
            if (stopwatch.elapsedMillis() > timeoutInMilliseconds) {
                fail(String.format("Unable to fetch url '%s' in less than %d milliseconds",
                    url, timeoutInMilliseconds));
            }

            try {
View Full Code Here

            while (true) {
                Object[] services = tracker.getServices();
                if (services == null || services.length < expectedCardinality) {
                    final int actualCount = (services == null) ? 0 : services.length;
                    if (stopwatch.elapsedMillis() > timeoutInMilliseconds) {
                        fail(String.format("Expected to find %d %s services. Found only %d in %d milliseconds",
                            expectedCardinality, klass.getSimpleName(), actualCount, timeoutInMilliseconds));
                    }

                    LOG.info(String.format("Found %d services implementing %s. Trying again in 1s.",
View Full Code Here

    }

    private void assertJettyStartsInLessThan(int timeoutInMilliseconds) throws InterruptedException {
        Stopwatch stopwatch = new Stopwatch().start();
        while (!isPortOpen(LOCALHOST, DEFAULT_JETTY_PORT)) {
            if (stopwatch.elapsedMillis() > timeoutInMilliseconds) {
                fail(String.format("Jetty did not start listening on port %d in less than %d milliseconds",
                    DEFAULT_JETTY_PORT, timeoutInMilliseconds));
            }

            LOG.info("Waiting 1s for Jetty to listen on port 8181.");
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.