Examples of ThreadFactory


Examples of java.util.concurrent.ThreadFactory

    private volatile WaitingRunnable[] runnableArray = {};
    private volatile boolean closed = false;

    public WaitingThread(int delayMS, final String name, final boolean daemon) {
        this.delayMS = delayMS;
        service = Executors.newSingleThreadExecutor(new ThreadFactory() {
            @NotNull
            @Override
            public Thread newThread(@NotNull Runnable r) {
                Thread t = new Thread(r, name);
                t.setDaemon(daemon);
View Full Code Here

Examples of java.util.concurrent.ThreadFactory

        this.config = new JettyConfig(this.context);
        this.dispatcher = dispatcher;
        this.eventDispatcher = eventDispatcher;
        this.controller = controller;
        this.deployments = new LinkedHashMap<String, Deployment>();
        this.executor = Executors.newSingleThreadExecutor(new ThreadFactory()
        {
            public Thread newThread(Runnable runnable)
            {
                Thread t = new Thread(runnable);
                t.setName("Jetty HTTP Service");
View Full Code Here

Examples of java.util.concurrent.ThreadFactory

    super();
    haveNioMXBean = ManagementFactory.getPlatformMBeanServer().isRegistered(directNio);
    this.period = period;
    try {     
      ManagementFactory.getPlatformMBeanServer().registerMBean(this, OBJECT_NAME);
      scheduler = (ScheduledThreadPoolExecutor) Executors.newScheduledThreadPool(2, new ThreadFactory(){
        public Thread newThread(Runnable r) {
          Thread t = new Thread(r, OBJECT_NAME.getKeyProperty("service") + "Thread#" + serial.incrementAndGet());
          t.setDaemon(true);
          return t;
        }
View Full Code Here

Examples of java.util.concurrent.ThreadFactory

      if (state != JournalImpl.STATE_STOPPED)
      {
         throw new IllegalStateException("Journal is not stopped");
      }

      filesExecutor = Executors.newSingleThreadExecutor(new ThreadFactory()
      {

         public Thread newThread(final Runnable r)
         {
            return new Thread(r, "JournalImpl::FilesExecutor");
         }
      });

      compactorExecutor = Executors.newSingleThreadExecutor(new ThreadFactory()
      {

         public Thread newThread(final Runnable r)
         {
            return new Thread(r, "JournalImpl::CompactorExecutor");
View Full Code Here

Examples of java.util.concurrent.ThreadFactory

     */
    public DefaultThreadPool(final int poolSize, final boolean syncThreads)
    {
        if ( syncThreads )
        {
            threadFactory = new ThreadFactory()
            {

                @Override
                public Thread newThread( final Runnable command )
                {
                    final Thread thread = new SyncThread( command );
                    thread.setPriority( Thread.NORM_PRIORITY );
                    thread.setDaemon( true );

                    return thread;
                }
            };
        }
        else
        {
            threadFactory = new ThreadFactory()
            {

                @Override
                public Thread newThread( final Runnable command )
                {
View Full Code Here

Examples of java.util.concurrent.ThreadFactory

        final int count = Integer.parseInt(args[1]);
        int numThreads = Integer.parseInt(args[2]);
        int numSelectors = args.length > 3 ? Integer.parseInt(args[3]) : 8;
        int timeoutSecs = args.length > 4 ? Integer.parseInt(args[4]) : 10;

        ExecutorService executor = Executors.newFixedThreadPool(numThreads, new ThreadFactory() {

            public Thread newThread(Runnable r) {
                Thread thread = new Thread(r);
                thread.setName("stress-test");
                return thread;
View Full Code Here

Examples of java.util.concurrent.ThreadFactory

    protected EventExecutorGroup createExecutorService() {
        // Provide the executor service for the application
        // and use a Camel thread factory so we have consistent thread namings
        // we should use a shared thread pool as recommended by Netty
        String pattern = getCamelContext().getExecutorServiceManager().getThreadNamePattern();
        ThreadFactory factory = new CamelThreadFactory(pattern, "NettyEventExecutorGroup", true);
        return new DefaultEventExecutorGroup(configuration.getMaximumPoolSize(), factory);
    }
View Full Code Here

Examples of java.util.concurrent.ThreadFactory

        // use ordered thread pool, to ensure we process the events in order, and can send back
        // replies in the expected order. eg this is required by TCP.
        // and use a Camel thread factory so we have consistent thread namings
        // we should use a shared thread pool as recommended by Netty
        String pattern = getCamelContext().getExecutorServiceManager().getThreadNamePattern();
        ThreadFactory factory = new CamelThreadFactory(pattern, "NettyOrderedWorker", true);
        return new OrderedMemoryAwareThreadPoolExecutor(configuration.getMaximumPoolSize(),
                0L, 0L, 30, TimeUnit.SECONDS, factory);
    }
View Full Code Here

Examples of java.util.concurrent.ThreadFactory

  private ClientConnectionManager mockConnectionManager;

  private final ExecutorService executorService;

  public BasicClientTest() {
    ThreadFactory threadFactory = new ThreadFactoryBuilder()
            .setDaemon(true)
            .setNameFormat("hosebird-client-unit-test-%d")
            .build();
    executorService = Executors.newSingleThreadExecutor(threadFactory);
  }
View Full Code Here

Examples of java.util.concurrent.ThreadFactory

     */
    //TODO Implement an integration test to test for jvm exit as part of the standalone example
    // (so we don't have to change the unit test execution model for the core module)
    public void enableSessionValidation() {
        if (this.interval > 0l) {
            this.service = Executors.newSingleThreadScheduledExecutor(new ThreadFactory() {
                public Thread newThread(Runnable r) {
                    Thread thread = new Thread(r);
                    thread.setDaemon(true);
                    return thread;
                }
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.