public void close() { long duration = System.nanoTime() - startTick; if (result instanceof FileStatus[]) { LOG.debug ("HDFS operation {} with {} takes {} nanoseconds and returns {} files", operation, parameters, duration, ((FileStatus[])result).length); } else { LOG.debug ("HDFS operation {} with {} takes {} nanoseconds", operation, parameters, duration); } this.context.close(); } }
@Override public Timer.Context apply(@Nonnull Timer.Context input) { input.close(); return input; } });
/** * Cleans up any dangling perfLog metric call scopes. */ public void cleanupPerfLogMetrics() { for (Timer.Context context : timerContexts.values()) { context.close(); } timerContexts.clear(); if (totalApiCallsTimerContext != null) { totalApiCallsTimerContext.close(); totalApiCallsTimerContext = null; } } }
@Override protected Object invoke(MethodInvocation invocation, Timer timer, Timed annotation) throws Throwable { final Context timerCtx = timer.time(); try { return invocation.proceed(); } finally { timerCtx.close(); } }
timer.close();
indexProducer.put(message); time.close(); } ).toBlocking().last(); } )
timer.close();
timer.close();
configForTopic = ConfigStoreUtils.getConfigForTopic(this.props.getProperties(), KafkaSource.TOPIC_NAME, this.configClient); context.close();
timer.close();
timer.close();
timer.close();
/** * Write a whole batch to eventhub */ public Future<WriteResponse> write (Batch<String> batch, WriteCallback callback) { Timer.Context context = writeTimer.time(); int returnCode = 0; LOG.info ("Dispatching batch " + batch.getId()); recordsAttempted.mark(batch.getRecords().size()); try { String encoded = encodeBatch(batch); returnCode = request (encoded); WriteResponse<Integer> response = WRITE_RESPONSE_WRAPPER.wrap(returnCode); callback.onSuccess(response); bytesWritten.mark(encoded.length()); recordsSuccess.mark(batch.getRecords().size()); } catch (Exception e) { LOG.error("Dispatching batch " + batch.getId() + " failed :" + e.toString()); callback.onFailure(e); recordsFailed.mark(batch.getRecords().size()); } context.close(); Future<Integer> future = Futures.immediateFuture(returnCode); return new WriteResponseFuture<>(future, WRITE_RESPONSE_WRAPPER); }
private List<WorkUnit> getWorkUnitsForTopic(KafkaTopic topic, SourceState state, Optional<State> topicSpecificState) { Timer.Context context = this.metricContext.timer("isTopicQualifiedTimer").time(); boolean topicQualified = isTopicQualified(topic); context.close(); List<WorkUnit> workUnits = Lists.newArrayList(); for (KafkaPartition partition : topic.getPartitions()) { WorkUnit workUnit = getWorkUnitForTopicPartition(partition, state, topicSpecificState); this.partitionsToBeProcessed.add(partition); if (workUnit != null) { // For disqualified topics, for each of its workunits set the high watermark to be the same // as the low watermark, so that it will be skipped. if (!topicQualified) { skipWorkUnit(workUnit); } workUnits.add(workUnit); } } return workUnits; }
@Override public Status ackMessage(String queueName, UUID queueMessageId ) { if( logger.isTraceEnabled() ){ logger.trace("Acking message for queue {} with id: {}", queueName, queueMessageId); } Timer.Context timer = metricsService.getMetricRegistry().timer( MetricsService.ACK_TIME_TOTAL ).time(); try { QueueAckRequest message = new QueueAckRequest( queueName, queueMessageId ); return sendMessageToLocalRouters( message ); } finally { timer.close(); } }
/** * Closes scope, and records the time taken */ public void close() { if (isOpen) { timerContext.close(); CodahaleMetrics.this.decrementCounter(MetricsConstant.ACTIVE_CALLS + name); } else { LOGGER.warn("Scope named " + name + " is not open, cannot be closed."); } isOpen = false; } }
private void endFunction(String function, MetaStoreEndFunctionContext context) { com.codahale.metrics.Timer.Context timerContext = timerContexts.get().remove(function); if (timerContext != null) { timerContext.close(); } Counter counter = Metrics.getOrCreateCounter(MetricsConstants.ACTIVE_CALLS + function); if (counter != null) { counter.dec(); } for (MetaStoreEndFunctionListener listener : endFunctionListeners) { listener.onEndFunction(function, context); } }
/** * Closes scope, and records the time taken */ public void close() { if (isOpen) { timerContext.close(); CodahaleMetrics.this.decrementCounter(MetricsConstant.ACTIVE_CALLS + name); } else { LOGGER.warn("Scope named " + name + " is not open, cannot be closed."); } isOpen = false; } }