Introduce mechanism to overload Gerrit core modules
CacheImpl [1] introduced the possibility to overload core Gerrit module with one that is provided by library. This change generalizes it so that any Gerrit core module can be overloaded. How to overload Gerrit core module: * identify module that needs to be overloaded and mark it with @ModuleImpl(name="moduleX") annotation; note that circular dependencies from different module qualifies particular instance as non-candidate * build lib module that provides alternative implementation to the module in question and mark it with the same annotation * place implementation jar under GERRIT_SITE/lib dir and add gerrit.installModule entry with your.package.Module path to gerrit.config. [1] https://gerrit-review.googlesource.com/c/gerrit/+/173162 Change-Id: Ic6dac8d1cc558abdcfd7a1cc257dbd7f8924ff9b Signed-off-by: Jacek Centkowski <jcentkowski@collab.net>
This commit is contained in:

committed by
David Pursehouse

parent
a3cc510fc1
commit
b6e94a00a0
@@ -32,9 +32,9 @@ import com.google.gerrit.lucene.LuceneIndexModule;
|
||||
import com.google.gerrit.metrics.dropwizard.DropWizardMetricMaker;
|
||||
import com.google.gerrit.pgm.util.LogFileCompressor;
|
||||
import com.google.gerrit.server.LibModuleLoader;
|
||||
import com.google.gerrit.server.ModuleOverloader;
|
||||
import com.google.gerrit.server.StartupChecks;
|
||||
import com.google.gerrit.server.account.InternalAccountDirectory;
|
||||
import com.google.gerrit.server.cache.CacheOverrides;
|
||||
import com.google.gerrit.server.cache.h2.H2CacheModule;
|
||||
import com.google.gerrit.server.cache.mem.DefaultMemoryCacheModule;
|
||||
import com.google.gerrit.server.change.ChangeCleanupRunner;
|
||||
@@ -367,7 +367,7 @@ public class WebAppInitializer extends GuiceServletContextListener implements Fi
|
||||
modules.add(new GarbageCollectionModule());
|
||||
modules.add(new ChangeCleanupRunner.Module());
|
||||
return cfgInjector.createChildInjector(
|
||||
CacheOverrides.override(modules, LibModuleLoader.loadModules(cfgInjector)));
|
||||
ModuleOverloader.override(modules, LibModuleLoader.loadModules(cfgInjector)));
|
||||
}
|
||||
|
||||
private Module createIndexModule() {
|
||||
|
Reference in New Issue
Block a user