Examples of TimeValue


Examples of org.elasticsearch.common.unit.TimeValue

        ThreadFactory threadFactory = EsExecutors.daemonThreadFactory(settings, "[" + name + "]");
        if ("same".equals(type)) {
            logger.debug("creating thread_pool [{}], type [{}]", name, type);
            return MoreExecutors.sameThreadExecutor();
        } else if ("cached".equals(type)) {
            TimeValue keepAlive = settings.getAsTime("keep_alive", defaultSettings.getAsTime("keep_alive", timeValueMinutes(5)));
            logger.debug("creating thread_pool [{}], type [{}], keep_alive [{}]", name, type, keepAlive);
            return new ThreadPoolExecutor(0, Integer.MAX_VALUE,
                    keepAlive.millis(), TimeUnit.MILLISECONDS,
                    new SynchronousQueue<Runnable>(),
                    threadFactory);
        } else if ("fixed".equals(type)) {
            int size = settings.getAsInt("size", defaultSettings.getAsInt("size", Runtime.getRuntime().availableProcessors() * 5));
            logger.debug("creating thread_pool [{}], type [{}], size [{}]", name, type, size);
            return new ThreadPoolExecutor(size, size,
                    0L, TimeUnit.MILLISECONDS,
                    new LinkedTransferQueue<Runnable>(),
                    threadFactory);
        } else if ("scaling".equals(type)) {
            TimeValue keepAlive = settings.getAsTime("keep_alive", defaultSettings.getAsTime("keep_alive", timeValueMinutes(5)));
            int min = settings.getAsInt("min", defaultSettings.getAsInt("min", 1));
            int size = settings.getAsInt("size", defaultSettings.getAsInt("size", Runtime.getRuntime().availableProcessors() * 5));
            logger.debug("creating thread_pool [{}], type [{}], min [{}], size [{}], keep_alive [{}]", name, type, min, size, keepAlive);
            return DynamicExecutors.newScalingThreadPool(min, size, keepAlive.millis(), threadFactory);
        } else if ("blocking".equals(type)) {
            TimeValue keepAlive = settings.getAsTime("keep_alive", defaultSettings.getAsTime("keep_alive", timeValueMinutes(5)));
            int min = settings.getAsInt("min", defaultSettings.getAsInt("min", 1));
            int size = settings.getAsInt("size", defaultSettings.getAsInt("size", Runtime.getRuntime().availableProcessors() * 5));
            SizeValue capacity = settings.getAsSize("capacity", defaultSettings.getAsSize("capacity", new SizeValue(0)));
            TimeValue waitTime = settings.getAsTime("wait_time", defaultSettings.getAsTime("wait_time", timeValueSeconds(60)));
            logger.debug("creating thread_pool [{}], type [{}], min [{}], size [{}], keep_alive [{}], wait_time [{}]", name, type, min, size, keepAlive, waitTime);
            return DynamicExecutors.newBlockingThreadPool(min, size, keepAlive.millis(), (int) capacity.singles(), waitTime.millis(), threadFactory);
        }
        throw new ElasticSearchIllegalArgumentException("No type found [" + type + "], for [" + name + "]");
    }
View Full Code Here

Examples of org.elasticsearch.common.unit.TimeValue

        executors.put(Names.SNAPSHOT, build(Names.SNAPSHOT, "scaling", groupSettings.get(Names.SNAPSHOT), ImmutableSettings.Builder.EMPTY_SETTINGS));
        executors.put(Names.SAME, MoreExecutors.sameThreadExecutor());
        this.executors = ImmutableMap.copyOf(executors);
        this.scheduler = Executors.newScheduledThreadPool(1, EsExecutors.daemonThreadFactory(settings, "[scheduler]"));

        TimeValue estimatedTimeInterval = componentSettings.getAsTime("estimated_time_interval", TimeValue.timeValueMillis(200));
        this.estimatedTimeThread = new EstimatedTimeThread(EsExecutors.threadName(settings, "[timer]"), estimatedTimeInterval.millis());
        this.estimatedTimeThread.start();
    }
View Full Code Here

