Package java.util.concurrent

Examples of java.util.concurrent.ThreadFactory.newThread()


                .newSingleThreadScheduledExecutor(specialThreadsFactory);
        refreshExecutor.schedule(new RefreshAllocationTask(this.controlConnectionWriter, lifetime),
                Math.max(lifetime - ALLOCATION_LIFETIME_ADVANCE, ALLOCATION_LIFETIME_MIN), TimeUnit.SECONDS);
        this.messageHandlerTask = new MessageHandlerTask(this.controlConnection, this.controlConnectionWriter,
                this.relayServerSocketAddress, this.socketQueue, refreshExecutor);
        specialThreadsFactory.newThread(this.messageHandlerTask).start();
    }

    /**
     * Discards the allocation by this client on the relay server. Also
     * terminates the periodic refresh requests for the allocation.
View Full Code Here


    final ThreadFactory backingThreadFactory = builder.backingThreadFactory;
    final AtomicLong count = (nameFormat != null) ? new AtomicLong(0) : null;
    return new ThreadFactory() {
      @Override public Thread newThread(Runnable runnable) {
        Thread thread = (backingThreadFactory != null)
            ? backingThreadFactory.newThread(runnable)
            : new Thread(runnable);
        if (nameFormat != null) {
          thread.setName(String.format(nameFormat, count.getAndIncrement()));
        }
        if (daemon != null) {
View Full Code Here

    }

    @Override
    public Thread newThread(String name, Runnable runnable) {
        ThreadFactory factory = createThreadFactory(name, true);
        return factory.newThread(runnable);
    }

    @Override
    public ExecutorService newDefaultThreadPool(Object source, String name) {
        return newThreadPool(source, name, getDefaultThreadPoolProfile());
View Full Code Here

            }
        };

        // Use an executor service here to avoid explosion of threads???
        ThreadFactory factory = CoreUtils.getThreadFactory("Snapshot Request - " + nonce);
        Thread workThread = factory.newThread(work);
        workThread.start();
    }

    public static String formatHumanReadableDate(long timestamp) {
        SimpleDateFormat sdf = new SimpleDateFormat(Constants.ODBC_DATE_FORMAT_STRING + "z");
View Full Code Here

        ? builder.backingThreadFactory
        : Executors.defaultThreadFactory();
    final AtomicLong count = (nameFormat != null) ? new AtomicLong(0) : null;
    return new ThreadFactory() {
      @Override public Thread newThread(Runnable runnable) {
        Thread thread = backingThreadFactory.newThread(runnable);
        if (nameFormat != null) {
          thread.setName(String.format(nameFormat, count.getAndIncrement()));
        }
        if (daemon != null) {
          thread.setDaemon(daemon);
View Full Code Here

            if ( isExported() ) {
                runtime.getGlobalVariables().set(GLOBAL_VAR_NAME, JavaEmbedUtils.javaToRuby(runtime, this));
            }
            try {
                final RubyWorker worker = newRubyWorker(runtime, workerScript[0], workerScript[1]);
                final Thread workerThread = threadFactory.newThread(worker);
                workers.put(worker, workerThread);
                workerThread.start();
            }
            catch (Exception e) {
                log("[" + getClass().getName() + "] worker startup failed", e);
View Full Code Here

    }

    @Override
    public Thread newThread(String name, Runnable runnable) {
        ThreadFactory factory = createThreadFactory(name, true);
        return factory.newThread(runnable);
    }

    @Override
    public ExecutorService newDefaultThreadPool(Object source, String name) {
        return newThreadPool(source, name, getDefaultThreadPoolProfile());
View Full Code Here

            }
            for (int i = 0; i < connectSelectorThreads; i ++) {
                connectors.add(new NioSelectorRunnable());
            }
            for (NioSelectorRunnable runnable : readers) {
                selectorThreadFactory.newThread(runnable).start();
            }
            for (NioSelectorRunnable runnable : writers) {
                selectorThreadFactory.newThread(runnable).start();
            }
            for (NioSelectorRunnable runnable : connectors) {
View Full Code Here

            }
            for (NioSelectorRunnable runnable : readers) {
                selectorThreadFactory.newThread(runnable).start();
            }
            for (NioSelectorRunnable runnable : writers) {
                selectorThreadFactory.newThread(runnable).start();
            }
            for (NioSelectorRunnable runnable : connectors) {
                selectorThreadFactory.newThread(runnable).start();
            }
            log.debug("Creating NioXnio instance using executor %s, %d read threads, %d write threads, %d connect threads", this.executor, Integer.valueOf(readSelectorThreads), Integer.valueOf(writeSelectorThreads), Integer.valueOf(connectSelectorThreads));
View Full Code Here

            }
            for (NioSelectorRunnable runnable : writers) {
                selectorThreadFactory.newThread(runnable).start();
            }
            for (NioSelectorRunnable runnable : connectors) {
                selectorThreadFactory.newThread(runnable).start();
            }
            log.debug("Creating NioXnio instance using executor %s, %d read threads, %d write threads, %d connect threads", this.executor, Integer.valueOf(readSelectorThreads), Integer.valueOf(writeSelectorThreads), Integer.valueOf(connectSelectorThreads));
        }
    }
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.