Examples of CustomizableThreadFactory


Examples of org.springframework.scheduling.concurrent.CustomizableThreadFactory

  @ManagedOperation
  public void shutDown() {
    if (applicationContext instanceof ConfigurableApplicationContext) {
      ((ConfigurableApplicationContext)applicationContext).stop();

      ExecutorService executorService = Executors.newFixedThreadPool(1, new CustomizableThreadFactory("shell-"));
      executorService.submit(new Runnable() {
        public void run() {
          try {
            try {
              Thread.sleep(5000);
View Full Code Here

Examples of org.springframework.scheduling.concurrent.CustomizableThreadFactory

      System.exit(-1);
    }

    log.info("Running SpringDataServer");
       
    ExecutorService executorService = Executors.newFixedThreadPool(4, new CustomizableThreadFactory("server-"));
    List<Callable<Void>> tasks = new ArrayList<Callable<Void>>();
    if (options.getAppConfig() != null) {
      tasks.add(createIntegrationCallable(options));
    } else if (options.isBatchAdmin() == true ) {
      tasks.add(createAdminCallable());
View Full Code Here

Examples of org.springframework.scheduling.concurrent.CustomizableThreadFactory

 
  private String beanName;
 
  public void afterPropertiesSet() throws Exception {
    if(executorService == null && sendMailThreadPoolSize > 0) {
      executorService = Executors.newFixedThreadPool(sendMailThreadPoolSize,new CustomizableThreadFactory(getClass().getSimpleName()+"-"));
      log.info("create send mail executorService,sendMailThreadPoolSize:"+sendMailThreadPoolSize);
    }
   
    Assert.notNull(javaMailSender,"javaMailSender must be not null");
    Assert.notNull(executorService,"executorService must be not null");
View Full Code Here

Examples of org.springframework.scheduling.concurrent.CustomizableThreadFactory

        FileBlobStore.deleteExecutorService.submit(new DefferredDirectoryDeleteTask(
                pendingDeleteDirectory));
    }

    private void createDeleteExecutorService() {
        CustomizableThreadFactory tf;
        tf = new CustomizableThreadFactory("GWC FileStore delete directory thread-");
        tf.setDaemon(true);
        tf.setThreadPriority(Thread.MIN_PRIORITY);
        deleteExecutorService = Executors.newFixedThreadPool(1);
    }
View Full Code Here

Examples of org.springframework.scheduling.concurrent.CustomizableThreadFactory

        this.seeder = seeder;
        this.scheduledPolls = new ArrayList<PollDef>();
        this.scheduledTasks = new ArrayList<GeoRSSPollTask>();

        final int corePoolSize = 1;
        CustomizableThreadFactory tf = new CustomizableThreadFactory("GWC GeoRSS Poll Tasks-");
        tf.setDaemon(true);
        tf.setThreadPriority(Thread.MIN_PRIORITY + 1);
        schedulingPollExecutorService = Executors.newScheduledThreadPool(corePoolSize, tf);

        schedulingPollExecutorService.submit(new Runnable() {

            public void run() {
View Full Code Here

Examples of org.springframework.scheduling.concurrent.CustomizableThreadFactory

            } catch (IOException e) {
                throw new IOException("BDB DiskQuota could not read "+VERSION_FILE+" to detemine database version", e);
            }
        }
       
        CustomizableThreadFactory tf = new CustomizableThreadFactory("GWC DiskQuota Store Writer-");
        transactionRunner = Executors.newFixedThreadPool(1, tf);
        try {
            configure(storeDirectory);

            deleteStaleLayersAndCreateMissingTileSets();
View Full Code Here

Examples of org.springframework.scheduling.concurrent.CustomizableThreadFactory

    private ScheduledExecutorService createCleanUpExecutor() {

        final int numCleaningThreads = quotaConfig.getMaxConcurrentCleanUps();
        log.info("Setting up disk quota periodic enforcement task");
        CustomizableThreadFactory tf = new CustomizableThreadFactory(
                "GWC DiskQuota clean up thread-");
        tf.setThreadPriority(1 + (Thread.MAX_PRIORITY - Thread.MIN_PRIORITY) / 5);

        ScheduledExecutorService executorService = Executors.newScheduledThreadPool(
                numCleaningThreads, tf);

        return executorService;
View Full Code Here

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

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

      synchronized (persistenceLock) {
        restoreQueue();
      }
    }

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

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

    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
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.