Examples of org.elasticsearch.common.unit.TimeValue

        ThreadFactory threadFactory = EsExecutors.daemonThreadFactory(settings, "[" + name + "]");
        if ("same".equals(type)) {
            logger.debug("creating thread_pool [{}], type [{}]", name, type);
            return MoreExecutors.sameThreadExecutor();
        } else if ("cached".equals(type)) {
            TimeValue keepAlive = settings.getAsTime("keep_alive", defaultSettings.getAsTime("keep_alive", timeValueMinutes(5)));
            logger.debug("creating thread_pool [{}], type [{}], keep_alive [{}]", name, type, keepAlive);
            return new ThreadPoolExecutor(0, Integer.MAX_VALUE,
                    keepAlive.millis(), TimeUnit.MILLISECONDS,
                    new SynchronousQueue<Runnable>(),
                    threadFactory);
        } else if ("fixed".equals(type)) {
            int size = settings.getAsInt("size", defaultSettings.getAsInt("size", Runtime.getRuntime().availableProcessors() * 5));
            logger.debug("creating thread_pool [{}], type [{}], size [{}]", name, type, size);
            return new ThreadPoolExecutor(size, size,
                    0L, TimeUnit.MILLISECONDS,
                    new LinkedTransferQueue<Runnable>(),
                    threadFactory);
        } else if ("scaling".equals(type)) {
            TimeValue keepAlive = settings.getAsTime("keep_alive", defaultSettings.getAsTime("keep_alive", timeValueMinutes(5)));
            int min = settings.getAsInt("min", defaultSettings.getAsInt("min", 1));
            int size = settings.getAsInt("size", defaultSettings.getAsInt("size", Runtime.getRuntime().availableProcessors() * 5));
            logger.debug("creating thread_pool [{}], type [{}], min [{}], size [{}], keep_alive [{}]", name, type, min, size, keepAlive);
            return DynamicExecutors.newScalingThreadPool(min, size, keepAlive.millis(), threadFactory);
        } else if ("blocking".equals(type)) {
            TimeValue keepAlive = settings.getAsTime("keep_alive", defaultSettings.getAsTime("keep_alive", timeValueMinutes(5)));
            int min = settings.getAsInt("min", defaultSettings.getAsInt("min", 1));
            int size = settings.getAsInt("size", defaultSettings.getAsInt("size", Runtime.getRuntime().availableProcessors() * 5));
            SizeValue capacity = settings.getAsSize("capacity", defaultSettings.getAsSize("capacity", new SizeValue(0)));
            TimeValue waitTime = settings.getAsTime("wait_time", defaultSettings.getAsTime("wait_time", timeValueSeconds(60)));
            logger.debug("creating thread_pool [{}], type [{}], min [{}], size [{}], keep_alive [{}], wait_time [{}]", name, type, min, size, keepAlive, waitTime);
            return DynamicExecutors.newBlockingThreadPool(min, size, keepAlive.millis(), (int) capacity.singles(), waitTime.millis(), threadFactory);
        }
        throw new ElasticSearchIllegalArgumentException("No type found [" + type + "], for [" + name + "]");
    }
View Full Code Here

Examples of org.elasticsearch.common.unit.TimeValue

    public double[] getLoadAverage() {
        return loadAverage();
    }

    public TimeValue uptime() {
        return new TimeValue(uptime, TimeUnit.SECONDS);
    }
View Full Code Here

Examples of org.elasticsearch.common.unit.TimeValue

        @Override public void onRefreshSettings(Settings settings) {
            synchronized (mutex) {
                if (state == IndexShardState.CLOSED) {
                    return;
                }
                TimeValue refreshInterval = settings.getAsTime("engine.robin.refresh_interval", settings.getAsTime("index.refresh_interval", InternalIndexShard.this.refreshInterval));
                if (!refreshInterval.equals(InternalIndexShard.this.refreshInterval)) {
                    logger.info("updating refresh_interval from [{}] to [{}]", InternalIndexShard.this.refreshInterval, refreshInterval);
                    if (refreshScheduledFuture != null) {
                        refreshScheduledFuture.cancel(false);
                        refreshScheduledFuture = null;
                    }
                    InternalIndexShard.this.refreshInterval = refreshInterval;
                    if (refreshInterval.millis() > 0) {
                        refreshScheduledFuture = threadPool.schedule(refreshInterval, ThreadPool.Names.SAME, new EngineRefresher());
                    }
                }
            }
        }
View Full Code Here

Examples of org.elasticsearch.common.unit.TimeValue

    /**
     * The total time merges have been executed.
     */
    public TimeValue totalTime() {
        return new TimeValue(totalTimeInMillis);
    }
View Full Code Here

