Package org.springside.modules.utils.ThreadUtils

Examples of org.springside.modules.utils.ThreadUtils.CustomizableThreadFactory


    Runnable runnable = new Runnable() {
      @Override
      public void run() {
      }
    };
    CustomizableThreadFactory factory = new CustomizableThreadFactory("foo");

    Thread thread = factory.newThread(runnable);
    assertEquals("foo-1", thread.getName());

    Thread thread2 = factory.newThread(runnable);
    assertEquals("foo-2", thread2.getName());
  }
View Full Code Here


      synchronized (persistenceLock) {
        restoreQueue();
      }
    }

    executor = Executors.newSingleThreadExecutor(new CustomizableThreadFactory("Queue Consumer-" + queueName));
    executor.execute(this);
  }
View Full Code Here

    Assert.isTrue(period > 0);

    //任何异常不会中断schedule执行
    Runnable task = new DelegatingErrorHandlingRunnable(this, TaskUtils.LOG_AND_SUPPRESS_ERROR_HANDLER);

    scheduledExecutorService = Executors.newSingleThreadScheduledExecutor(new CustomizableThreadFactory(
        "JdkExecutorJob"));

    //scheduleAtFixedRatefixRate() 固定任务两次启动之间的时间间隔.
    //scheduleAtFixedDelay()      固定任务结束后到下一次启动间的时间间隔.
    scheduledExecutorService.scheduleAtFixedRate(task, initialDelay, period, TimeUnit.SECONDS);
View Full Code Here

TOP

Related Classes of org.springside.modules.utils.ThreadUtils.CustomizableThreadFactory

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.