Package org.apache.openejb.util

Examples of org.apache.openejb.util.DaemonThreadFactory


    public static AsynchronousPool create(final AppContext appContext) {

        final ExecutorBuilder builder = new ExecutorBuilder()
                .prefix("AsynchronousPool")
                .size(3)
                .threadFactory(new DaemonThreadFactory("@Asynchronous", appContext.getId()));

        final Options options = appContext.getOptions();
        final AsynchronousPool asynchronousPool = new AsynchronousPool(
                builder.build(options),
                options.get("AsynchronousPool.ShutdownWaitDuration", new Duration(1, TimeUnit.MINUTES)));
View Full Code Here


            return;
        }

        final ClassLoader loader = Thread.currentThread().getContextClassLoader();
        final String[] split = classesToLoad.trim().split(",");
        final ExecutorService es = Executors.newCachedThreadPool(new DaemonThreadFactory(split));
        for (final String clazz : split) {
            es.submit(new PreLoadClassTask(loader, clazz));
        }
        es.shutdown();
    }
View Full Code Here

        }

        tldUrls.addAll(scan(classLoader.getParent()));

        if (urls.size() > 0) {
            final ExecutorService es = Executors.newFixedThreadPool(2 * Runtime.getRuntime().availableProcessors() + 1, new DaemonThreadFactory("OpenEJB-tld-server-scanning"));

            final Collection<Future<Set<URL>>> futures = new ArrayList<Future<Set<URL>>>(urls.size());
            for (URL url : urls) {
                if (url.getProtocol().equals("jar")) {
                    try {
View Full Code Here

        if (accessTimeout.getUnit() == null) {
            accessTimeout.setUnit(TimeUnit.MILLISECONDS);
        }

        final int qsize = (callbackThreads > 1 ? callbackThreads - 1 : 1);
        final ThreadFactory threadFactory = new DaemonThreadFactory("StatelessPool.worker.");
        this.executor = new ThreadPoolExecutor(
                callbackThreads, callbackThreads * 2,
                1L, TimeUnit.MINUTES, new LinkedBlockingQueue<Runnable>(qsize), threadFactory);

        this.executor.setRejectedExecutionHandler(new RejectedExecutionHandler() {
View Full Code Here

            // Create a thead pool for work manager
            final int threadPoolSize = getIntProperty(serviceInfo.properties, "threadPoolSize", 30);
            final Executor threadPool;
            if (threadPoolSize <= 0) {
                logger.warning("Thread pool for '" + serviceInfo.id + "' is (unbounded), consider setting a size using: " + serviceInfo.id + ".QueueSize=[size]");
                threadPool = Executors.newCachedThreadPool(new DaemonThreadFactory(serviceInfo.id + "-worker-"));
            } else {
                threadPool = new ExecutorBuilder()
                    .size(threadPoolSize)
                    .prefix(serviceInfo.id)
                    .threadFactory(new DaemonThreadFactory(serviceInfo.id + "-worker-"))
                    .build(new Options(serviceInfo.properties, SystemInstance.get().getOptions()));
                logger.info("Thread pool size for '" + serviceInfo.id + "' is (" + threadPoolSize + ")");
            }

            // WorkManager: the resource adapter can use this to dispatch messages or perform tasks
View Full Code Here

    public static AsynchronousPool create(final AppContext appContext) {

        final ExecutorBuilder builder = new ExecutorBuilder()
                .prefix("AsynchronousPool")
                .size(3)
                .threadFactory(new DaemonThreadFactory("@Asynchronous", appContext.getId()));

        return new AsynchronousPool(builder.build(appContext.getOptions()));
    }
View Full Code Here

    public static AsynchronousPool create(AppContext appContext) {

        final ExecutorBuilder builder = new ExecutorBuilder()
                .prefix("AsynchronousPool")
                .size(10)
                .threadFactory(new DaemonThreadFactory("@Asynchronous", appContext.getId()));

        return new AsynchronousPool(builder.build(appContext.getOptions()));
    }
View Full Code Here

TOP

Related Classes of org.apache.openejb.util.DaemonThreadFactory

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.