You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by bt...@apache.org on 2019/05/28 04:00:32 UTC

[james-project] 05/11: JAMES-2767 AsyncTask is not used anywhere else except ES-2 modules

This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 60d325a8d3ffac5f640bdda41cd28ca410627a4d
Author: Tran Tien Duc <dt...@linagora.com>
AuthorDate: Wed May 22 11:19:13 2019 +0700

    JAMES-2767 AsyncTask is not used anywhere else except ES-2 modules
    
    Remove it
---
 .../apache/james/modules/CommonServicesModule.java |  2 -
 .../modules/server/AsyncTasksExecutorModule.java   | 62 ----------------------
 2 files changed, 64 deletions(-)

diff --git a/server/container/guice/guice-common/src/main/java/org/apache/james/modules/CommonServicesModule.java b/server/container/guice/guice-common/src/main/java/org/apache/james/modules/CommonServicesModule.java
index 7ed083e..cac9fa9 100644
--- a/server/container/guice/guice-common/src/main/java/org/apache/james/modules/CommonServicesModule.java
+++ b/server/container/guice/guice-common/src/main/java/org/apache/james/modules/CommonServicesModule.java
@@ -24,7 +24,6 @@ import javax.inject.Singleton;
 
 import org.apache.james.filesystem.api.FileSystem;
 import org.apache.james.filesystem.api.JamesDirectoriesProvider;
-import org.apache.james.modules.server.AsyncTasksExecutorModule;
 import org.apache.james.modules.server.DNSServiceModule;
 import org.apache.james.modules.server.DropWizardMetricsModule;
 import org.apache.james.modules.server.TaskManagerModule;
@@ -58,7 +57,6 @@ public class CommonServicesModule extends AbstractModule {
         install(new StartablesModule());
         install(new PreDestroyModule());
         install(new DNSServiceModule());
-        install(new AsyncTasksExecutorModule());
         install(new DropWizardMetricsModule());
         install(new TaskManagerModule());
         install(new CleanupTaskModule());
diff --git a/server/container/guice/guice-common/src/main/java/org/apache/james/modules/server/AsyncTasksExecutorModule.java b/server/container/guice/guice-common/src/main/java/org/apache/james/modules/server/AsyncTasksExecutorModule.java
deleted file mode 100644
index fc30b12..0000000
--- a/server/container/guice/guice-common/src/main/java/org/apache/james/modules/server/AsyncTasksExecutorModule.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one   *
- * or more contributor license agreements.  See the NOTICE file *
- * distributed with this work for additional information        *
- * regarding copyright ownership.  The ASF licenses this file   *
- * to you under the Apache License, Version 2.0 (the            *
- * "License"); you may not use this file except in compliance   *
- * with the License.  You may obtain a copy of the License at   *
- *                                                              *
- *   http://www.apache.org/licenses/LICENSE-2.0                 *
- *                                                              *
- * Unless required by applicable law or agreed to in writing,   *
- * software distributed under the License is distributed on an  *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
- * KIND, either express or implied.  See the License for the    *
- * specific language governing permissions and limitations      *
- * under the License.                                           *
- ****************************************************************/
-package org.apache.james.modules.server;
-
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ThreadFactory;
-
-import javax.annotation.PreDestroy;
-
-import org.apache.james.util.concurrent.NamedThreadFactory;
-
-import com.google.inject.AbstractModule;
-import com.google.inject.Provider;
-import com.google.inject.name.Names;
-
-public class AsyncTasksExecutorModule extends AbstractModule {
-
-    private static final int THREAD_POOL_SIZE = 8;
-
-    @Override
-    protected void configure() {
-        ThreadFactory threadFactory = NamedThreadFactory.withClassName(getClass());
-        bind(ExecutorService.class).annotatedWith(Names.named("AsyncExecutor"))
-            .toProvider(new LifecycleAwareExecutorServiceProvider(
-                Executors.newFixedThreadPool(THREAD_POOL_SIZE, threadFactory)));
-    }
-
-    public static class LifecycleAwareExecutorServiceProvider implements Provider<ExecutorService> {
-        private final ExecutorService executorService;
-
-        LifecycleAwareExecutorServiceProvider(ExecutorService executorService) {
-            this.executorService = executorService;
-        }
-
-        @Override
-        public ExecutorService get() {
-            return executorService;
-        }
-
-        @PreDestroy
-        public void stop() {
-            executorService.shutdownNow();
-        }
-    }
-}


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org