JAMES-2272 Guice injections for MemoryTaskManager
Project: http://git-wip-us.apache.org/repos/asf/james-project/repo Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/4eeede95 Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/4eeede95 Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/4eeede95 Branch: refs/heads/master Commit: 4eeede95c0d82d66509d8b5ff2a669c19b21dd99 Parents: 8c1a067 Author: benwa <[email protected]> Authored: Wed Dec 27 12:15:24 2017 +0700 Committer: benwa <[email protected]> Committed: Thu Jan 4 15:03:36 2018 +0700 ---------------------------------------------------------------------- server/container/guice/guice-common/pom.xml | 4 +++ .../james/modules/CommonServicesModule.java | 6 ++-- .../james/modules/server/TaskManagerModule.java | 34 ++++++++++++++++++++ 3 files changed, 42 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/james-project/blob/4eeede95/server/container/guice/guice-common/pom.xml ---------------------------------------------------------------------- diff --git a/server/container/guice/guice-common/pom.xml b/server/container/guice/guice-common/pom.xml index 25a67c7..45f6696 100644 --- a/server/container/guice/guice-common/pom.xml +++ b/server/container/guice/guice-common/pom.xml @@ -129,6 +129,10 @@ </dependency> <dependency> <groupId>${project.groupId}</groupId> + <artifactId>james-server-task</artifactId> + </dependency> + <dependency> + <groupId>${project.groupId}</groupId> <artifactId>metrics-api</artifactId> </dependency> <dependency> http://git-wip-us.apache.org/repos/asf/james-project/blob/4eeede95/server/container/guice/guice-common/src/main/java/org/apache/james/modules/CommonServicesModule.java ---------------------------------------------------------------------- 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 30d123e..f6f72ba 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,15 +24,16 @@ import java.util.Optional; import javax.inject.Named; import javax.inject.Singleton; -import org.apache.james.server.core.JamesServerResourceLoader; -import org.apache.james.server.core.filesystem.FileSystemImpl; 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.ConfigurationProviderModule; import org.apache.james.modules.server.DNSServiceModule; import org.apache.james.modules.server.DropWizardMetricsModule; +import org.apache.james.modules.server.TaskManagerModule; import org.apache.james.onami.lifecycle.PreDestroyModule; +import org.apache.james.server.core.JamesServerResourceLoader; +import org.apache.james.server.core.filesystem.FileSystemImpl; import org.apache.james.utils.DataProbeImpl; import org.apache.james.utils.GuiceProbe; @@ -56,6 +57,7 @@ public class CommonServicesModule extends AbstractModule { install(new DNSServiceModule()); install(new AsyncTasksExecutorModule()); install(new DropWizardMetricsModule()); + install(new TaskManagerModule()); bind(FileSystemImpl.class).in(Scopes.SINGLETON); http://git-wip-us.apache.org/repos/asf/james-project/blob/4eeede95/server/container/guice/guice-common/src/main/java/org/apache/james/modules/server/TaskManagerModule.java ---------------------------------------------------------------------- diff --git a/server/container/guice/guice-common/src/main/java/org/apache/james/modules/server/TaskManagerModule.java b/server/container/guice/guice-common/src/main/java/org/apache/james/modules/server/TaskManagerModule.java new file mode 100644 index 0000000..b3d1e4f --- /dev/null +++ b/server/container/guice/guice-common/src/main/java/org/apache/james/modules/server/TaskManagerModule.java @@ -0,0 +1,34 @@ +/**************************************************************** + * 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 org.apache.james.task.MemoryTaskManager; +import org.apache.james.task.TaskManager; + +import com.google.inject.AbstractModule; +import com.google.inject.Scopes; + +public class TaskManagerModule extends AbstractModule { + @Override + protected void configure() { + bind(MemoryTaskManager.class).in(Scopes.SINGLETON); + bind(TaskManager.class).to(MemoryTaskManager.class); + } +} --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
