Make ReviewDb available in the server on a per-thread basis

Allow types bound in the system injector to access the per-thread
ReviewDb if they are invoked from within a request context, without
caring about which entry they were invoked from. This allows email
sending and some other change update action code to be bound at the
global level and work in both SSH and HTTP invocations.

Change-Id: I411ded5196ae6920573233fb0cde48f35ce7ad01
This commit is contained in:
Shawn O. Pearce
2012-11-13 16:09:21 -08:00
parent 3d45206d1c
commit 401440f975
17 changed files with 187 additions and 72 deletions

View File

@@ -14,7 +14,9 @@
package com.google.gerrit.server.util;
import com.google.gerrit.server.config.RequestScopedReviewDbProvider;
import com.google.inject.OutOfScopeException;
import com.google.inject.Provider;
import com.google.inject.Scope;
import java.util.concurrent.Callable;
@@ -31,8 +33,10 @@ public abstract class ThreadLocalRequestScopePropagator<C>
private final ThreadLocal<C> threadLocal;
protected ThreadLocalRequestScopePropagator(Scope scope,
ThreadLocal<C> threadLocal, ThreadLocalRequestContext local) {
super(scope, local);
ThreadLocal<C> threadLocal,
ThreadLocalRequestContext local,
Provider<RequestScopedReviewDbProvider> dbProviderProvider) {
super(scope, local, dbProviderProvider);
this.threadLocal = threadLocal;
}