public TimeStat.BlockTimer time() { return time.time(); }
public <V> Callable<V> wrap(Callable<V> callable) { return () -> { try (TimeStat.BlockTimer ignored = time.time()) { return callable.call(); } catch (Exception e) { if (e instanceof MetaException) { metastoreExceptions.update(1); // Need to throw here instead of falling through due to JDK-8059299 totalFailures.update(1); throw e; } if (e instanceof TException) { if (e instanceof TBase) { // This exception is an API response and not a server error throw e; } thriftExceptions.update(1); // Need to throw here instead of falling through due to JDK-8059299 totalFailures.update(1); throw e; } totalFailures.update(1); throw e; } }; }
try (TimeStat.BlockTimer timer = schedulerStats.getSleepTime().time()) { tryGetFutureValue(whenAnyComplete(blockedStages), 1, SECONDS);
public TimeStat.BlockTimer time() { return time.time(); }
public TimeStat.BlockTimer time() { return time.time(); }
public <V> Callable<V> wrap(Callable<V> callable) { return () -> { try (TimeStat.BlockTimer ignored = time.time()) { return callable.call(); } catch (Exception e) { if (e instanceof MetaException) { metastoreExceptions.update(1); // Need to throw here instead of falling through due to JDK-8059299 totalFailures.update(1); throw e; } if (e instanceof TException) { if (e instanceof TBase) { // This exception is an API response and not a server error throw e; } thriftExceptions.update(1); // Need to throw here instead of falling through due to JDK-8059299 totalFailures.update(1); throw e; } totalFailures.update(1); throw e; } }; }
public <V> Callable<V> wrap(Callable<V> callable) { return () -> { try (TimeStat.BlockTimer ignored = time.time()) { return callable.call(); } catch (Exception e) { if (e instanceof MetaException) { metastoreExceptions.update(1); // Need to throw here instead of falling through due to JDK-8059299 totalFailures.update(1); throw e; } if (e instanceof TException) { if (e instanceof TBase) { // This exception is an API response and not a server error throw e; } thriftExceptions.update(1); // Need to throw here instead of falling through due to JDK-8059299 totalFailures.update(1); throw e; } totalFailures.update(1); throw e; } }; }
@Test public void timeTry() throws Exception { TimeStat stat = new TimeStat(ticker); try (BlockTimer ignored = stat.time()) { ticker.increment(10, TimeUnit.MILLISECONDS); } TimeDistribution allTime = stat.getAllTime(); assertEquals(allTime.getCount(), 1.0); assertEquals(allTime.getMin(), 0.010); assertEquals(allTime.getMax(), 0.010); }
@Test public void timeTry() throws Exception { TimeStat stat = new TimeStat(ticker); try (BlockTimer ignored = stat.time()) { ticker.increment(10, TimeUnit.MILLISECONDS); } TimeDistribution allTime = stat.getAllTime(); assertEquals(allTime.getCount(), 1.0); assertEquals(allTime.getMin(), 0.010); assertEquals(allTime.getMax(), 0.010); }
@Test public void time() throws Exception { TimeStat stat = new TimeStat(ticker); stat.time(() -> { ticker.increment(10, TimeUnit.MILLISECONDS); return null; }); TimeDistribution allTime = stat.getAllTime(); assertEquals(allTime.getCount(), 1.0); assertEquals(allTime.getMin(), 0.010); assertEquals(allTime.getMax(), 0.010); }
@Test public void time() throws Exception { TimeStat stat = new TimeStat(ticker); stat.time(() -> { ticker.increment(10, TimeUnit.MILLISECONDS); return null; }); TimeDistribution allTime = stat.getAllTime(); assertEquals(allTime.getCount(), 1.0); assertEquals(allTime.getMin(), 0.010); assertEquals(allTime.getMax(), 0.010); }
public <V> V run(Supplier<V> supplier) { try (TimeStat.BlockTimer ignored = time.time()) { V value = supplier.get(); successes.update(1); return value; } catch (PrestoException e) { if (e.getErrorCode().equals(RAPTOR_BACKUP_NOT_FOUND.toErrorCode())) { successes.update(1); } else if (e.getErrorCode().equals(RAPTOR_BACKUP_TIMEOUT.toErrorCode())) { timeouts.update(1); } else { failures.update(1); } throw e; } } }
public <V> V run(Supplier<V> supplier) { try (TimeStat.BlockTimer ignored = time.time()) { V value = supplier.get(); successes.update(1); return value; } catch (PrestoException e) { if (e.getErrorCode().equals(RAPTOR_BACKUP_NOT_FOUND.toErrorCode())) { successes.update(1); } else if (e.getErrorCode().equals(RAPTOR_BACKUP_TIMEOUT.toErrorCode())) { timeouts.update(1); } else { failures.update(1); } throw e; } } }
try (TimeStat.BlockTimer timer = schedulerStats.getSleepTime().time()) { tryGetFutureValue(whenAnyComplete(blockedStages), 1, SECONDS);
try (TimeStat.BlockTimer timer = schedulerStats.getSleepTime().time()) { tryGetFutureValue(whenAnyComplete(blockedStages), 1, SECONDS);