private synchronized ExecutorService getExecutorService() { if(!this.executorServiceOptional.isPresent()) { this.executorServiceOptional = Optional.of(MoreExecutors.getExitingExecutorService( (ThreadPoolExecutor) Executors.newCachedThreadPool(ExecutorsUtils.newThreadFactory(Optional.of(LOG), Optional.of("MetricContext-" + getName() + "-%d"))), 5, TimeUnit.MINUTES)); } return this.executorServiceOptional.get(); }
@Override public String toString() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.append("InnerMetricContext Name: "); stringBuilder.append(this.name); if (this.getParent().isPresent()) { stringBuilder.append(", Parent Name: "); stringBuilder.append(this.getParent().get().getName()); } else { stringBuilder.append(", No Parent Context"); } stringBuilder.append(", Number of Children: "); stringBuilder.append(this.getChildContextsAsMap().size()); stringBuilder.append(", Tags: "); stringBuilder.append(Joiner.on(", ").withKeyValueSeparator(" : ").useForNull("NULL").join(this.getTagMap())); return stringBuilder.toString(); } }
this.context.close(); } catch (IOException ioe) { LOGGER.error("Failed to close context: " + this.context.getName(), ioe); } finally { this.countDownLatch.countDown();
GraphiteReporter.Factory.newBuilder().withConnectionType(connectionType) .withConnection(hostname, port).withMetricContextName( this.metricContext.getName()) //contains the current job id .build(properties); } catch (IOException e) {
InfluxDBReporter.Factory.newBuilder().withConnectionType(connectionType) .withConnection(url, username, password, database).withMetricContextName( this.metricContext.getName()) // contains the current job id .build(properties); } catch (IOException e) {
taskContext.getTaskMetrics().getMetricContext(), getForkMetricsTags(this.taskState, index)); this.closer.register(forkMetrics.getMetricContext()); Instrumented.setMetricContextName(this.taskState, forkMetrics.getMetricContext().getName());