Package java.util.concurrent

Examples of java.util.concurrent.TimeUnit


                // use the default thread pool profile as base and then override with values
                // use a custom pool based on the settings
                int max = getMaxPoolSize() != null ? getMaxPoolSize() : profile.getMaxPoolSize();
                long keepAlive = getKeepAliveTime() != null ? getKeepAliveTime() : profile.getKeepAliveTime();
                int maxQueue = getMaxQueueSize() != null ? getMaxQueueSize() : profile.getMaxQueueSize();
                TimeUnit tu = getTimeUnit() != null ? getTimeUnit() : profile.getTimeUnit();
                RejectedExecutionHandler rejected = profile.getRejectedExecutionHandler();
                if (rejectedPolicy != null) {
                    rejected = rejectedPolicy.asRejectedExecutionHandler();
                }
View Full Code Here


        if (profile != null) {
            // fallback to use values from default profile if not specified
            Integer poolSize = profile.getPoolSize() != null ? profile.getPoolSize() : defaultProfile.getPoolSize();
            Integer maxPoolSize = profile.getMaxPoolSize() != null ? profile.getMaxPoolSize() : defaultProfile.getMaxPoolSize();
            Long keepAliveTime = profile.getKeepAliveTime() != null ? profile.getKeepAliveTime() : defaultProfile.getKeepAliveTime();
            TimeUnit timeUnit = profile.getTimeUnit() != null ? profile.getTimeUnit() : defaultProfile.getTimeUnit();
            Integer maxQueueSize = profile.getMaxQueueSize() != null ? profile.getMaxQueueSize() : defaultProfile.getMaxQueueSize();
            RejectedExecutionHandler handler = profile.getRejectedExecutionHandler() != null ? profile.getRejectedExecutionHandler() : defaultProfile.getRejectedExecutionHandler();
            // create the pool
            return newThreadPool(source, name, poolSize, maxPoolSize, keepAliveTime, timeUnit, maxQueueSize, handler, false);
        } else {
View Full Code Here

        else
        {
            int corePoolSize = Util.parseInt(papoose.getProperty(LOG_SERVICE_CORE_POOL_SIZE), 1);
            int maximumPoolSize = Util.parseInt(papoose.getProperty(LOG_SERVICE_MAX_POOL_SIZE), 5);
            int keepAliveTime = Util.parseInt(papoose.getProperty(LOG_SERVICE_KEEP_ALIVE_TIME), 1);
            TimeUnit unit = Util.parseTimeUnit(papoose.getProperty(LOG_SERVICE_TIME_UNIT), TimeUnit.SECONDS);

            if (LOGGER.isLoggable(Level.FINEST))
            {
                LOGGER.finest("Creating own thread pool");
                LOGGER.finest("corePoolSize: " + corePoolSize);
View Full Code Here

        else
        {
            int corePoolSize = Util.parseInt(papoose.getProperty(LOG_SERVICE_CORE_POOL_SIZE), 1);
            int maximumPoolSize = Util.parseInt(papoose.getProperty(LOG_SERVICE_MAX_POOL_SIZE), 5);
            int keepAliveTime = Util.parseInt(papoose.getProperty(LOG_SERVICE_KEEP_ALIVE_TIME), 1);
            TimeUnit unit = Util.parseTimeUnit(papoose.getProperty(LOG_SERVICE_TIME_UNIT), TimeUnit.SECONDS);

            if (LOGGER.isLoggable(Level.FINEST))
            {
                LOGGER.finest("Creating own thread pool");
                LOGGER.finest("corePoolSize: " + corePoolSize);
View Full Code Here

        ObjectName on = ObjectName.getInstance("org.apache.camel:context=localhost/camel-1,type=context,name=\"camel-1\"");

        Long timeout = (Long) mbeanServer.getAttribute(on, "Timeout");
        assertEquals(300, timeout.longValue());

        TimeUnit unit = (TimeUnit) mbeanServer.getAttribute(on, "TimeUnit");
        assertEquals("seconds", unit.toString().toLowerCase());
    }
View Full Code Here

        if (profile != null) {
            // fallback to use values from default profile if not specified
            Integer poolSize = profile.getPoolSize() != null ? profile.getPoolSize() : defaultProfile.getPoolSize();
            Integer maxPoolSize = profile.getMaxPoolSize() != null ? profile.getMaxPoolSize() : defaultProfile.getMaxPoolSize();
            Long keepAliveTime = profile.getKeepAliveTime() != null ? profile.getKeepAliveTime() : defaultProfile.getKeepAliveTime();
            TimeUnit timeUnit = profile.getTimeUnit() != null ? profile.getTimeUnit() : defaultProfile.getTimeUnit();
            Integer maxQueueSize = profile.getMaxQueueSize() != null ? profile.getMaxQueueSize() : defaultProfile.getMaxQueueSize();
            RejectedExecutionHandler handler = profile.getRejectedExecutionHandler() != null ? profile.getRejectedExecutionHandler() : defaultProfile.getRejectedExecutionHandler();
            // create the pool
            return newThreadPool(threadPoolProfileId, source, name, poolSize, maxPoolSize, keepAliveTime, timeUnit, maxQueueSize, handler, true);
        } else {
View Full Code Here

    protected void waitUntilCompleted() {
        while (!completed.get()) {
            try {
                if (duration > 0) {
                    TimeUnit unit = getTimeUnit();
                    LOG.info("Waiting for: " + duration + " " + unit);
                    latch.await(duration, unit);
                    completed.set(true);
                } else {
                    latch.await();
View Full Code Here

    @Override
    public String toString() {
        if (messageFrequency != null) {
            return "Sample[1 Exchange per " + getMessageFrequency() + " messages received -> " + getOutputs() + "]";
        } else {
            TimeUnit tu = getUnits() != null ? getUnits() : TimeUnit.SECONDS;
            return "Sample[1 Exchange per " + getSamplePeriod() + " " + tu.toString().toLowerCase(Locale.ENGLISH) + " -> " + getOutputs() + "]";
        }
    }
View Full Code Here

    @Override
    public String getLabel() {
        if (messageFrequency != null) {
            return "sample[1 Exchange per " + getMessageFrequency() + " messages received]";
        } else {
            TimeUnit tu = getUnits() != null ? getUnits() : TimeUnit.SECONDS;
            return "sample[1 Exchange per " + getSamplePeriod() + " " + tu.name().toLowerCase(Locale.ENGLISH) + "]";
        }
    }
View Full Code Here

            return new SamplingThrottler(childProcessor, messageFrequency);
        } else {
            // should default be 1 sample period
            long time = getSamplePeriod() != null ? getSamplePeriod() : 1L;
            // should default be in seconds
            TimeUnit tu = getUnits() != null ? getUnits() : TimeUnit.SECONDS;
            return new SamplingThrottler(childProcessor, time, tu);
        }
    }
View Full Code Here

TOP

Related Classes of java.util.concurrent.TimeUnit

Copyright © 2018 www.massapicom. 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.