Examples of newThread()


Examples of com.alibaba.druid.util.DaemonThreadFactory.newThread()

            public void run() {
               
            }
        };
        DaemonThreadFactory factory = new DaemonThreadFactory("test");
        Assert.assertEquals("[test-1]", factory.newThread(task).getName());
        Assert.assertEquals("[test-2]", factory.newThread(task).getName());
    }
}
View Full Code Here

Examples of com.packtpub.java7.concurrency.chapter1.recipe12.factory.MyThreadFactory.newThread()

    Thread thread;
   
    // Creates and starts ten Thread objects
    System.out.printf("Starting the Threads\n");
    for (int i=0; i<10; i++){
      thread=factory.newThread(task);
      thread.start();
    }
    // Prints the statistics of the ThreadFactory to the console
    System.out.printf("Factory stats:\n");
    System.out.printf("%s\n",factory.getStats());
View Full Code Here

Examples of com.packtpub.java7.concurrency.chapter7.recipe03.task.MyThreadFactory.newThread()

    MyTask task=new MyTask();
   
    /*
     * Create a Thread using the Factory to execute the Task
     */
    Thread thread=myFactory.newThread(task);
   
    /*
     * Start the Thread
     */
    thread.start();
 
View Full Code Here

Examples of de.fhkn.in.uce.core.concurrent.ThreadGroupThreadFactory.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

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

        ? 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

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

    }

    @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

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

  synchronized void start(UncaughtExceptionHandler eh) {
    ThreadFactory flusherThreadFactory = Threads.newDaemonThreadFactory(
        server.getServerName().toShortString() + "-MemStoreFlusher", eh);
    for (int i = 0; i < flushHandlers.length; i++) {
      flushHandlers[i] = new FlushHandler("MemStoreFlusher." + i);
      flusherThreadFactory.newThread(flushHandlers[i]);
      flushHandlers[i].start();
    }
  }

  boolean isAlive() {
View Full Code Here

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

  private static ThreadFactory newDaemonThreadFactory(final String prefix) {
    final ThreadFactory namedFactory = Threads.getNamedThreadFactory(prefix);
    return new ThreadFactory() {
      @Override
      public Thread newThread(Runnable r) {
        Thread t = namedFactory.newThread(r);
        if (!t.isDaemon()) {
          t.setDaemon(true);
        }
        if (t.getPriority() != Thread.NORM_PRIORITY) {
          t.setPriority(Thread.NORM_PRIORITY);
View Full Code Here

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

        ? 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

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

  public static ThreadFactory newDaemonThreadFactory(final String prefix) {
    final ThreadFactory namedFactory = getNamedThreadFactory(prefix);
    return new ThreadFactory() {
      @Override
      public Thread newThread(Runnable r) {
        Thread t = namedFactory.newThread(r);
        if (!t.isDaemon()) {
          t.setDaemon(true);
        }
        if (t.getPriority() != Thread.NORM_PRIORITY) {
          t.setPriority(Thread.NORM_PRIORITY);
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.