Add AccountCacheImpl.AccountCacheBindingModule
With change If9a5ea1e2d2fd071e0765ebab844c8a87f3c2fbc gerrit doesn't
come up and throws error [1] when remotegerritaccountcache is installed.
Adapt AccountCacheImpl class to use AccountCacheBindingModule for
binding to work correctly.
Bump gerrit plugin API version to stable-3.10 release
[1]
[main] ERROR com.google.gerrit.pgm.Daemon : Unable to start daemon
com.google.inject.CreationException: Unable to create injector, see the following errors:
1) [Guice/BindingAlreadySet]: AccountCache was bound multiple times.
Bound at:
1 : AccountCacheImpl$AccountCacheModule.configure(AccountCacheImpl.java:99)
2 : AccountCacheImpl$AccountCacheBindingModule.configure(AccountCacheImpl.java:86)
Change-Id: I0b83d64b2bbcb49a303edf16d2a7fffed573455b
diff --git a/WORKSPACE b/WORKSPACE
index 31be08e..653549f 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -13,6 +13,6 @@
# Load release Plugin API
gerrit_api(
- plugin_api_sha1 = "72a06d1253d86405c1d78a534181b9fc95f7cfa2",
- version = "3.8.2-1092-g31712ad612",
+ plugin_api_sha1 = "f381f9c10d09e08494c8ca442e978fb6bd84ff7e",
+ version = "3.10.0-rc2-20-g95d1c1c80d",
)
diff --git a/src/main/java/com/googlesource/gerrit/plugins/remotegerritaccountcache/AccountCacheImpl.java b/src/main/java/com/googlesource/gerrit/plugins/remotegerritaccountcache/AccountCacheImpl.java
index 03f0ee8..d6d8a1f 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/remotegerritaccountcache/AccountCacheImpl.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/remotegerritaccountcache/AccountCacheImpl.java
@@ -51,6 +51,7 @@
import com.google.gerrit.server.util.time.TimeUtil;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
+import com.google.inject.AbstractModule;
import com.google.inject.Inject;
import com.google.inject.Provider;
import com.google.inject.Singleton;
@@ -94,7 +95,12 @@
.loader(Loader.class)
.expireAfterWrite(Duration.ofDays(1))
.refreshAfterWrite(Duration.ofHours(23));
+ }
+ }
+ public static class AccountCacheBindingModule extends AbstractModule {
+ @Override
+ protected void configure() {
bind(AccountCacheImpl.class);
bind(AccountCache.class).to(AccountCacheImpl.class);
}