Examples of org.elasticsearch.common.unit.TimeValue

    @Inject public LocalIndexShardGateway(ShardId shardId, @IndexSettings Settings indexSettings, ThreadPool threadPool, IndexShard indexShard) {
        super(shardId, indexSettings);
        this.indexShard = (InternalIndexShard) indexShard;

        TimeValue sync = componentSettings.getAsTime("sync", TimeValue.timeValueSeconds(10));
        if (sync.millis() > 0) {
            this.indexShard.translog().syncOnEachOperation(false);
            // we don't need to execute the sync on a different thread, just do it on the scheduler thread
            flushScheduler = threadPool.scheduleWithFixedDelay(new Sync(), sync);
        } else if (sync.millis() == 0) {
            flushScheduler = null;
            this.indexShard.translog().syncOnEachOperation(true);
        } else {
            flushScheduler = null;
        }
View Full Code Here

Examples of org.elasticsearch.hadoop.util.unit.TimeValue

    private final Log log;
    private final String id;

    HeartBeat(final Progressable progressable, Configuration cfg, TimeValue delay, final Log log) {
        Assert.notNull(progressable, "a valid progressable is required to report status to Hadoop");
        TimeValue tv = HadoopCfgUtils.getTaskTimeout(cfg);
        Assert.isTrue(tv.getSeconds() > delay.getSeconds(), "Hadoop timeout is shorter than the heartbeat");

        this.progressable = progressable;
        this.rate = new TimeValue(tv.getMillis() - delay.getMillis(), TimeUnit.MILLISECONDS);
        this.log = log;

        String taskId;
        TaskID taskID = HadoopCfgUtils.getTaskID(cfg);
View Full Code Here

Examples of org.exist.xquery.value.TimeValue

        } else if (args[1].hasMany()) {
            throw new XPathException(this, ErrorCodes.XPTY0004,
                "Expected at most one xs:time", args[1]);
        } else {
            final DateValue dv = (DateValue)args[0].itemAt(0);
            final TimeValue tv = (TimeValue)args[1].itemAt(0);
            if (!dv.getTimezone().isEmpty()) {
                if (!tv.getTimezone().isEmpty()) {
                    if (!((DayTimeDurationValue)dv.getTimezone().itemAt(0))
                        .compareTo(null, Constants.EQ,
                            ((DayTimeDurationValue)tv.getTimezone().itemAt(0)))) {
                       
                      final ValueSequence argsSeq = new ValueSequence();
                        argsSeq.add(dv);
                        argsSeq.add(tv);
                       
                        throw new XPathException(this, ErrorCodes.FORG0008,
                            "Operands have different timezones", argsSeq);
                    }
                }
            }
            String dtv = ((DateTimeValue)dv.convertTo(Type.DATE_TIME)).getTrimmedCalendar().toXMLFormat();
           
            if (dv.getTimezone().isEmpty()) {
                dtv = dtv.substring(0, dtv.length() - 8);
                result = new DateTimeValue(dtv + tv.getStringValue());
           
            } else if ("PT0S".equals(((DayTimeDurationValue)dv.getTimezone().itemAt(0)).getStringValue())) {
                dtv = dtv.substring(0, dtv.length() - 9);
                if (tv.getTimezone().isEmpty()) {
                    result = new DateTimeValue(dtv + tv.getStringValue() + "Z");
                } else {
                    result = new DateTimeValue(dtv + tv.getStringValue());
                }
           
            } else {
                if (tv.getTimezone().isEmpty()) {
                    final String tz = dtv.substring(19);
                    dtv = dtv.substring(0, dtv.length() - 14);
                    result = new DateTimeValue(dtv + tv.getStringValue() + tz);

                } else {
                    dtv = dtv.substring(0, dtv.length() - 14);
                    result = new DateTimeValue(dtv + tv.getStringValue());
                }
            }
        }
        if (context.getProfiler().isEnabled())
            {context.getProfiler().end(this, "", result);}
View Full Code Here

Examples of org.jboss.profiler.aop.monitoring.model.TimeValue

        MonitoringController.grade = grade;
    }

    public static void openStack(String aggregation, String measure, long eventTime) {
        MonitoringMeasure monitoringMeasure = findMeasure(aggregation, measure);
        TimeValue value = findTimeValue(monitoringMeasure, eventTime);
        value.openStack();
        monitoringMeasure.getRootValue().openStack();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.