List of usage examples for java.util.concurrent TimeUnit MILLISECONDS
TimeUnit MILLISECONDS
To view the source code for java.util.concurrent TimeUnit MILLISECONDS.
Click Source Link
From source file:com.ottogroup.bi.spqr.metrics.MetricsReporterFactory.java
/** * Attaches a {@link GraphiteReporter} to provided {@link MetricsHandler} * @param metricsHandler//from w w w .j av a2s. c o m * @param id * @param period * @param host * @param port * @throws RequiredInputMissingException */ private static void attachGraphiteReporter(final MetricsHandler metricsHandler, final String id, final int period, final String host, final int port) throws RequiredInputMissingException { ////////////////////////////////////////////////////////////////////////// // validate input if (StringUtils.isBlank(id)) throw new RequiredInputMissingException("Missing required metric reporter id"); if (metricsHandler == null) throw new RequiredInputMissingException("Missing required metrics handler"); if (StringUtils.isBlank(host)) throw new RequiredInputMissingException("Missing required graphite host"); if (port < 0) throw new RequiredInputMissingException("Missing required graphite port"); ////////////////////////////////////////////////////////////////////////// final Graphite graphite = new Graphite(new InetSocketAddress(host, port)); final GraphiteReporter reporter = GraphiteReporter.forRegistry(metricsHandler.getRegistry()) .convertRatesTo(TimeUnit.SECONDS).convertDurationsTo(TimeUnit.MILLISECONDS).filter(MetricFilter.ALL) .build(graphite); reporter.start((period > 0 ? period : 1), TimeUnit.SECONDS); metricsHandler.addScheduledReporter(id, reporter); }
From source file:com.joyent.manta.client.MetricReporterSupplier.java
private static JmxReporter buildJmxReporter(final MantaClientMetricConfiguration metricConfig) { return JmxReporter.forRegistry(metricConfig.getRegistry()).convertRatesTo(TimeUnit.SECONDS) .convertDurationsTo(TimeUnit.MILLISECONDS).createsObjectNamesWith((type, domain, name) -> { final String metricJmxObjectName = String.format(MantaClientAgent.FMT_MBEAN_OBJECT_NAME, name, metricConfig.getClientId()); try { return new ObjectName(metricJmxObjectName); } catch (final MalformedObjectNameException e) { final String msg = String.format( "Unable to create JMX object name for metric: %s (name=%s, clientId=%s)", metricJmxObjectName, name, metricConfig.getClientId()); throw new RuntimeException(msg, e); }/*from ww w .ja va 2 s. c o m*/ }).build(); }
From source file:com.ninjas.movietime.conf.vendor.metrics.InstrumentedHttpClientConnectionManager.java
public InstrumentedHttpClientConnectionManager(MetricRegistry metricsRegistry, Registry<ConnectionSocketFactory> socketFactoryRegistry) { this(metricsRegistry, socketFactoryRegistry, -1, TimeUnit.MILLISECONDS); }
From source file:com.ttech.cordovabuild.infrastructure.queue.QueuePoller.java
@Override public void run() { Long builtID = null;//from w w w . j a v a2 s . com while (true) { try { builtID = queue.poll(1000, TimeUnit.MILLISECONDS); if (builtID != null) { ApplicationBuilt built = applicationService.findApplicationBuilt(builtID); listener.onBuilt(built, builtType); } } catch (InterruptedException e) { LOGGER.info("queue polling for {} has been interrupted", e); break; } catch (HazelcastInstanceNotActiveException e) { LOGGER.warn("hazelcast is going down stop threads"); break; } catch (DataAccessException e) { LOGGER.error("could not get applicationBuilt for {}", builtID, e); //TODO implement built failed } catch (Exception e) { LOGGER.error("unexpected error", e); } } }
From source file:io.github.jhipster.config.metrics.GraphiteRegistry.java
public GraphiteRegistry(MetricRegistry metricRegistry, JHipsterProperties jHipsterProperties) { this.jHipsterProperties = jHipsterProperties; if (this.jHipsterProperties.getMetrics().getGraphite().isEnabled()) { log.info("Initializing Metrics Graphite reporting"); String graphiteHost = jHipsterProperties.getMetrics().getGraphite().getHost(); Integer graphitePort = jHipsterProperties.getMetrics().getGraphite().getPort(); String graphitePrefix = jHipsterProperties.getMetrics().getGraphite().getPrefix(); Graphite graphite = new Graphite(new InetSocketAddress(graphiteHost, graphitePort)); GraphiteReporter graphiteReporter = GraphiteReporter.forRegistry(metricRegistry) .convertRatesTo(TimeUnit.SECONDS).convertDurationsTo(TimeUnit.MILLISECONDS) .prefixedWith(graphitePrefix).build(graphite); graphiteReporter.start(1, TimeUnit.MINUTES); }/*from ww w .jav a2s.c om*/ }
From source file:net.qiujuer.common.okhttp.Http.java
private Http() { super(new DefaultResolver(), new DefaultRequestBuilder()); // ConnectTimeOut mOkHttpClient.setConnectTimeout(20 * 1000, TimeUnit.MILLISECONDS); // To intercept the Response interceptToProgressResponse();/*from ww w. j a va2 s. c o m*/ }
From source file:pl.bristleback.server.bristle.engine.netty.WebsocketChannelPipelineFactory.java
public void init(ServerEngine engine) { this.engineConfig = engine.getEngineConfiguration(); webSocketServerHandler.init(engine); Timer timer = new HashedWheelTimer(); idleStateHandler = new IdleStateHandler(timer, engineConfig.getTimeout(), TimeUnit.MILLISECONDS); }
From source file:com.kurento.kmf.thrift.internal.ThriftInterfaceExecutorService.java
/** * Post constructor method; instantiate thread pool. * //w ww . j a v a 2 s . c o m * @throws Exception * Error in the creation of the thread pool */ @PostConstruct public void afterPropertiesSet() throws Exception { executor = new ThreadPoolExecutor(config.getPoolCoreSize(), config.getPoolMaxSize(), config.getPoolExecutionTimeout(), TimeUnit.MILLISECONDS, new LinkedBlockingQueue<Runnable>(config.getPoolMaxQueueSize()), new RejectedExecutionHandler() { @Override public void rejectedExecution(Runnable r, ThreadPoolExecutor exec) { log.warn("Execution is blocked because the thread bounds and queue capacities are reached"); } }); }
From source file:ee.ria.xroad.proxy.serverproxy.IdleConnectionMonitorThread.java
void closeNow() { connectionManager.closeExpiredConnections(); connectionManager.closeIdleConnections(connectionIdleTimeMilliseconds, TimeUnit.MILLISECONDS); }
From source file:org.z.global.util.TimeValue.java
public TimeValue(long millis) { this(millis, TimeUnit.MILLISECONDS); }