@Override public void run() { try { log.debug("Running %s (delay %s)", callable, delay); if (callable.call() == Signal.REPEAT) { log.debug("Rescheduling %s (delay %s)", callable, delay); exec.schedule(this, delay.getMillis(), TimeUnit.MILLISECONDS); } else { log.debug("Stopped rescheduling %s (delay %s)", callable, delay); } } catch (Throwable e) { log.error(e, "Uncaught exception."); } } },
@Override public void run() { try { log.debug("Running %s (delay %s)", callable, delay); if (callable.call() == Signal.REPEAT) { log.debug("Rescheduling %s (delay %s)", callable, delay); exec.schedule(this, delay.getMillis(), TimeUnit.MILLISECONDS); } else { log.debug("Stopped rescheduling %s (delay %s)", callable, delay); } } catch (Throwable e) { log.error(e, "Uncaught exception."); } } },
public Map<String, Long> to(String key, Map<String, Long> curr) { final Map<String, Long> prev = prevs.put(key, curr); if (prev != null) { return subtract(curr, prev); } else { log.debug("No previous data for key[%s]", key); return null; } }
public Map<String, Long> to(String key, Map<String, Long> curr) { final Map<String, Long> prev = prevs.put(key, curr); if (prev != null) { return subtract(curr, prev); } else { log.debug("No previous data for key[%s]", key); return null; } }
public Map<String, Long> to(String key, Map<String, Long> curr) { final Map<String, Long> prev = prevs.put(key, curr); if (prev != null) { return subtract(curr, prev); } else { log.debug("No previous data for key[%s]", key); return null; } }
public Map<String, Long> to(String key, Map<String, Long> curr) { final Map<String, Long> prev = prevs.put(key, curr); if (prev != null) { return subtract(curr, prev); } else { log.debug("No previous data for key[%s]", key); return null; } }
@Override public ClientResponse<InputStream> done(ClientResponse<AppendableByteArrayInputStream> clientResponse) { long stopTime = System.currentTimeMillis(); log.debug( "Completed request to url[%s] with %,d bytes returned in %,d millis [%,f b/s].", url, byteCount, stopTime - startTime, byteCount / (0.0001 * (stopTime - startTime)) ); return super.done(clientResponse); } }
private void awaitStarted() { try { if (!startLatch.await(1, TimeUnit.SECONDS)) { throw new RejectedExecutionException("Service is not started."); } if (isTerminated()) { throw new RejectedExecutionException("Service is closed."); } } catch (InterruptedException e) { log.debug("Interrupted waiting for start"); Thread.currentThread().interrupt(); throw new RuntimeException(e); } }
@Override public void run() { if (prevSignal == null || prevSignal == Signal.REPEAT) { exec.schedule(this, rate.getMillis(), TimeUnit.MILLISECONDS); } try { log.debug("Running %s (period %s)", callable, rate); prevSignal = callable.call(); } catch(Throwable e) { log.error(e, "Uncaught exception."); } } },
@Override public void run() { if (prevSignal == null || prevSignal == Signal.REPEAT) { exec.schedule(this, rate.getMillis(), TimeUnit.MILLISECONDS); } try { log.debug("Running %s (period %s)", callable, rate); prevSignal = callable.call(); } catch(Throwable e) { log.error(e, "Uncaught exception."); } } },
private void awaitStarted() { try { if (!startLatch.await(1, TimeUnit.SECONDS)) { throw new RejectedExecutionException("Service is not started."); } if (isTerminated()) { throw new RejectedExecutionException("Service is closed."); } } catch (InterruptedException e) { log.debug("Interrupted waiting for start"); Thread.currentThread().interrupt(); throw new RuntimeException(e); } }
private void awaitStarted() { try { if (!startLatch.await(1, TimeUnit.SECONDS)) { throw new RejectedExecutionException("Service is not started."); } if (isTerminated()) { throw new RejectedExecutionException("Service is closed."); } } catch (InterruptedException e) { log.debug("Interrupted waiting for start"); Thread.currentThread().interrupt(); throw new RuntimeException(e); } }
private static void awaitNextRetry(final Throwable e, final int nTry, final boolean quiet) throws InterruptedException { final long baseSleepMillis = 1000; final long maxSleepMillis = 60000; final double fuzzyMultiplier = Math.min(Math.max(1 + 0.2 * ThreadLocalRandom.current().nextGaussian(), 0), 2); final long sleepMillis = (long) (Math.min(maxSleepMillis, baseSleepMillis * Math.pow(2, nTry - 1)) * fuzzyMultiplier); if (quiet) { log.debug(e, "Failed on try %d, retrying in %,dms.", nTry, sleepMillis); } else { log.warn(e, "Failed on try %d, retrying in %,dms.", nTry, sleepMillis); } Thread.sleep(sleepMillis); } }
private static void awaitNextRetry(final Throwable e, final int nTry, final boolean quiet) throws InterruptedException { final long baseSleepMillis = 1000; final long maxSleepMillis = 60000; final double fuzzyMultiplier = Math.min(Math.max(1 + 0.2 * ThreadLocalRandom.current().nextGaussian(), 0), 2); final long sleepMillis = (long) (Math.min(maxSleepMillis, baseSleepMillis * Math.pow(2, nTry - 1)) * fuzzyMultiplier); if (quiet) { log.debug(e, "Failed on try %d, retrying in %,dms.", nTry, sleepMillis); } else { log.warn(e, "Failed on try %d, retrying in %,dms.", nTry, sleepMillis); } Thread.sleep(sleepMillis); } }
@Override public Cursor apply(@Nullable Cursor input) { log.debug("Running over cursor[%s]", adapter.getInterval(), input.getTime()); return input; } }
@Override public Cursor apply(Cursor input) { log.debug("Running over cursor[%s]", adapter.getInterval(), input.getTime()); return input; } }
@Override public ClientResponse<AppendableByteArrayInputStream> handleResponse(HttpResponse response) { log.debug("Initial response from url[%s]", url); startTime = System.currentTimeMillis(); byteCount += response.getContent().readableBytes(); return super.handleResponse(response); }
@Override public DruidCoordinatorRuntimeParams run(DruidCoordinatorRuntimeParams params) { // Display info about all available segments final Set<DataSegment> availableSegments = coordinator.getAvailableDataSegments(); if (log.isDebugEnabled()) { log.debug("Available DataSegments"); for (DataSegment dataSegment : availableSegments) { log.debug(" %s", dataSegment); } } return params.buildFromExisting() .withAvailableSegments(availableSegments) .build(); } }
public Long getAvailableSize() { long maxSize = getMaxSize(); long sizeUsed = getSizeUsed(); long availableSize = maxSize - sizeUsed; log.debug( "Server[%s], MaxSize[%,d], CurrSize[%,d], QueueSize[%,d], SizeUsed[%,d], AvailableSize[%,d]", server.getName(), maxSize, getCurrServerSize(), getLoadQueueSize(), sizeUsed, availableSize ); return availableSize; }
@Override public void channelDisconnected(ChannelHandlerContext context, ChannelStateEvent event) throws Exception { if (log.isDebugEnabled()) { log.debug("[%s] Channel disconnected", requestDesc); } // response is non-null if we received initial chunk and then exception occurs if (response != null) { handler.exceptionCaught(response, new ChannelException("Channel disconnected")); } channel.close(); channelResourceContainer.returnResource(); if (!retVal.isDone()) { log.warn("[%s] Channel disconnected before response complete", requestDesc); retVal.setException(new ChannelException("Channel disconnected")); } context.sendUpstream(event); }