Package org.apache.sling.commons.threads

Examples of org.apache.sling.commons.threads.ThreadPoolConfig


            throw new ConfigurationException(ModifiableThreadPoolConfig.PROPERTY_NAME, "Property is missing or empty.");
        }
        this.logger.debug("Updating {} with {}", pid, properties);
        Entry createdEntry = null;
        synchronized ( this.pools ) {
            final ThreadPoolConfig config = this.createConfig(properties);

            Entry foundEntry = null;
            // we have to search the config by using the pid first!
            for (final Entry entry : this.pools.values()) {
                if ( pid.equals(entry.getPid()) ) {
View Full Code Here


        pw.println(HEADLINE);
        pw.println();
        final DefaultThreadPoolManager.Entry[] configs = this.mgr.getConfigurations();
        if ( configs.length > 0 ) {
            for(final DefaultThreadPoolManager.Entry entry : configs ) {
                final ThreadPoolConfig config = entry.getConfig();
                pw.print("Pool ");
                pw.println(entry.getName());
                if ( entry.getPid() != null ) {
                    pw.print("- from configuration : ");
                    pw.println(entry.getPid());
                }
                pw.print("- used : ");
                pw.println(entry.isUsed());
                pw.print("- min pool size : ");
                pw.println(config.getMinPoolSize());
                pw.print("- max pool size : ");
                pw.println(config.getMaxPoolSize());
                pw.print("- queue size : ");
                pw.println(config.getQueueSize());
                pw.print("- keep alive time : ");
                pw.println(config.getKeepAliveTime());
                pw.print("- block policy : ");
                pw.println(config.getBlockPolicy());
                pw.print("- priority : ");
                pw.println(config.getPriority());
                pw.print("- shutdown graceful : ");
                pw.println(config.isShutdownGraceful());
                pw.print("- shutdown wait time : ");
                pw.println(config.getShutdownWaitTimeMs());
                pw.print("- daemon : ");
                pw.println(config.isDaemon());
                final ThreadPoolExecutor tpe = entry.getExecutor();
                if ( tpe != null ) {
                    pw.print("- active count : ");
                    pw.println(tpe.getActiveCount());
                    pw.print("- completed task count : ");
View Full Code Here

            this.name = name;
        } else {
            this.name = DefaultThreadPoolManager.DEFAULT_THREADPOOL_NAME;
        }

        this.configuration = new ThreadPoolConfig(origConfig);

        // factory
        final ThreadFactory delegateThreadFactory;
        if (this.configuration.getFactory() == null) {
            logger.warn("No ThreadFactory is configured. Will use JVM default thread factory."
View Full Code Here

        public void shutdown() {
            // nothing to do
        }

        public ThreadPoolConfig getConfiguration() {
            return new ThreadPoolConfig();
        }
View Full Code Here

        // start background threads
        if ( this.threadPoolManager == null ) {
            throw new Exception("No ThreadPoolManager found.");
        }
        final ThreadPoolConfig config = new ThreadPoolConfig();
        config.setMinPoolSize(10);
        config.setMaxPoolSize(30);
        config.setQueueSize(-1);
        config.setShutdownGraceful(true);
        threadPoolManager.create(EventHelper.THREAD_POOL_NAME, config);

        this.threadPool = threadPoolManager.get(EventHelper.THREAD_POOL_NAME);
        if ( this.threadPool == null ) {
            throw new Exception("No thread pool found.");
View Full Code Here

    protected void activate(final ComponentContext ctx) throws Exception {
        // start background threads
        if ( this.threadPoolManager == null ) {
            throw new Exception("No ThreadPoolManager found.");
        }
        final ThreadPoolConfig config = new ThreadPoolConfig();
        config.setMinPoolSize(OsgiUtil.toInteger(ctx.getProperties().get(PROPERTY_MIN_POOL_SIZE), DEFAULT_MIN_POOL_SIZE));
        config.setMaxPoolSize(OsgiUtil.toInteger(ctx.getProperties().get(PROPERTY_MAX_POOL_SIZE), DEFAULT_MAX_POOL_SIZE));
        config.setQueueSize(OsgiUtil.toInteger(ctx.getProperties().get(PROPERTY_QUEUEL_SIZE), DEFAULT_QUEUE_SIZE));
        config.setShutdownGraceful(true);
        threadPoolManager.create(EventHelper.THREAD_POOL_NAME, config);

        this.threadPool = threadPoolManager.get(EventHelper.THREAD_POOL_NAME);
        if ( this.threadPool == null ) {
            throw new Exception("No thread pool with name " + EventHelper.THREAD_POOL_NAME + " found.");
View Full Code Here

        public void shutdown() {
            // nothing to do
        }

        public ThreadPoolConfig getConfiguration() {
            return new ThreadPoolConfig();
        }
View Full Code Here

            this.name = name;
        } else {
            this.name = DefaultThreadPoolManager.DEFAULT_THREADPOOL_NAME;
        }

        this.configuration = new ThreadPoolConfig(origConfig);

        // factory
        final ThreadFactory delegateThreadFactory;
        if (this.configuration.getFactory() == null) {
            logger.warn("No ThreadFactory is configured. Will use JVM default thread factory."
View Full Code Here

     */
    protected void activate(ComponentContext context) throws Exception {
        this.logger.info("Starting thread pool manager.");
        final ThreadPool defaultPool = new DefaultThreadPool(
                    DEFAULT_THREADPOOL_NAME,
                    new ThreadPoolConfig());
        synchronized ( this.pools ) {
            this.pools.put(defaultPool.getName(), defaultPool);
        }
        this.logger.info("Thread pool manager startet with default pool.");
    }
View Full Code Here

TOP

Related Classes of org.apache.sling.commons.threads.ThreadPoolConfig

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.