Remove getReviewDbProvider() from RequestContext interface
This method was the source of lots of complexity in reopening ReviewDbs in background threads and Guice request scopes. Thankfully we don't need it anymore. Change-Id: Ifd76484bcf308362c24ca7df38b07f604476c932
This commit is contained in:
		| @@ -17,7 +17,6 @@ package com.google.gerrit.acceptance; | |||||||
| import com.google.gerrit.reviewdb.server.ReviewDb; | import com.google.gerrit.reviewdb.server.ReviewDb; | ||||||
| import com.google.gerrit.server.CurrentUser; | import com.google.gerrit.server.CurrentUser; | ||||||
| import com.google.gerrit.server.RequestCleanup; | import com.google.gerrit.server.RequestCleanup; | ||||||
| import com.google.gerrit.server.config.RequestScopedReviewDbProvider; |  | ||||||
| import com.google.gerrit.server.util.RequestContext; | import com.google.gerrit.server.util.RequestContext; | ||||||
| import com.google.gerrit.server.util.ThreadLocalRequestContext; | import com.google.gerrit.server.util.ThreadLocalRequestContext; | ||||||
| import com.google.gerrit.server.util.ThreadLocalRequestScopePropagator; | import com.google.gerrit.server.util.ThreadLocalRequestScopePropagator; | ||||||
| @@ -29,7 +28,6 @@ import com.google.inject.Key; | |||||||
| import com.google.inject.OutOfScopeException; | import com.google.inject.OutOfScopeException; | ||||||
| import com.google.inject.Provider; | import com.google.inject.Provider; | ||||||
| import com.google.inject.Scope; | import com.google.inject.Scope; | ||||||
| import com.google.inject.util.Providers; |  | ||||||
| import java.util.HashMap; | import java.util.HashMap; | ||||||
| import java.util.Map; | import java.util.Map; | ||||||
|  |  | ||||||
| @@ -37,9 +35,6 @@ import java.util.Map; | |||||||
| public class AcceptanceTestRequestScope { | public class AcceptanceTestRequestScope { | ||||||
|   private static final Key<RequestCleanup> RC_KEY = Key.get(RequestCleanup.class); |   private static final Key<RequestCleanup> RC_KEY = Key.get(RequestCleanup.class); | ||||||
|  |  | ||||||
|   private static final Key<RequestScopedReviewDbProvider> DB_KEY = |  | ||||||
|       Key.get(RequestScopedReviewDbProvider.class); |  | ||||||
|  |  | ||||||
|   public static class Context implements RequestContext { |   public static class Context implements RequestContext { | ||||||
|     private final RequestCleanup cleanup = new RequestCleanup(); |     private final RequestCleanup cleanup = new RequestCleanup(); | ||||||
|     private final Map<Key<?>, Object> map = new HashMap<>(); |     private final Map<Key<?>, Object> map = new HashMap<>(); | ||||||
| @@ -57,7 +52,6 @@ public class AcceptanceTestRequestScope { | |||||||
|       user = u; |       user = u; | ||||||
|       created = started = finished = at; |       created = started = finished = at; | ||||||
|       map.put(RC_KEY, cleanup); |       map.put(RC_KEY, cleanup); | ||||||
|       map.put(DB_KEY, new RequestScopedReviewDbProvider(schemaFactory, Providers.of(cleanup))); |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     private Context(Context p, SshSession s, CurrentUser c) { |     private Context(Context p, SshSession s, CurrentUser c) { | ||||||
| @@ -78,11 +72,6 @@ public class AcceptanceTestRequestScope { | |||||||
|       return user; |       return user; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @Override |  | ||||||
|     public Provider<ReviewDb> getReviewDbProvider() { |  | ||||||
|       return (RequestScopedReviewDbProvider) map.get(DB_KEY); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     synchronized <T> T get(Key<T> key, Provider<T> creator) { |     synchronized <T> T get(Key<T> key, Provider<T> creator) { | ||||||
|       @SuppressWarnings("unchecked") |       @SuppressWarnings("unchecked") | ||||||
|       T t = (T) map.get(key); |       T t = (T) map.get(key); | ||||||
| @@ -112,11 +101,8 @@ public class AcceptanceTestRequestScope { | |||||||
|     private final AcceptanceTestRequestScope atrScope; |     private final AcceptanceTestRequestScope atrScope; | ||||||
|  |  | ||||||
|     @Inject |     @Inject | ||||||
|     Propagator( |     Propagator(AcceptanceTestRequestScope atrScope, ThreadLocalRequestContext local) { | ||||||
|         AcceptanceTestRequestScope atrScope, |       super(REQUEST, current, local); | ||||||
|         ThreadLocalRequestContext local, |  | ||||||
|         Provider<RequestScopedReviewDbProvider> dbProviderProvider) { |  | ||||||
|       super(REQUEST, current, local, dbProviderProvider); |  | ||||||
|       this.atrScope = atrScope; |       this.atrScope = atrScope; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -28,7 +28,6 @@ import com.google.gerrit.server.IdentifiedUser; | |||||||
| import com.google.gerrit.server.RemotePeer; | import com.google.gerrit.server.RemotePeer; | ||||||
| import com.google.gerrit.server.RequestCleanup; | import com.google.gerrit.server.RequestCleanup; | ||||||
| import com.google.gerrit.server.config.GerritRequestModule; | import com.google.gerrit.server.config.GerritRequestModule; | ||||||
| import com.google.gerrit.server.config.RequestScopedReviewDbProvider; |  | ||||||
| import com.google.gerrit.server.git.DefaultAdvertiseRefsHook; | import com.google.gerrit.server.git.DefaultAdvertiseRefsHook; | ||||||
| import com.google.gerrit.server.git.ReceivePackInitializer; | import com.google.gerrit.server.git.ReceivePackInitializer; | ||||||
| import com.google.gerrit.server.git.TransferConfig; | import com.google.gerrit.server.git.TransferConfig; | ||||||
| @@ -56,7 +55,6 @@ import com.google.inject.Provider; | |||||||
| import com.google.inject.Provides; | import com.google.inject.Provides; | ||||||
| import com.google.inject.Scope; | import com.google.inject.Scope; | ||||||
| import com.google.inject.servlet.RequestScoped; | import com.google.inject.servlet.RequestScoped; | ||||||
| import com.google.inject.util.Providers; |  | ||||||
| import java.io.IOException; | import java.io.IOException; | ||||||
| import java.net.SocketAddress; | import java.net.SocketAddress; | ||||||
| import java.util.HashMap; | import java.util.HashMap; | ||||||
| @@ -123,10 +121,8 @@ class InProcessProtocol extends TestProtocol<Context> { | |||||||
|  |  | ||||||
|   private static class Propagator extends ThreadLocalRequestScopePropagator<Context> { |   private static class Propagator extends ThreadLocalRequestScopePropagator<Context> { | ||||||
|     @Inject |     @Inject | ||||||
|     Propagator( |     Propagator(ThreadLocalRequestContext local) { | ||||||
|         ThreadLocalRequestContext local, |       super(REQUEST, current, local); | ||||||
|         Provider<RequestScopedReviewDbProvider> dbProviderProvider) { |  | ||||||
|       super(REQUEST, current, local, dbProviderProvider); |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
| @@ -151,8 +147,6 @@ class InProcessProtocol extends TestProtocol<Context> { | |||||||
|    * request. |    * request. | ||||||
|    */ |    */ | ||||||
|   static class Context implements RequestContext { |   static class Context implements RequestContext { | ||||||
|     private static final Key<RequestScopedReviewDbProvider> DB_KEY = |  | ||||||
|         Key.get(RequestScopedReviewDbProvider.class); |  | ||||||
|     private static final Key<RequestCleanup> RC_KEY = Key.get(RequestCleanup.class); |     private static final Key<RequestCleanup> RC_KEY = Key.get(RequestCleanup.class); | ||||||
|     private static final Key<CurrentUser> USER_KEY = Key.get(CurrentUser.class); |     private static final Key<CurrentUser> USER_KEY = Key.get(CurrentUser.class); | ||||||
|  |  | ||||||
| @@ -174,7 +168,6 @@ class InProcessProtocol extends TestProtocol<Context> { | |||||||
|       this.project = project; |       this.project = project; | ||||||
|       map = new HashMap<>(); |       map = new HashMap<>(); | ||||||
|       cleanup = new RequestCleanup(); |       cleanup = new RequestCleanup(); | ||||||
|       map.put(DB_KEY, new RequestScopedReviewDbProvider(schemaFactory, Providers.of(cleanup))); |  | ||||||
|       map.put(RC_KEY, cleanup); |       map.put(RC_KEY, cleanup); | ||||||
|  |  | ||||||
|       IdentifiedUser user = userFactory.create(accountId); |       IdentifiedUser user = userFactory.create(accountId); | ||||||
| @@ -191,11 +184,6 @@ class InProcessProtocol extends TestProtocol<Context> { | |||||||
|       return get(USER_KEY, null); |       return get(USER_KEY, null); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @Override |  | ||||||
|     public Provider<ReviewDb> getReviewDbProvider() { |  | ||||||
|       return get(DB_KEY, null); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     private synchronized <T> T get(Key<T> key, Provider<T> creator) { |     private synchronized <T> T get(Key<T> key, Provider<T> creator) { | ||||||
|       @SuppressWarnings("unchecked") |       @SuppressWarnings("unchecked") | ||||||
|       T t = (T) map.get(key); |       T t = (T) map.get(key); | ||||||
|   | |||||||
| @@ -25,7 +25,6 @@ import com.google.gerrit.extensions.api.groups.GroupInput; | |||||||
| import com.google.gerrit.extensions.restapi.ResourceNotFoundException; | import com.google.gerrit.extensions.restapi.ResourceNotFoundException; | ||||||
| import com.google.gerrit.launcher.GerritLauncher; | import com.google.gerrit.launcher.GerritLauncher; | ||||||
| import com.google.gerrit.reviewdb.client.Account; | import com.google.gerrit.reviewdb.client.Account; | ||||||
| import com.google.gerrit.reviewdb.server.ReviewDb; |  | ||||||
| import com.google.gerrit.server.CurrentUser; | import com.google.gerrit.server.CurrentUser; | ||||||
| import com.google.gerrit.server.config.SitePaths; | import com.google.gerrit.server.config.SitePaths; | ||||||
| import com.google.gerrit.server.util.ManualRequestContext; | import com.google.gerrit.server.util.ManualRequestContext; | ||||||
| @@ -34,7 +33,6 @@ import com.google.gerrit.server.util.RequestContext; | |||||||
| import com.google.gerrit.testing.ConfigSuite; | import com.google.gerrit.testing.ConfigSuite; | ||||||
| import com.google.inject.Injector; | import com.google.inject.Injector; | ||||||
| import com.google.inject.Module; | import com.google.inject.Module; | ||||||
| import com.google.inject.Provider; |  | ||||||
| import java.io.File; | import java.io.File; | ||||||
| import java.util.Arrays; | import java.util.Arrays; | ||||||
| import java.util.Collections; | import java.util.Collections; | ||||||
| @@ -82,11 +80,6 @@ public abstract class StandaloneSiteTest { | |||||||
|       return ctx.getUser(); |       return ctx.getUser(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @Override |  | ||||||
|     public Provider<ReviewDb> getReviewDbProvider() { |  | ||||||
|       return ctx.getReviewDbProvider(); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     public Injector getInjector() { |     public Injector getInjector() { | ||||||
|       return server.getTestInjector(); |       return server.getTestInjector(); | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -15,30 +15,20 @@ | |||||||
| package com.google.gerrit.httpd; | package com.google.gerrit.httpd; | ||||||
|  |  | ||||||
| import com.google.gerrit.extensions.registration.DynamicItem; | import com.google.gerrit.extensions.registration.DynamicItem; | ||||||
| import com.google.gerrit.reviewdb.server.ReviewDb; |  | ||||||
| import com.google.gerrit.server.CurrentUser; | import com.google.gerrit.server.CurrentUser; | ||||||
| import com.google.gerrit.server.config.RequestScopedReviewDbProvider; |  | ||||||
| import com.google.gerrit.server.util.RequestContext; | import com.google.gerrit.server.util.RequestContext; | ||||||
| import com.google.inject.Inject; | import com.google.inject.Inject; | ||||||
| import com.google.inject.Provider; |  | ||||||
|  |  | ||||||
| class HttpRequestContext implements RequestContext { | class HttpRequestContext implements RequestContext { | ||||||
|   private final DynamicItem<WebSession> session; |   private final DynamicItem<WebSession> session; | ||||||
|   private final RequestScopedReviewDbProvider provider; |  | ||||||
|  |  | ||||||
|   @Inject |   @Inject | ||||||
|   HttpRequestContext(DynamicItem<WebSession> session, RequestScopedReviewDbProvider provider) { |   HttpRequestContext(DynamicItem<WebSession> session) { | ||||||
|     this.session = session; |     this.session = session; | ||||||
|     this.provider = provider; |  | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   @Override |   @Override | ||||||
|   public CurrentUser getUser() { |   public CurrentUser getUser() { | ||||||
|     return session.get().getUser(); |     return session.get().getUser(); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   @Override |  | ||||||
|   public Provider<ReviewDb> getReviewDbProvider() { |  | ||||||
|     return provider; |  | ||||||
|   } |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -35,11 +35,7 @@ import com.google.gerrit.server.patch.PatchSetInfoFactory; | |||||||
| import com.google.gerrit.server.util.LabelVote; | import com.google.gerrit.server.util.LabelVote; | ||||||
| import com.google.gerrit.server.util.RequestContext; | import com.google.gerrit.server.util.RequestContext; | ||||||
| import com.google.gerrit.server.util.ThreadLocalRequestContext; | import com.google.gerrit.server.util.ThreadLocalRequestContext; | ||||||
| import com.google.gwtorm.server.OrmException; |  | ||||||
| import com.google.gwtorm.server.SchemaFactory; |  | ||||||
| import com.google.inject.Inject; | import com.google.inject.Inject; | ||||||
| import com.google.inject.Provider; |  | ||||||
| import com.google.inject.ProvisionException; |  | ||||||
| import com.google.inject.assistedinject.Assisted; | import com.google.inject.assistedinject.Assisted; | ||||||
| import java.util.List; | import java.util.List; | ||||||
| import java.util.concurrent.ExecutorService; | import java.util.concurrent.ExecutorService; | ||||||
| @@ -82,7 +78,6 @@ public class EmailReviewComments implements Runnable, RequestContext { | |||||||
|   private final ExecutorService sendEmailsExecutor; |   private final ExecutorService sendEmailsExecutor; | ||||||
|   private final PatchSetInfoFactory patchSetInfoFactory; |   private final PatchSetInfoFactory patchSetInfoFactory; | ||||||
|   private final CommentSender.Factory commentSenderFactory; |   private final CommentSender.Factory commentSenderFactory; | ||||||
|   private final SchemaFactory<ReviewDb> schemaFactory; |  | ||||||
|   private final ThreadLocalRequestContext requestContext; |   private final ThreadLocalRequestContext requestContext; | ||||||
|  |  | ||||||
|   private final NotifyHandling notify; |   private final NotifyHandling notify; | ||||||
| @@ -101,7 +96,6 @@ public class EmailReviewComments implements Runnable, RequestContext { | |||||||
|       @SendEmailExecutor ExecutorService executor, |       @SendEmailExecutor ExecutorService executor, | ||||||
|       PatchSetInfoFactory patchSetInfoFactory, |       PatchSetInfoFactory patchSetInfoFactory, | ||||||
|       CommentSender.Factory commentSenderFactory, |       CommentSender.Factory commentSenderFactory, | ||||||
|       SchemaFactory<ReviewDb> schemaFactory, |  | ||||||
|       ThreadLocalRequestContext requestContext, |       ThreadLocalRequestContext requestContext, | ||||||
|       @Assisted NotifyHandling notify, |       @Assisted NotifyHandling notify, | ||||||
|       @Assisted ListMultimap<RecipientType, Account.Id> accountsToNotify, |       @Assisted ListMultimap<RecipientType, Account.Id> accountsToNotify, | ||||||
| @@ -115,7 +109,6 @@ public class EmailReviewComments implements Runnable, RequestContext { | |||||||
|     this.sendEmailsExecutor = executor; |     this.sendEmailsExecutor = executor; | ||||||
|     this.patchSetInfoFactory = patchSetInfoFactory; |     this.patchSetInfoFactory = patchSetInfoFactory; | ||||||
|     this.commentSenderFactory = commentSenderFactory; |     this.commentSenderFactory = commentSenderFactory; | ||||||
|     this.schemaFactory = schemaFactory; |  | ||||||
|     this.requestContext = requestContext; |     this.requestContext = requestContext; | ||||||
|     this.notify = notify; |     this.notify = notify; | ||||||
|     this.accountsToNotify = accountsToNotify; |     this.accountsToNotify = accountsToNotify; | ||||||
| @@ -168,21 +161,4 @@ public class EmailReviewComments implements Runnable, RequestContext { | |||||||
|   public CurrentUser getUser() { |   public CurrentUser getUser() { | ||||||
|     return user.getRealUser(); |     return user.getRealUser(); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   @Override |  | ||||||
|   public Provider<ReviewDb> getReviewDbProvider() { |  | ||||||
|     return new Provider<ReviewDb>() { |  | ||||||
|       @Override |  | ||||||
|       public ReviewDb get() { |  | ||||||
|         if (db == null) { |  | ||||||
|           try { |  | ||||||
|             db = schemaFactory.open(); |  | ||||||
|           } catch (OrmException e) { |  | ||||||
|             throw new ProvisionException("Cannot open ReviewDb", e); |  | ||||||
|           } |  | ||||||
|         } |  | ||||||
|         return db; |  | ||||||
|       } |  | ||||||
|     }; |  | ||||||
|   } |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -26,7 +26,6 @@ public class GerritRequestModule extends FactoryModule { | |||||||
|   @Override |   @Override | ||||||
|   protected void configure() { |   protected void configure() { | ||||||
|     bind(RequestCleanup.class).in(RequestScoped.class); |     bind(RequestCleanup.class).in(RequestScoped.class); | ||||||
|     bind(RequestScopedReviewDbProvider.class); |  | ||||||
|     bind(IdentifiedUser.RequestFactory.class).in(SINGLETON); |     bind(IdentifiedUser.RequestFactory.class).in(SINGLETON); | ||||||
|   } |   } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -1,66 +0,0 @@ | |||||||
| // Copyright (C) 2009 The Android Open Source Project |  | ||||||
| // |  | ||||||
| // Licensed 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 com.google.gerrit.server.config; |  | ||||||
|  |  | ||||||
| import com.google.gerrit.reviewdb.server.ReviewDb; |  | ||||||
| import com.google.gerrit.server.RequestCleanup; |  | ||||||
| import com.google.gwtorm.server.OrmException; |  | ||||||
| import com.google.gwtorm.server.SchemaFactory; |  | ||||||
| import com.google.inject.Inject; |  | ||||||
| import com.google.inject.Provider; |  | ||||||
| import com.google.inject.ProvisionException; |  | ||||||
| import com.google.inject.servlet.RequestScoped; |  | ||||||
|  |  | ||||||
| /** Provides {@link ReviewDb} database handle live only for this request. */ |  | ||||||
| @RequestScoped |  | ||||||
| public class RequestScopedReviewDbProvider implements Provider<ReviewDb> { |  | ||||||
|   private final SchemaFactory<ReviewDb> schema; |  | ||||||
|   private final Provider<RequestCleanup> cleanup; |  | ||||||
|   private ReviewDb db; |  | ||||||
|  |  | ||||||
|   @Inject |  | ||||||
|   public RequestScopedReviewDbProvider( |  | ||||||
|       final SchemaFactory<ReviewDb> schema, Provider<RequestCleanup> cleanup) { |  | ||||||
|     this.schema = schema; |  | ||||||
|     this.cleanup = cleanup; |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   @SuppressWarnings("resource") |  | ||||||
|   @Override |  | ||||||
|   public ReviewDb get() { |  | ||||||
|     if (db == null) { |  | ||||||
|       ReviewDb c; |  | ||||||
|       try { |  | ||||||
|         c = schema.open(); |  | ||||||
|       } catch (OrmException e) { |  | ||||||
|         throw new ProvisionException("Cannot open ReviewDb", e); |  | ||||||
|       } |  | ||||||
|       try { |  | ||||||
|         cleanup |  | ||||||
|             .get() |  | ||||||
|             .add( |  | ||||||
|                 () -> { |  | ||||||
|                   c.close(); |  | ||||||
|                   db = null; |  | ||||||
|                 }); |  | ||||||
|       } catch (Throwable e) { |  | ||||||
|         c.close(); |  | ||||||
|         throw new ProvisionException("Cannot defer cleanup of ReviewDb", e); |  | ||||||
|       } |  | ||||||
|       db = c; |  | ||||||
|     } |  | ||||||
|     return db; |  | ||||||
|   } |  | ||||||
| } |  | ||||||
| @@ -14,7 +14,6 @@ | |||||||
|  |  | ||||||
| package com.google.gerrit.server.git; | package com.google.gerrit.server.git; | ||||||
|  |  | ||||||
| import com.google.gerrit.server.config.RequestScopedReviewDbProvider; |  | ||||||
| import com.google.gerrit.server.util.RequestContext; | import com.google.gerrit.server.util.RequestContext; | ||||||
| import com.google.gerrit.server.util.ThreadLocalRequestContext; | import com.google.gerrit.server.util.ThreadLocalRequestContext; | ||||||
| import com.google.gerrit.server.util.ThreadLocalRequestScopePropagator; | import com.google.gerrit.server.util.ThreadLocalRequestScopePropagator; | ||||||
| @@ -52,10 +51,8 @@ public class PerThreadRequestScope { | |||||||
|  |  | ||||||
|   public static class Propagator extends ThreadLocalRequestScopePropagator<Context> { |   public static class Propagator extends ThreadLocalRequestScopePropagator<Context> { | ||||||
|     @Inject |     @Inject | ||||||
|     Propagator( |     Propagator(ThreadLocalRequestContext local) { | ||||||
|         ThreadLocalRequestContext local, |       super(REQUEST, current, local); | ||||||
|         Provider<RequestScopedReviewDbProvider> dbProviderProvider) { |  | ||||||
|       super(REQUEST, current, local, dbProviderProvider); |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|   | |||||||
| @@ -87,7 +87,6 @@ import com.google.gerrit.reviewdb.client.PatchSetInfo; | |||||||
| import com.google.gerrit.reviewdb.client.Project; | import com.google.gerrit.reviewdb.client.Project; | ||||||
| import com.google.gerrit.reviewdb.client.RefNames; | import com.google.gerrit.reviewdb.client.RefNames; | ||||||
| import com.google.gerrit.reviewdb.client.RevId; | import com.google.gerrit.reviewdb.client.RevId; | ||||||
| import com.google.gerrit.reviewdb.server.ReviewDb; |  | ||||||
| import com.google.gerrit.server.ApprovalsUtil; | import com.google.gerrit.server.ApprovalsUtil; | ||||||
| import com.google.gerrit.server.ChangeUtil; | import com.google.gerrit.server.ChangeUtil; | ||||||
| import com.google.gerrit.server.CreateGroupPermissionSyncer; | import com.google.gerrit.server.CreateGroupPermissionSyncer; | ||||||
| @@ -315,7 +314,6 @@ class ReceiveCommits { | |||||||
|   private final ReplaceOp.Factory replaceOpFactory; |   private final ReplaceOp.Factory replaceOpFactory; | ||||||
|   private final RetryHelper retryHelper; |   private final RetryHelper retryHelper; | ||||||
|   private final RequestScopePropagator requestScopePropagator; |   private final RequestScopePropagator requestScopePropagator; | ||||||
|   private final ReviewDb db; |  | ||||||
|   private final Sequences seq; |   private final Sequences seq; | ||||||
|   private final SetHashtagsOp.Factory hashtagsFactory; |   private final SetHashtagsOp.Factory hashtagsFactory; | ||||||
|   private final SubmoduleOp.Factory subOpFactory; |   private final SubmoduleOp.Factory subOpFactory; | ||||||
| @@ -391,7 +389,6 @@ class ReceiveCommits { | |||||||
|       ReplaceOp.Factory replaceOpFactory, |       ReplaceOp.Factory replaceOpFactory, | ||||||
|       RetryHelper retryHelper, |       RetryHelper retryHelper, | ||||||
|       RequestScopePropagator requestScopePropagator, |       RequestScopePropagator requestScopePropagator, | ||||||
|       ReviewDb db, |  | ||||||
|       Sequences seq, |       Sequences seq, | ||||||
|       SetHashtagsOp.Factory hashtagsFactory, |       SetHashtagsOp.Factory hashtagsFactory, | ||||||
|       SubmoduleOp.Factory subOpFactory, |       SubmoduleOp.Factory subOpFactory, | ||||||
| @@ -412,7 +409,6 @@ class ReceiveCommits { | |||||||
|     this.commitValidatorFactory = commitValidatorFactory; |     this.commitValidatorFactory = commitValidatorFactory; | ||||||
|     this.createRefControl = createRefControl; |     this.createRefControl = createRefControl; | ||||||
|     this.createGroupPermissionSyncer = createGroupPermissionSyncer; |     this.createGroupPermissionSyncer = createGroupPermissionSyncer; | ||||||
|     this.db = db; |  | ||||||
|     this.editUtil = editUtil; |     this.editUtil = editUtil; | ||||||
|     this.hashtagsFactory = hashtagsFactory; |     this.hashtagsFactory = hashtagsFactory; | ||||||
|     this.indexer = indexer; |     this.indexer = indexer; | ||||||
|   | |||||||
| @@ -37,14 +37,10 @@ import com.google.gerrit.server.plugincontext.PluginSetContext; | |||||||
| import com.google.gerrit.server.query.change.ChangeData; | import com.google.gerrit.server.query.change.ChangeData; | ||||||
| import com.google.gerrit.server.util.RequestContext; | import com.google.gerrit.server.util.RequestContext; | ||||||
| import com.google.gerrit.server.util.ThreadLocalRequestContext; | import com.google.gerrit.server.util.ThreadLocalRequestContext; | ||||||
| import com.google.gwtorm.server.OrmException; |  | ||||||
| import com.google.gwtorm.server.SchemaFactory; |  | ||||||
| import com.google.inject.OutOfScopeException; | import com.google.inject.OutOfScopeException; | ||||||
| import com.google.inject.Provider; | import com.google.inject.Provider; | ||||||
| import com.google.inject.ProvisionException; |  | ||||||
| import com.google.inject.assistedinject.Assisted; | import com.google.inject.assistedinject.Assisted; | ||||||
| import com.google.inject.assistedinject.AssistedInject; | import com.google.inject.assistedinject.AssistedInject; | ||||||
| import com.google.inject.util.Providers; |  | ||||||
| import java.io.IOException; | import java.io.IOException; | ||||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||||
| import java.util.Collection; | import java.util.Collection; | ||||||
| @@ -83,7 +79,6 @@ public class ChangeIndexer { | |||||||
|  |  | ||||||
|   @Nullable private final ChangeIndexCollection indexes; |   @Nullable private final ChangeIndexCollection indexes; | ||||||
|   @Nullable private final ChangeIndex index; |   @Nullable private final ChangeIndex index; | ||||||
|   private final SchemaFactory<ReviewDb> schemaFactory; |  | ||||||
|   private final ChangeData.Factory changeDataFactory; |   private final ChangeData.Factory changeDataFactory; | ||||||
|   private final ThreadLocalRequestContext context; |   private final ThreadLocalRequestContext context; | ||||||
|   private final ListeningExecutorService batchExecutor; |   private final ListeningExecutorService batchExecutor; | ||||||
| @@ -95,7 +90,6 @@ public class ChangeIndexer { | |||||||
|   @AssistedInject |   @AssistedInject | ||||||
|   ChangeIndexer( |   ChangeIndexer( | ||||||
|       @GerritServerConfig Config cfg, |       @GerritServerConfig Config cfg, | ||||||
|       SchemaFactory<ReviewDb> schemaFactory, |  | ||||||
|       ChangeData.Factory changeDataFactory, |       ChangeData.Factory changeDataFactory, | ||||||
|       ThreadLocalRequestContext context, |       ThreadLocalRequestContext context, | ||||||
|       PluginSetContext<ChangeIndexedListener> indexedListeners, |       PluginSetContext<ChangeIndexedListener> indexedListeners, | ||||||
| @@ -104,7 +98,6 @@ public class ChangeIndexer { | |||||||
|       @Assisted ListeningExecutorService executor, |       @Assisted ListeningExecutorService executor, | ||||||
|       @Assisted ChangeIndex index) { |       @Assisted ChangeIndex index) { | ||||||
|     this.executor = executor; |     this.executor = executor; | ||||||
|     this.schemaFactory = schemaFactory; |  | ||||||
|     this.changeDataFactory = changeDataFactory; |     this.changeDataFactory = changeDataFactory; | ||||||
|     this.context = context; |     this.context = context; | ||||||
|     this.indexedListeners = indexedListeners; |     this.indexedListeners = indexedListeners; | ||||||
| @@ -117,7 +110,6 @@ public class ChangeIndexer { | |||||||
|  |  | ||||||
|   @AssistedInject |   @AssistedInject | ||||||
|   ChangeIndexer( |   ChangeIndexer( | ||||||
|       SchemaFactory<ReviewDb> schemaFactory, |  | ||||||
|       @GerritServerConfig Config cfg, |       @GerritServerConfig Config cfg, | ||||||
|       ChangeData.Factory changeDataFactory, |       ChangeData.Factory changeDataFactory, | ||||||
|       ThreadLocalRequestContext context, |       ThreadLocalRequestContext context, | ||||||
| @@ -127,7 +119,6 @@ public class ChangeIndexer { | |||||||
|       @Assisted ListeningExecutorService executor, |       @Assisted ListeningExecutorService executor, | ||||||
|       @Assisted ChangeIndexCollection indexes) { |       @Assisted ChangeIndexCollection indexes) { | ||||||
|     this.executor = executor; |     this.executor = executor; | ||||||
|     this.schemaFactory = schemaFactory; |  | ||||||
|     this.changeDataFactory = changeDataFactory; |     this.changeDataFactory = changeDataFactory; | ||||||
|     this.context = context; |     this.context = context; | ||||||
|     this.indexedListeners = indexedListeners; |     this.indexedListeners = indexedListeners; | ||||||
| @@ -313,7 +304,7 @@ public class ChangeIndexer { | |||||||
|       this.id = id; |       this.id = id; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     protected abstract T callImpl(Provider<ReviewDb> db) throws Exception; |     protected abstract T callImpl() throws Exception; | ||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|     public abstract String toString(); |     public abstract String toString(); | ||||||
| @@ -324,20 +315,6 @@ public class ChangeIndexer { | |||||||
|         final AtomicReference<Provider<ReviewDb>> dbRef = Atomics.newReference(); |         final AtomicReference<Provider<ReviewDb>> dbRef = Atomics.newReference(); | ||||||
|         RequestContext newCtx = |         RequestContext newCtx = | ||||||
|             new RequestContext() { |             new RequestContext() { | ||||||
|               @Override |  | ||||||
|               public Provider<ReviewDb> getReviewDbProvider() { |  | ||||||
|                 Provider<ReviewDb> db = dbRef.get(); |  | ||||||
|                 if (db == null) { |  | ||||||
|                   try { |  | ||||||
|                     db = Providers.of(schemaFactory.open()); |  | ||||||
|                   } catch (OrmException e) { |  | ||||||
|                     throw new ProvisionException("error opening ReviewDb", e); |  | ||||||
|                   } |  | ||||||
|                   dbRef.set(db); |  | ||||||
|                 } |  | ||||||
|                 return db; |  | ||||||
|               } |  | ||||||
|  |  | ||||||
|               @Override |               @Override | ||||||
|               public CurrentUser getUser() { |               public CurrentUser getUser() { | ||||||
|                 throw new OutOfScopeException("No user during ChangeIndexer"); |                 throw new OutOfScopeException("No user during ChangeIndexer"); | ||||||
| @@ -345,7 +322,7 @@ public class ChangeIndexer { | |||||||
|             }; |             }; | ||||||
|         RequestContext oldCtx = context.setContext(newCtx); |         RequestContext oldCtx = context.setContext(newCtx); | ||||||
|         try { |         try { | ||||||
|           return callImpl(newCtx.getReviewDbProvider()); |           return callImpl(); | ||||||
|         } finally { |         } finally { | ||||||
|           context.setContext(oldCtx); |           context.setContext(oldCtx); | ||||||
|           Provider<ReviewDb> db = dbRef.get(); |           Provider<ReviewDb> db = dbRef.get(); | ||||||
| @@ -366,7 +343,7 @@ public class ChangeIndexer { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|     public Void callImpl(Provider<ReviewDb> db) throws Exception { |     public Void callImpl() throws Exception { | ||||||
|       ChangeData cd = changeDataFactory.create(project, id); |       ChangeData cd = changeDataFactory.create(project, id); | ||||||
|       index(cd); |       index(cd); | ||||||
|       return null; |       return null; | ||||||
| @@ -410,7 +387,7 @@ public class ChangeIndexer { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|     public Boolean callImpl(Provider<ReviewDb> db) throws Exception { |     public Boolean callImpl() throws Exception { | ||||||
|       try { |       try { | ||||||
|         if (stalenessChecker.isStale(id)) { |         if (stalenessChecker.isStale(id)) { | ||||||
|           indexImpl(changeDataFactory.create(project, id)); |           indexImpl(changeDataFactory.create(project, id)); | ||||||
|   | |||||||
| @@ -29,12 +29,8 @@ import com.google.gerrit.server.config.SendEmailExecutor; | |||||||
| import com.google.gerrit.server.mail.send.MergedSender; | import com.google.gerrit.server.mail.send.MergedSender; | ||||||
| import com.google.gerrit.server.util.RequestContext; | import com.google.gerrit.server.util.RequestContext; | ||||||
| import com.google.gerrit.server.util.ThreadLocalRequestContext; | import com.google.gerrit.server.util.ThreadLocalRequestContext; | ||||||
| import com.google.gwtorm.server.OrmException; |  | ||||||
| import com.google.gwtorm.server.SchemaFactory; |  | ||||||
| import com.google.inject.Inject; | import com.google.inject.Inject; | ||||||
| import com.google.inject.OutOfScopeException; | import com.google.inject.OutOfScopeException; | ||||||
| import com.google.inject.Provider; |  | ||||||
| import com.google.inject.ProvisionException; |  | ||||||
| import com.google.inject.assistedinject.Assisted; | import com.google.inject.assistedinject.Assisted; | ||||||
| import java.util.concurrent.ExecutorService; | import java.util.concurrent.ExecutorService; | ||||||
| import java.util.concurrent.Future; | import java.util.concurrent.Future; | ||||||
| @@ -53,7 +49,6 @@ class EmailMerge implements Runnable, RequestContext { | |||||||
|  |  | ||||||
|   private final ExecutorService sendEmailsExecutor; |   private final ExecutorService sendEmailsExecutor; | ||||||
|   private final MergedSender.Factory mergedSenderFactory; |   private final MergedSender.Factory mergedSenderFactory; | ||||||
|   private final SchemaFactory<ReviewDb> schemaFactory; |  | ||||||
|   private final ThreadLocalRequestContext requestContext; |   private final ThreadLocalRequestContext requestContext; | ||||||
|   private final IdentifiedUser.GenericFactory identifiedUserFactory; |   private final IdentifiedUser.GenericFactory identifiedUserFactory; | ||||||
|  |  | ||||||
| @@ -69,7 +64,6 @@ class EmailMerge implements Runnable, RequestContext { | |||||||
|   EmailMerge( |   EmailMerge( | ||||||
|       @SendEmailExecutor ExecutorService executor, |       @SendEmailExecutor ExecutorService executor, | ||||||
|       MergedSender.Factory mergedSenderFactory, |       MergedSender.Factory mergedSenderFactory, | ||||||
|       SchemaFactory<ReviewDb> schemaFactory, |  | ||||||
|       ThreadLocalRequestContext requestContext, |       ThreadLocalRequestContext requestContext, | ||||||
|       IdentifiedUser.GenericFactory identifiedUserFactory, |       IdentifiedUser.GenericFactory identifiedUserFactory, | ||||||
|       @Assisted Project.NameKey project, |       @Assisted Project.NameKey project, | ||||||
| @@ -79,7 +73,6 @@ class EmailMerge implements Runnable, RequestContext { | |||||||
|       @Assisted ListMultimap<RecipientType, Account.Id> accountsToNotify) { |       @Assisted ListMultimap<RecipientType, Account.Id> accountsToNotify) { | ||||||
|     this.sendEmailsExecutor = executor; |     this.sendEmailsExecutor = executor; | ||||||
|     this.mergedSenderFactory = mergedSenderFactory; |     this.mergedSenderFactory = mergedSenderFactory; | ||||||
|     this.schemaFactory = schemaFactory; |  | ||||||
|     this.requestContext = requestContext; |     this.requestContext = requestContext; | ||||||
|     this.identifiedUserFactory = identifiedUserFactory; |     this.identifiedUserFactory = identifiedUserFactory; | ||||||
|     this.project = project; |     this.project = project; | ||||||
| @@ -128,21 +121,4 @@ class EmailMerge implements Runnable, RequestContext { | |||||||
|     } |     } | ||||||
|     throw new OutOfScopeException("No user on email thread"); |     throw new OutOfScopeException("No user on email thread"); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   @Override |  | ||||||
|   public Provider<ReviewDb> getReviewDbProvider() { |  | ||||||
|     return new Provider<ReviewDb>() { |  | ||||||
|       @Override |  | ||||||
|       public ReviewDb get() { |  | ||||||
|         if (db == null) { |  | ||||||
|           try { |  | ||||||
|             db = schemaFactory.open(); |  | ||||||
|           } catch (OrmException e) { |  | ||||||
|             throw new ProvisionException("Cannot open ReviewDb", e); |  | ||||||
|           } |  | ||||||
|         } |  | ||||||
|         return db; |  | ||||||
|       } |  | ||||||
|     }; |  | ||||||
|   } |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -14,12 +14,9 @@ | |||||||
|  |  | ||||||
| package com.google.gerrit.server.util; | package com.google.gerrit.server.util; | ||||||
|  |  | ||||||
| import com.google.gerrit.reviewdb.server.ReviewDb; |  | ||||||
| import com.google.gerrit.server.AnonymousUser; | import com.google.gerrit.server.AnonymousUser; | ||||||
| import com.google.gerrit.server.CurrentUser; | import com.google.gerrit.server.CurrentUser; | ||||||
| import com.google.inject.Inject; | import com.google.inject.Inject; | ||||||
| import com.google.inject.Provider; |  | ||||||
| import com.google.inject.ProvisionException; |  | ||||||
| import com.google.inject.Singleton; | import com.google.inject.Singleton; | ||||||
|  |  | ||||||
| /** | /** | ||||||
| @@ -40,14 +37,4 @@ public class FallbackRequestContext implements RequestContext { | |||||||
|   public CurrentUser getUser() { |   public CurrentUser getUser() { | ||||||
|     return user; |     return user; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   @Override |  | ||||||
|   public Provider<ReviewDb> getReviewDbProvider() { |  | ||||||
|     return new Provider<ReviewDb>() { |  | ||||||
|       @Override |  | ||||||
|       public ReviewDb get() { |  | ||||||
|         throw new ProvisionException("Automatic ReviewDb only available in request scope"); |  | ||||||
|       } |  | ||||||
|     }; |  | ||||||
|   } |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -17,7 +17,6 @@ package com.google.gerrit.server.util; | |||||||
| import com.google.gerrit.common.Nullable; | import com.google.gerrit.common.Nullable; | ||||||
| import com.google.gerrit.server.RemotePeer; | import com.google.gerrit.server.RemotePeer; | ||||||
| import com.google.gerrit.server.config.CanonicalWebUrl; | import com.google.gerrit.server.config.CanonicalWebUrl; | ||||||
| import com.google.gerrit.server.config.RequestScopedReviewDbProvider; |  | ||||||
| import com.google.inject.Inject; | import com.google.inject.Inject; | ||||||
| import com.google.inject.Key; | import com.google.inject.Key; | ||||||
| import com.google.inject.Provider; | import com.google.inject.Provider; | ||||||
| @@ -41,9 +40,8 @@ public class GuiceRequestScopePropagator extends RequestScopePropagator { | |||||||
|   GuiceRequestScopePropagator( |   GuiceRequestScopePropagator( | ||||||
|       @CanonicalWebUrl @Nullable Provider<String> urlProvider, |       @CanonicalWebUrl @Nullable Provider<String> urlProvider, | ||||||
|       @RemotePeer Provider<SocketAddress> remotePeerProvider, |       @RemotePeer Provider<SocketAddress> remotePeerProvider, | ||||||
|       ThreadLocalRequestContext local, |       ThreadLocalRequestContext local) { | ||||||
|       Provider<RequestScopedReviewDbProvider> dbProviderProvider) { |     super(ServletScopes.REQUEST, local); | ||||||
|     super(ServletScopes.REQUEST, local, dbProviderProvider); |  | ||||||
|     this.url = urlProvider != null ? urlProvider.get() : null; |     this.url = urlProvider != null ? urlProvider.get() : null; | ||||||
|     this.peer = remotePeerProvider.get(); |     this.peer = remotePeerProvider.get(); | ||||||
|   } |   } | ||||||
|   | |||||||
| @@ -52,11 +52,6 @@ public class ManualRequestContext implements RequestContext, AutoCloseable { | |||||||
|     return userProvider.get(); |     return userProvider.get(); | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   @Override |  | ||||||
|   public Provider<ReviewDb> getReviewDbProvider() { |  | ||||||
|     return db; |  | ||||||
|   } |  | ||||||
|  |  | ||||||
|   @Override |   @Override | ||||||
|   public void close() { |   public void close() { | ||||||
|     requestContext.setContext(old); |     requestContext.setContext(old); | ||||||
|   | |||||||
| @@ -14,11 +14,8 @@ | |||||||
|  |  | ||||||
| package com.google.gerrit.server.util; | package com.google.gerrit.server.util; | ||||||
|  |  | ||||||
| import com.google.gerrit.reviewdb.server.ReviewDb; |  | ||||||
| import com.google.gerrit.server.CurrentUser; | import com.google.gerrit.server.CurrentUser; | ||||||
| import com.google.gerrit.server.PluginUser; | import com.google.gerrit.server.PluginUser; | ||||||
| import com.google.inject.Provider; |  | ||||||
| import com.google.inject.ProvisionException; |  | ||||||
|  |  | ||||||
| /** RequestContext active while plugins load or unload. */ | /** RequestContext active while plugins load or unload. */ | ||||||
| public class PluginRequestContext implements RequestContext { | public class PluginRequestContext implements RequestContext { | ||||||
| @@ -32,14 +29,4 @@ public class PluginRequestContext implements RequestContext { | |||||||
|   public CurrentUser getUser() { |   public CurrentUser getUser() { | ||||||
|     return user; |     return user; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   @Override |  | ||||||
|   public Provider<ReviewDb> getReviewDbProvider() { |  | ||||||
|     return new Provider<ReviewDb>() { |  | ||||||
|       @Override |  | ||||||
|       public ReviewDb get() { |  | ||||||
|         throw new ProvisionException("Automatic ReviewDb only available in request scope"); |  | ||||||
|       } |  | ||||||
|     }; |  | ||||||
|   } |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -14,9 +14,7 @@ | |||||||
|  |  | ||||||
| package com.google.gerrit.server.util; | package com.google.gerrit.server.util; | ||||||
|  |  | ||||||
| import com.google.gerrit.reviewdb.server.ReviewDb; |  | ||||||
| import com.google.gerrit.server.CurrentUser; | import com.google.gerrit.server.CurrentUser; | ||||||
| import com.google.inject.Provider; |  | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * The RequestContext is an interface exposing the fields that are needed by the GerritGlobalModule |  * The RequestContext is an interface exposing the fields that are needed by the GerritGlobalModule | ||||||
| @@ -24,6 +22,4 @@ import com.google.inject.Provider; | |||||||
|  */ |  */ | ||||||
| public interface RequestContext { | public interface RequestContext { | ||||||
|   CurrentUser getUser(); |   CurrentUser getUser(); | ||||||
|  |  | ||||||
|   Provider<ReviewDb> getReviewDbProvider(); |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -18,10 +18,8 @@ import static java.util.Objects.requireNonNull; | |||||||
|  |  | ||||||
| import com.google.common.base.Throwables; | import com.google.common.base.Throwables; | ||||||
| import com.google.gerrit.reviewdb.client.Project; | import com.google.gerrit.reviewdb.client.Project; | ||||||
| import com.google.gerrit.reviewdb.server.ReviewDb; |  | ||||||
| import com.google.gerrit.server.CurrentUser; | import com.google.gerrit.server.CurrentUser; | ||||||
| import com.google.gerrit.server.RequestCleanup; | import com.google.gerrit.server.RequestCleanup; | ||||||
| import com.google.gerrit.server.config.RequestScopedReviewDbProvider; |  | ||||||
| import com.google.gerrit.server.git.ProjectRunnable; | import com.google.gerrit.server.git.ProjectRunnable; | ||||||
| import com.google.inject.Key; | import com.google.inject.Key; | ||||||
| import com.google.inject.Provider; | import com.google.inject.Provider; | ||||||
| @@ -47,15 +45,10 @@ public abstract class RequestScopePropagator { | |||||||
|  |  | ||||||
|   private final Scope scope; |   private final Scope scope; | ||||||
|   private final ThreadLocalRequestContext local; |   private final ThreadLocalRequestContext local; | ||||||
|   private final Provider<RequestScopedReviewDbProvider> dbProviderProvider; |  | ||||||
|  |  | ||||||
|   protected RequestScopePropagator( |   protected RequestScopePropagator(Scope scope, ThreadLocalRequestContext local) { | ||||||
|       Scope scope, |  | ||||||
|       ThreadLocalRequestContext local, |  | ||||||
|       Provider<RequestScopedReviewDbProvider> dbProviderProvider) { |  | ||||||
|     this.scope = scope; |     this.scope = scope; | ||||||
|     this.local = local; |     this.local = local; | ||||||
|     this.dbProviderProvider = dbProviderProvider; |  | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   /** |   /** | ||||||
| @@ -181,11 +174,6 @@ public abstract class RequestScopePropagator { | |||||||
|                 public CurrentUser getUser() { |                 public CurrentUser getUser() { | ||||||
|                   return context.getUser(); |                   return context.getUser(); | ||||||
|                 } |                 } | ||||||
|  |  | ||||||
|                 @Override |  | ||||||
|                 public Provider<ReviewDb> getReviewDbProvider() { |  | ||||||
|                   return dbProviderProvider.get(); |  | ||||||
|                 } |  | ||||||
|               }); |               }); | ||||||
|       try { |       try { | ||||||
|         return callable.call(); |         return callable.call(); | ||||||
|   | |||||||
| @@ -14,12 +14,9 @@ | |||||||
|  |  | ||||||
| package com.google.gerrit.server.util; | package com.google.gerrit.server.util; | ||||||
|  |  | ||||||
| import com.google.gerrit.reviewdb.server.ReviewDb; |  | ||||||
| import com.google.gerrit.server.CurrentUser; | import com.google.gerrit.server.CurrentUser; | ||||||
| import com.google.gerrit.server.InternalUser; | import com.google.gerrit.server.InternalUser; | ||||||
| import com.google.inject.Inject; | import com.google.inject.Inject; | ||||||
| import com.google.inject.Provider; |  | ||||||
| import com.google.inject.ProvisionException; |  | ||||||
|  |  | ||||||
| /** RequestContext with an InternalUser making the internals visible. */ | /** RequestContext with an InternalUser making the internals visible. */ | ||||||
| public class ServerRequestContext implements RequestContext { | public class ServerRequestContext implements RequestContext { | ||||||
| @@ -34,14 +31,4 @@ public class ServerRequestContext implements RequestContext { | |||||||
|   public CurrentUser getUser() { |   public CurrentUser getUser() { | ||||||
|     return user; |     return user; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   @Override |  | ||||||
|   public Provider<ReviewDb> getReviewDbProvider() { |  | ||||||
|     return new Provider<ReviewDb>() { |  | ||||||
|       @Override |  | ||||||
|       public ReviewDb get() { |  | ||||||
|         throw new ProvisionException("Automatic ReviewDb only available in request scope"); |  | ||||||
|       } |  | ||||||
|     }; |  | ||||||
|   } |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -17,7 +17,6 @@ package com.google.gerrit.server.util; | |||||||
| import com.google.common.base.MoreObjects; | import com.google.common.base.MoreObjects; | ||||||
| import com.google.gerrit.common.Nullable; | import com.google.gerrit.common.Nullable; | ||||||
| import com.google.gerrit.common.errors.NotSignedInException; | import com.google.gerrit.common.errors.NotSignedInException; | ||||||
| import com.google.gerrit.reviewdb.server.ReviewDb; |  | ||||||
| import com.google.gerrit.server.CurrentUser; | import com.google.gerrit.server.CurrentUser; | ||||||
| import com.google.gerrit.server.IdentifiedUser; | import com.google.gerrit.server.IdentifiedUser; | ||||||
| import com.google.inject.AbstractModule; | import com.google.inject.AbstractModule; | ||||||
| @@ -63,11 +62,6 @@ public class ThreadLocalRequestContext { | |||||||
|         } |         } | ||||||
|         throw new ProvisionException(NotSignedInException.MESSAGE, new NotSignedInException()); |         throw new ProvisionException(NotSignedInException.MESSAGE, new NotSignedInException()); | ||||||
|       } |       } | ||||||
|  |  | ||||||
|       @Provides |  | ||||||
|       ReviewDb provideReviewDb(RequestContext ctx) { |  | ||||||
|         return ctx.getReviewDbProvider().get(); |  | ||||||
|       } |  | ||||||
|     }; |     }; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -14,9 +14,7 @@ | |||||||
|  |  | ||||||
| package com.google.gerrit.server.util; | package com.google.gerrit.server.util; | ||||||
|  |  | ||||||
| import com.google.gerrit.server.config.RequestScopedReviewDbProvider; |  | ||||||
| import com.google.inject.OutOfScopeException; | import com.google.inject.OutOfScopeException; | ||||||
| import com.google.inject.Provider; |  | ||||||
| import com.google.inject.Scope; | import com.google.inject.Scope; | ||||||
| import java.util.concurrent.Callable; | import java.util.concurrent.Callable; | ||||||
|  |  | ||||||
| @@ -31,11 +29,8 @@ public abstract class ThreadLocalRequestScopePropagator<C> extends RequestScopeP | |||||||
|   private final ThreadLocal<C> threadLocal; |   private final ThreadLocal<C> threadLocal; | ||||||
|  |  | ||||||
|   protected ThreadLocalRequestScopePropagator( |   protected ThreadLocalRequestScopePropagator( | ||||||
|       Scope scope, |       Scope scope, ThreadLocal<C> threadLocal, ThreadLocalRequestContext local) { | ||||||
|       ThreadLocal<C> threadLocal, |     super(scope, local); | ||||||
|       ThreadLocalRequestContext local, |  | ||||||
|       Provider<RequestScopedReviewDbProvider> dbProviderProvider) { |  | ||||||
|     super(scope, local, dbProviderProvider); |  | ||||||
|     this.threadLocal = threadLocal; |     this.threadLocal = threadLocal; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -18,7 +18,6 @@ import com.google.gerrit.reviewdb.server.ReviewDb; | |||||||
| import com.google.gerrit.server.CurrentUser; | import com.google.gerrit.server.CurrentUser; | ||||||
| import com.google.gerrit.server.IdentifiedUser; | import com.google.gerrit.server.IdentifiedUser; | ||||||
| import com.google.gerrit.server.RequestCleanup; | import com.google.gerrit.server.RequestCleanup; | ||||||
| import com.google.gerrit.server.config.RequestScopedReviewDbProvider; |  | ||||||
| import com.google.gerrit.server.util.RequestContext; | import com.google.gerrit.server.util.RequestContext; | ||||||
| import com.google.gerrit.server.util.ThreadLocalRequestContext; | import com.google.gerrit.server.util.ThreadLocalRequestContext; | ||||||
| import com.google.gerrit.server.util.ThreadLocalRequestScopePropagator; | import com.google.gerrit.server.util.ThreadLocalRequestScopePropagator; | ||||||
| @@ -29,7 +28,6 @@ import com.google.inject.Key; | |||||||
| import com.google.inject.OutOfScopeException; | import com.google.inject.OutOfScopeException; | ||||||
| import com.google.inject.Provider; | import com.google.inject.Provider; | ||||||
| import com.google.inject.Scope; | import com.google.inject.Scope; | ||||||
| import com.google.inject.util.Providers; |  | ||||||
| import java.util.HashMap; | import java.util.HashMap; | ||||||
| import java.util.Map; | import java.util.Map; | ||||||
|  |  | ||||||
| @@ -37,9 +35,6 @@ import java.util.Map; | |||||||
| public class SshScope { | public class SshScope { | ||||||
|   private static final Key<RequestCleanup> RC_KEY = Key.get(RequestCleanup.class); |   private static final Key<RequestCleanup> RC_KEY = Key.get(RequestCleanup.class); | ||||||
|  |  | ||||||
|   private static final Key<RequestScopedReviewDbProvider> DB_KEY = |  | ||||||
|       Key.get(RequestScopedReviewDbProvider.class); |  | ||||||
|  |  | ||||||
|   class Context implements RequestContext { |   class Context implements RequestContext { | ||||||
|     private final RequestCleanup cleanup = new RequestCleanup(); |     private final RequestCleanup cleanup = new RequestCleanup(); | ||||||
|     private final Map<Key<?>, Object> map = new HashMap<>(); |     private final Map<Key<?>, Object> map = new HashMap<>(); | ||||||
| @@ -57,7 +52,6 @@ public class SshScope { | |||||||
|       commandLine = c; |       commandLine = c; | ||||||
|       created = started = finished = at; |       created = started = finished = at; | ||||||
|       map.put(RC_KEY, cleanup); |       map.put(RC_KEY, cleanup); | ||||||
|       map.put(DB_KEY, new RequestScopedReviewDbProvider(schemaFactory, Providers.of(cleanup))); |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     private Context(Context p, SshSession s, String c) { |     private Context(Context p, SshSession s, String c) { | ||||||
| @@ -85,11 +79,6 @@ public class SshScope { | |||||||
|       return user; |       return user; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @Override |  | ||||||
|     public Provider<ReviewDb> getReviewDbProvider() { |  | ||||||
|       return (RequestScopedReviewDbProvider) map.get(DB_KEY); |  | ||||||
|     } |  | ||||||
|  |  | ||||||
|     synchronized <T> T get(Key<T> key, Provider<T> creator) { |     synchronized <T> T get(Key<T> key, Provider<T> creator) { | ||||||
|       @SuppressWarnings("unchecked") |       @SuppressWarnings("unchecked") | ||||||
|       T t = (T) map.get(key); |       T t = (T) map.get(key); | ||||||
| @@ -125,11 +114,8 @@ public class SshScope { | |||||||
|     private final SshScope sshScope; |     private final SshScope sshScope; | ||||||
|  |  | ||||||
|     @Inject |     @Inject | ||||||
|     Propagator( |     Propagator(SshScope sshScope, ThreadLocalRequestContext local) { | ||||||
|         SshScope sshScope, |       super(REQUEST, current, local); | ||||||
|         ThreadLocalRequestContext local, |  | ||||||
|         Provider<RequestScopedReviewDbProvider> dbProviderProvider) { |  | ||||||
|       super(REQUEST, current, local, dbProviderProvider); |  | ||||||
|       this.sshScope = sshScope; |       this.sshScope = sshScope; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -16,7 +16,6 @@ package com.google.gerrit.testing; | |||||||
|  |  | ||||||
| import com.google.gerrit.lifecycle.LifecycleManager; | import com.google.gerrit.lifecycle.LifecycleManager; | ||||||
| import com.google.gerrit.reviewdb.client.Account; | import com.google.gerrit.reviewdb.client.Account; | ||||||
| import com.google.gerrit.reviewdb.server.ReviewDb; |  | ||||||
| import com.google.gerrit.server.CurrentUser; | import com.google.gerrit.server.CurrentUser; | ||||||
| import com.google.gerrit.server.IdentifiedUser; | import com.google.gerrit.server.IdentifiedUser; | ||||||
| import com.google.gerrit.server.account.AccountManager; | import com.google.gerrit.server.account.AccountManager; | ||||||
| @@ -24,12 +23,10 @@ import com.google.gerrit.server.account.AuthRequest; | |||||||
| import com.google.gerrit.server.schema.SchemaCreator; | import com.google.gerrit.server.schema.SchemaCreator; | ||||||
| import com.google.gerrit.server.util.RequestContext; | import com.google.gerrit.server.util.RequestContext; | ||||||
| import com.google.gerrit.server.util.ThreadLocalRequestContext; | import com.google.gerrit.server.util.ThreadLocalRequestContext; | ||||||
| import com.google.gwtorm.server.SchemaFactory; |  | ||||||
| import com.google.inject.Guice; | import com.google.inject.Guice; | ||||||
| import com.google.inject.Inject; | import com.google.inject.Inject; | ||||||
| import com.google.inject.Injector; | import com.google.inject.Injector; | ||||||
| import com.google.inject.Provider; | import com.google.inject.Provider; | ||||||
| import com.google.inject.util.Providers; |  | ||||||
| import org.eclipse.jgit.lib.Config; | import org.eclipse.jgit.lib.Config; | ||||||
| import org.junit.rules.MethodRule; | import org.junit.rules.MethodRule; | ||||||
| import org.junit.runners.model.FrameworkMethod; | import org.junit.runners.model.FrameworkMethod; | ||||||
| @@ -49,11 +46,9 @@ public final class InMemoryTestEnvironment implements MethodRule { | |||||||
|  |  | ||||||
|   @Inject private AccountManager accountManager; |   @Inject private AccountManager accountManager; | ||||||
|   @Inject private IdentifiedUser.GenericFactory userFactory; |   @Inject private IdentifiedUser.GenericFactory userFactory; | ||||||
|   @Inject private SchemaFactory<ReviewDb> schemaFactory; |  | ||||||
|   @Inject private SchemaCreator schemaCreator; |   @Inject private SchemaCreator schemaCreator; | ||||||
|   @Inject private ThreadLocalRequestContext requestContext; |   @Inject private ThreadLocalRequestContext requestContext; | ||||||
|  |  | ||||||
|   private ReviewDb db; |  | ||||||
|   private LifecycleManager lifecycle; |   private LifecycleManager lifecycle; | ||||||
|  |  | ||||||
|   /** Create a test environment using an empty base config. */ |   /** Create a test environment using an empty base config. */ | ||||||
| @@ -96,11 +91,6 @@ public final class InMemoryTestEnvironment implements MethodRule { | |||||||
|           public CurrentUser getUser() { |           public CurrentUser getUser() { | ||||||
|             return user; |             return user; | ||||||
|           } |           } | ||||||
|  |  | ||||||
|           @Override |  | ||||||
|           public Provider<ReviewDb> getReviewDbProvider() { |  | ||||||
|             return Providers.of(db); |  | ||||||
|           } |  | ||||||
|         }); |         }); | ||||||
|   } |   } | ||||||
|  |  | ||||||
| @@ -115,7 +105,6 @@ public final class InMemoryTestEnvironment implements MethodRule { | |||||||
|     lifecycle.start(); |     lifecycle.start(); | ||||||
|  |  | ||||||
|     schemaCreator.create(); |     schemaCreator.create(); | ||||||
|     db = schemaFactory.open(); |  | ||||||
|  |  | ||||||
|     // The first user is added to the "Administrators" group. See AccountManager#create(). |     // The first user is added to the "Administrators" group. See AccountManager#create(). | ||||||
|     setApiUser(accountManager.authenticate(AuthRequest.forUser("admin")).getAccountId()); |     setApiUser(accountManager.authenticate(AuthRequest.forUser("admin")).getAccountId()); | ||||||
| @@ -131,8 +120,5 @@ public final class InMemoryTestEnvironment implements MethodRule { | |||||||
|     if (requestContext != null) { |     if (requestContext != null) { | ||||||
|       requestContext.setContext(null); |       requestContext.setContext(null); | ||||||
|     } |     } | ||||||
|     if (db != null) { |  | ||||||
|       db.close(); |  | ||||||
|     } |  | ||||||
|   } |   } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -33,7 +33,6 @@ import com.google.gerrit.extensions.common.GpgKeyInfo.Status; | |||||||
| import com.google.gerrit.gpg.testing.TestKey; | import com.google.gerrit.gpg.testing.TestKey; | ||||||
| import com.google.gerrit.lifecycle.LifecycleManager; | import com.google.gerrit.lifecycle.LifecycleManager; | ||||||
| import com.google.gerrit.reviewdb.client.Account; | import com.google.gerrit.reviewdb.client.Account; | ||||||
| import com.google.gerrit.reviewdb.server.ReviewDb; |  | ||||||
| import com.google.gerrit.server.CurrentUser; | import com.google.gerrit.server.CurrentUser; | ||||||
| import com.google.gerrit.server.IdentifiedUser; | import com.google.gerrit.server.IdentifiedUser; | ||||||
| import com.google.gerrit.server.ServerInitiated; | import com.google.gerrit.server.ServerInitiated; | ||||||
| @@ -45,13 +44,11 @@ import com.google.gerrit.server.schema.SchemaCreator; | |||||||
| import com.google.gerrit.server.util.RequestContext; | import com.google.gerrit.server.util.RequestContext; | ||||||
| import com.google.gerrit.server.util.ThreadLocalRequestContext; | import com.google.gerrit.server.util.ThreadLocalRequestContext; | ||||||
| import com.google.gerrit.testing.GerritBaseTests; | import com.google.gerrit.testing.GerritBaseTests; | ||||||
| import com.google.gerrit.testing.InMemoryDatabase; |  | ||||||
| import com.google.gerrit.testing.InMemoryModule; | import com.google.gerrit.testing.InMemoryModule; | ||||||
| import com.google.inject.Guice; | import com.google.inject.Guice; | ||||||
| import com.google.inject.Inject; | import com.google.inject.Inject; | ||||||
| import com.google.inject.Injector; | import com.google.inject.Injector; | ||||||
| import com.google.inject.Provider; | import com.google.inject.Provider; | ||||||
| import com.google.inject.util.Providers; |  | ||||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||||
| import java.util.Arrays; | import java.util.Arrays; | ||||||
| import java.util.List; | import java.util.List; | ||||||
| @@ -78,14 +75,11 @@ public class GerritPublicKeyCheckerTest extends GerritBaseTests { | |||||||
|  |  | ||||||
|   @Inject private IdentifiedUser.GenericFactory userFactory; |   @Inject private IdentifiedUser.GenericFactory userFactory; | ||||||
|  |  | ||||||
|   @Inject private InMemoryDatabase schemaFactory; |  | ||||||
|  |  | ||||||
|   @Inject private SchemaCreator schemaCreator; |   @Inject private SchemaCreator schemaCreator; | ||||||
|  |  | ||||||
|   @Inject private ThreadLocalRequestContext requestContext; |   @Inject private ThreadLocalRequestContext requestContext; | ||||||
|  |  | ||||||
|   private LifecycleManager lifecycle; |   private LifecycleManager lifecycle; | ||||||
|   private ReviewDb db; |  | ||||||
|   private Account.Id userId; |   private Account.Id userId; | ||||||
|   private IdentifiedUser user; |   private IdentifiedUser user; | ||||||
|   private Repository storeRepo; |   private Repository storeRepo; | ||||||
| @@ -109,7 +103,6 @@ public class GerritPublicKeyCheckerTest extends GerritBaseTests { | |||||||
|     injector.injectMembers(this); |     injector.injectMembers(this); | ||||||
|     lifecycle.start(); |     lifecycle.start(); | ||||||
|  |  | ||||||
|     db = schemaFactory.open(); |  | ||||||
|     schemaCreator.create(); |     schemaCreator.create(); | ||||||
|     userId = accountManager.authenticate(AuthRequest.forUser("user")).getAccountId(); |     userId = accountManager.authenticate(AuthRequest.forUser("user")).getAccountId(); | ||||||
|     // Note: does not match any key in TestKeys. |     // Note: does not match any key in TestKeys. | ||||||
| @@ -124,11 +117,6 @@ public class GerritPublicKeyCheckerTest extends GerritBaseTests { | |||||||
|           public CurrentUser getUser() { |           public CurrentUser getUser() { | ||||||
|             return user; |             return user; | ||||||
|           } |           } | ||||||
|  |  | ||||||
|           @Override |  | ||||||
|           public Provider<ReviewDb> getReviewDbProvider() { |  | ||||||
|             return Providers.of(db); |  | ||||||
|           } |  | ||||||
|         }); |         }); | ||||||
|  |  | ||||||
|     storeRepo = new InMemoryRepository(new DfsRepositoryDescription("repo")); |     storeRepo = new InMemoryRepository(new DfsRepositoryDescription("repo")); | ||||||
| @@ -157,9 +145,6 @@ public class GerritPublicKeyCheckerTest extends GerritBaseTests { | |||||||
|     if (lifecycle != null) { |     if (lifecycle != null) { | ||||||
|       lifecycle.stop(); |       lifecycle.stop(); | ||||||
|     } |     } | ||||||
|     if (db != null) { |  | ||||||
|       db.close(); |  | ||||||
|     } |  | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   @Test |   @Test | ||||||
|   | |||||||
| @@ -54,8 +54,6 @@ import com.google.gerrit.testing.InMemoryModule; | |||||||
| import com.google.inject.Guice; | import com.google.inject.Guice; | ||||||
| import com.google.inject.Inject; | import com.google.inject.Inject; | ||||||
| import com.google.inject.Injector; | import com.google.inject.Injector; | ||||||
| import com.google.inject.Provider; |  | ||||||
| import com.google.inject.util.Providers; |  | ||||||
| import java.util.List; | import java.util.List; | ||||||
| import org.eclipse.jgit.lib.Repository; | import org.eclipse.jgit.lib.Repository; | ||||||
| import org.junit.After; | import org.junit.After; | ||||||
| @@ -93,7 +91,6 @@ public class LabelNormalizerTest extends GerritBaseTests { | |||||||
|     lifecycle.add(injector); |     lifecycle.add(injector); | ||||||
|     lifecycle.start(); |     lifecycle.start(); | ||||||
|  |  | ||||||
|     db = schemaFactory.open(); |  | ||||||
|     schemaCreator.create(); |     schemaCreator.create(); | ||||||
|     userId = accountManager.authenticate(AuthRequest.forUser("user")).getAccountId(); |     userId = accountManager.authenticate(AuthRequest.forUser("user")).getAccountId(); | ||||||
|     user = userFactory.create(userId); |     user = userFactory.create(userId); | ||||||
| @@ -104,11 +101,6 @@ public class LabelNormalizerTest extends GerritBaseTests { | |||||||
|           public CurrentUser getUser() { |           public CurrentUser getUser() { | ||||||
|             return user; |             return user; | ||||||
|           } |           } | ||||||
|  |  | ||||||
|           @Override |  | ||||||
|           public Provider<ReviewDb> getReviewDbProvider() { |  | ||||||
|             return Providers.of(db); |  | ||||||
|           } |  | ||||||
|         }); |         }); | ||||||
|  |  | ||||||
|     configureProject(); |     configureProject(); | ||||||
|   | |||||||
| @@ -46,7 +46,6 @@ import com.google.gerrit.extensions.api.projects.CommentLinkInfo; | |||||||
| import com.google.gerrit.metrics.MetricMaker; | import com.google.gerrit.metrics.MetricMaker; | ||||||
| import com.google.gerrit.reviewdb.client.AccountGroup; | import com.google.gerrit.reviewdb.client.AccountGroup; | ||||||
| import com.google.gerrit.reviewdb.client.Project; | import com.google.gerrit.reviewdb.client.Project; | ||||||
| import com.google.gerrit.reviewdb.server.ReviewDb; |  | ||||||
| import com.google.gerrit.server.CurrentUser; | import com.google.gerrit.server.CurrentUser; | ||||||
| import com.google.gerrit.server.account.CapabilityCollection; | import com.google.gerrit.server.account.CapabilityCollection; | ||||||
| import com.google.gerrit.server.account.GroupMembership; | import com.google.gerrit.server.account.GroupMembership; | ||||||
| @@ -67,14 +66,11 @@ import com.google.gerrit.server.schema.SchemaCreator; | |||||||
| import com.google.gerrit.server.util.RequestContext; | import com.google.gerrit.server.util.RequestContext; | ||||||
| import com.google.gerrit.server.util.ThreadLocalRequestContext; | import com.google.gerrit.server.util.ThreadLocalRequestContext; | ||||||
| import com.google.gerrit.testing.GerritBaseTests; | import com.google.gerrit.testing.GerritBaseTests; | ||||||
| import com.google.gerrit.testing.InMemoryDatabase; |  | ||||||
| import com.google.gerrit.testing.InMemoryModule; | import com.google.gerrit.testing.InMemoryModule; | ||||||
| import com.google.gerrit.testing.InMemoryRepositoryManager; | import com.google.gerrit.testing.InMemoryRepositoryManager; | ||||||
| import com.google.inject.Guice; | import com.google.inject.Guice; | ||||||
| import com.google.inject.Inject; | import com.google.inject.Inject; | ||||||
| import com.google.inject.Injector; | import com.google.inject.Injector; | ||||||
| import com.google.inject.Provider; |  | ||||||
| import com.google.inject.util.Providers; |  | ||||||
| import java.io.IOException; | import java.io.IOException; | ||||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||||
| import java.util.Collections; | import java.util.Collections; | ||||||
| @@ -196,13 +192,11 @@ public class RefControlTest extends GerritBaseTests { | |||||||
|   private ProjectCache projectCache; |   private ProjectCache projectCache; | ||||||
|   private PermissionCollection.Factory sectionSorter; |   private PermissionCollection.Factory sectionSorter; | ||||||
|   private ChangeControl.Factory changeControlFactory; |   private ChangeControl.Factory changeControlFactory; | ||||||
|   private ReviewDb db; |  | ||||||
|  |  | ||||||
|   @Inject private PermissionBackend permissionBackend; |   @Inject private PermissionBackend permissionBackend; | ||||||
|   @Inject private CapabilityCollection.Factory capabilityCollectionFactory; |   @Inject private CapabilityCollection.Factory capabilityCollectionFactory; | ||||||
|   @Inject private SchemaCreator schemaCreator; |   @Inject private SchemaCreator schemaCreator; | ||||||
|   @Inject private SingleVersionListener singleVersionListener; |   @Inject private SingleVersionListener singleVersionListener; | ||||||
|   @Inject private InMemoryDatabase schemaFactory; |  | ||||||
|   @Inject private ThreadLocalRequestContext requestContext; |   @Inject private ThreadLocalRequestContext requestContext; | ||||||
|   @Inject private DefaultRefFilter.Factory refFilterFactory; |   @Inject private DefaultRefFilter.Factory refFilterFactory; | ||||||
|   @Inject private TransferConfig transferConfig; |   @Inject private TransferConfig transferConfig; | ||||||
| @@ -286,7 +280,6 @@ public class RefControlTest extends GerritBaseTests { | |||||||
|       throw new RuntimeException(e); |       throw new RuntimeException(e); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     db = schemaFactory.open(); |  | ||||||
|     singleVersionListener.start(); |     singleVersionListener.start(); | ||||||
|     try { |     try { | ||||||
|       schemaCreator.create(); |       schemaCreator.create(); | ||||||
| @@ -313,11 +306,6 @@ public class RefControlTest extends GerritBaseTests { | |||||||
|           public CurrentUser getUser() { |           public CurrentUser getUser() { | ||||||
|             return null; |             return null; | ||||||
|           } |           } | ||||||
|  |  | ||||||
|           @Override |  | ||||||
|           public Provider<ReviewDb> getReviewDbProvider() { |  | ||||||
|             return Providers.of(db); |  | ||||||
|           } |  | ||||||
|         }); |         }); | ||||||
|  |  | ||||||
|     changeControlFactory = injector.getInstance(ChangeControl.Factory.class); |     changeControlFactory = injector.getInstance(ChangeControl.Factory.class); | ||||||
| @@ -326,9 +314,6 @@ public class RefControlTest extends GerritBaseTests { | |||||||
|   @After |   @After | ||||||
|   public void tearDown() { |   public void tearDown() { | ||||||
|     requestContext.setContext(null); |     requestContext.setContext(null); | ||||||
|     if (db != null) { |  | ||||||
|       db.close(); |  | ||||||
|     } |  | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   @Test |   @Test | ||||||
|   | |||||||
| @@ -49,7 +49,6 @@ import com.google.gerrit.index.query.FieldBundle; | |||||||
| import com.google.gerrit.lifecycle.LifecycleManager; | import com.google.gerrit.lifecycle.LifecycleManager; | ||||||
| import com.google.gerrit.reviewdb.client.Account; | import com.google.gerrit.reviewdb.client.Account; | ||||||
| import com.google.gerrit.reviewdb.client.Project; | import com.google.gerrit.reviewdb.client.Project; | ||||||
| import com.google.gerrit.reviewdb.server.ReviewDb; |  | ||||||
| import com.google.gerrit.server.AnonymousUser; | import com.google.gerrit.server.AnonymousUser; | ||||||
| import com.google.gerrit.server.CurrentUser; | import com.google.gerrit.server.CurrentUser; | ||||||
| import com.google.gerrit.server.GerritPersonIdent; | import com.google.gerrit.server.GerritPersonIdent; | ||||||
| @@ -80,11 +79,9 @@ import com.google.gerrit.server.util.OneOffRequestContext; | |||||||
| import com.google.gerrit.server.util.RequestContext; | import com.google.gerrit.server.util.RequestContext; | ||||||
| import com.google.gerrit.server.util.ThreadLocalRequestContext; | import com.google.gerrit.server.util.ThreadLocalRequestContext; | ||||||
| import com.google.gerrit.testing.GerritServerTests; | import com.google.gerrit.testing.GerritServerTests; | ||||||
| import com.google.gerrit.testing.InMemoryDatabase; |  | ||||||
| import com.google.inject.Inject; | import com.google.inject.Inject; | ||||||
| import com.google.inject.Injector; | import com.google.inject.Injector; | ||||||
| import com.google.inject.Provider; | import com.google.inject.Provider; | ||||||
| import com.google.inject.util.Providers; |  | ||||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||||
| import java.util.Arrays; | import java.util.Arrays; | ||||||
| import java.util.HashMap; | import java.util.HashMap; | ||||||
| @@ -118,8 +115,6 @@ public abstract class AbstractQueryAccountsTest extends GerritServerTests { | |||||||
|  |  | ||||||
|   @Inject private Provider<AnonymousUser> anonymousUser; |   @Inject private Provider<AnonymousUser> anonymousUser; | ||||||
|  |  | ||||||
|   @Inject protected InMemoryDatabase schemaFactory; |  | ||||||
|  |  | ||||||
|   @Inject protected SchemaCreator schemaCreator; |   @Inject protected SchemaCreator schemaCreator; | ||||||
|  |  | ||||||
|   @Inject protected ThreadLocalRequestContext requestContext; |   @Inject protected ThreadLocalRequestContext requestContext; | ||||||
| @@ -140,7 +135,6 @@ public abstract class AbstractQueryAccountsTest extends GerritServerTests { | |||||||
|  |  | ||||||
|   protected LifecycleManager lifecycle; |   protected LifecycleManager lifecycle; | ||||||
|   protected Injector injector; |   protected Injector injector; | ||||||
|   protected ReviewDb db; |  | ||||||
|   protected AccountInfo currentUserInfo; |   protected AccountInfo currentUserInfo; | ||||||
|   protected CurrentUser admin; |   protected CurrentUser admin; | ||||||
|  |  | ||||||
| @@ -160,11 +154,9 @@ public abstract class AbstractQueryAccountsTest extends GerritServerTests { | |||||||
|   @After |   @After | ||||||
|   public void cleanUp() { |   public void cleanUp() { | ||||||
|     lifecycle.stop(); |     lifecycle.stop(); | ||||||
|     db.close(); |  | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   protected void setUpDatabase() throws Exception { |   protected void setUpDatabase() throws Exception { | ||||||
|     db = schemaFactory.open(); |  | ||||||
|     schemaCreator.create(); |     schemaCreator.create(); | ||||||
|  |  | ||||||
|     Account.Id adminId = createAccount("admin", "Administrator", "admin@example.com", true); |     Account.Id adminId = createAccount("admin", "Administrator", "admin@example.com", true); | ||||||
| @@ -182,11 +174,6 @@ public abstract class AbstractQueryAccountsTest extends GerritServerTests { | |||||||
|       public CurrentUser getUser() { |       public CurrentUser getUser() { | ||||||
|         return requestUser; |         return requestUser; | ||||||
|       } |       } | ||||||
|  |  | ||||||
|       @Override |  | ||||||
|       public Provider<ReviewDb> getReviewDbProvider() { |  | ||||||
|         return Providers.of(db); |  | ||||||
|       } |  | ||||||
|     }; |     }; | ||||||
|   } |   } | ||||||
|  |  | ||||||
| @@ -197,11 +184,6 @@ public abstract class AbstractQueryAccountsTest extends GerritServerTests { | |||||||
|           public CurrentUser getUser() { |           public CurrentUser getUser() { | ||||||
|             return anonymousUser.get(); |             return anonymousUser.get(); | ||||||
|           } |           } | ||||||
|  |  | ||||||
|           @Override |  | ||||||
|           public Provider<ReviewDb> getReviewDbProvider() { |  | ||||||
|             return Providers.of(db); |  | ||||||
|           } |  | ||||||
|         }); |         }); | ||||||
|   } |   } | ||||||
|  |  | ||||||
| @@ -211,9 +193,6 @@ public abstract class AbstractQueryAccountsTest extends GerritServerTests { | |||||||
|       lifecycle.stop(); |       lifecycle.stop(); | ||||||
|     } |     } | ||||||
|     requestContext.setContext(null); |     requestContext.setContext(null); | ||||||
|     if (db != null) { |  | ||||||
|       db.close(); |  | ||||||
|     } |  | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   @Test |   @Test | ||||||
|   | |||||||
| @@ -78,7 +78,6 @@ import com.google.gerrit.reviewdb.client.Patch; | |||||||
| import com.google.gerrit.reviewdb.client.PatchSet; | import com.google.gerrit.reviewdb.client.PatchSet; | ||||||
| import com.google.gerrit.reviewdb.client.Project; | import com.google.gerrit.reviewdb.client.Project; | ||||||
| import com.google.gerrit.reviewdb.client.RefNames; | import com.google.gerrit.reviewdb.client.RefNames; | ||||||
| import com.google.gerrit.reviewdb.server.ReviewDb; |  | ||||||
| import com.google.gerrit.server.CurrentUser; | import com.google.gerrit.server.CurrentUser; | ||||||
| import com.google.gerrit.server.IdentifiedUser; | import com.google.gerrit.server.IdentifiedUser; | ||||||
| import com.google.gerrit.server.PatchSetUtil; | import com.google.gerrit.server.PatchSetUtil; | ||||||
| @@ -113,11 +112,9 @@ import com.google.gerrit.testing.GerritServerTests; | |||||||
| import com.google.gerrit.testing.InMemoryRepositoryManager; | import com.google.gerrit.testing.InMemoryRepositoryManager; | ||||||
| import com.google.gerrit.testing.InMemoryRepositoryManager.Repo; | import com.google.gerrit.testing.InMemoryRepositoryManager.Repo; | ||||||
| import com.google.gerrit.testing.TestTimeUtil; | import com.google.gerrit.testing.TestTimeUtil; | ||||||
| import com.google.gwtorm.server.SchemaFactory; |  | ||||||
| import com.google.inject.Inject; | import com.google.inject.Inject; | ||||||
| import com.google.inject.Injector; | import com.google.inject.Injector; | ||||||
| import com.google.inject.Provider; | import com.google.inject.Provider; | ||||||
| import com.google.inject.util.Providers; |  | ||||||
| import java.sql.Timestamp; | import java.sql.Timestamp; | ||||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||||
| import java.util.Arrays; | import java.util.Arrays; | ||||||
| @@ -167,7 +164,6 @@ public abstract class AbstractQueryChangesTest extends GerritServerTests { | |||||||
|   @Inject protected ChangeNotes.Factory changeNotesFactory; |   @Inject protected ChangeNotes.Factory changeNotesFactory; | ||||||
|   @Inject protected Provider<ChangeQueryProcessor> queryProcessorProvider; |   @Inject protected Provider<ChangeQueryProcessor> queryProcessorProvider; | ||||||
|   @Inject protected SchemaCreator schemaCreator; |   @Inject protected SchemaCreator schemaCreator; | ||||||
|   @Inject protected SchemaFactory<ReviewDb> schemaFactory; |  | ||||||
|   @Inject protected Sequences seq; |   @Inject protected Sequences seq; | ||||||
|   @Inject protected ThreadLocalRequestContext requestContext; |   @Inject protected ThreadLocalRequestContext requestContext; | ||||||
|   @Inject protected ProjectCache projectCache; |   @Inject protected ProjectCache projectCache; | ||||||
| @@ -176,7 +172,6 @@ public abstract class AbstractQueryChangesTest extends GerritServerTests { | |||||||
|  |  | ||||||
|   protected Injector injector; |   protected Injector injector; | ||||||
|   protected LifecycleManager lifecycle; |   protected LifecycleManager lifecycle; | ||||||
|   protected ReviewDb db; |  | ||||||
|   protected Account.Id userId; |   protected Account.Id userId; | ||||||
|   protected CurrentUser user; |   protected CurrentUser user; | ||||||
|  |  | ||||||
| @@ -214,14 +209,12 @@ public abstract class AbstractQueryChangesTest extends GerritServerTests { | |||||||
|   @After |   @After | ||||||
|   public void cleanUp() { |   public void cleanUp() { | ||||||
|     lifecycle.stop(); |     lifecycle.stop(); | ||||||
|     db.close(); |  | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   protected void initAfterLifecycleStart() throws Exception {} |   protected void initAfterLifecycleStart() throws Exception {} | ||||||
|  |  | ||||||
|   protected void setUpDatabase() throws Exception { |   protected void setUpDatabase() throws Exception { | ||||||
|     schemaCreator.create(); |     schemaCreator.create(); | ||||||
|     db = schemaFactory.open(); |  | ||||||
|  |  | ||||||
|     userId = accountManager.authenticate(AuthRequest.forUser("user")).getAccountId(); |     userId = accountManager.authenticate(AuthRequest.forUser("user")).getAccountId(); | ||||||
|     String email = "user@example.com"; |     String email = "user@example.com"; | ||||||
| @@ -241,11 +234,6 @@ public abstract class AbstractQueryChangesTest extends GerritServerTests { | |||||||
|       public CurrentUser getUser() { |       public CurrentUser getUser() { | ||||||
|         return requestUser; |         return requestUser; | ||||||
|       } |       } | ||||||
|  |  | ||||||
|       @Override |  | ||||||
|       public Provider<ReviewDb> getReviewDbProvider() { |  | ||||||
|         return Providers.of(db); |  | ||||||
|       } |  | ||||||
|     }; |     }; | ||||||
|   } |   } | ||||||
|  |  | ||||||
| @@ -260,9 +248,6 @@ public abstract class AbstractQueryChangesTest extends GerritServerTests { | |||||||
|       lifecycle.stop(); |       lifecycle.stop(); | ||||||
|     } |     } | ||||||
|     requestContext.setContext(null); |     requestContext.setContext(null); | ||||||
|     if (db != null) { |  | ||||||
|       db.close(); |  | ||||||
|     } |  | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   @Before |   @Before | ||||||
|   | |||||||
| @@ -34,7 +34,6 @@ import com.google.gerrit.index.query.FieldBundle; | |||||||
| import com.google.gerrit.lifecycle.LifecycleManager; | import com.google.gerrit.lifecycle.LifecycleManager; | ||||||
| import com.google.gerrit.reviewdb.client.Account; | import com.google.gerrit.reviewdb.client.Account; | ||||||
| import com.google.gerrit.reviewdb.client.AccountGroup; | import com.google.gerrit.reviewdb.client.AccountGroup; | ||||||
| import com.google.gerrit.reviewdb.server.ReviewDb; |  | ||||||
| import com.google.gerrit.server.AnonymousUser; | import com.google.gerrit.server.AnonymousUser; | ||||||
| import com.google.gerrit.server.CurrentUser; | import com.google.gerrit.server.CurrentUser; | ||||||
| import com.google.gerrit.server.IdentifiedUser; | import com.google.gerrit.server.IdentifiedUser; | ||||||
| @@ -58,11 +57,9 @@ import com.google.gerrit.server.util.OneOffRequestContext; | |||||||
| import com.google.gerrit.server.util.RequestContext; | import com.google.gerrit.server.util.RequestContext; | ||||||
| import com.google.gerrit.server.util.ThreadLocalRequestContext; | import com.google.gerrit.server.util.ThreadLocalRequestContext; | ||||||
| import com.google.gerrit.testing.GerritServerTests; | import com.google.gerrit.testing.GerritServerTests; | ||||||
| import com.google.gerrit.testing.InMemoryDatabase; |  | ||||||
| import com.google.inject.Inject; | import com.google.inject.Inject; | ||||||
| import com.google.inject.Injector; | import com.google.inject.Injector; | ||||||
| import com.google.inject.Provider; | import com.google.inject.Provider; | ||||||
| import com.google.inject.util.Providers; |  | ||||||
| import java.util.Arrays; | import java.util.Arrays; | ||||||
| import java.util.Iterator; | import java.util.Iterator; | ||||||
| import java.util.List; | import java.util.List; | ||||||
| @@ -89,8 +86,6 @@ public abstract class AbstractQueryGroupsTest extends GerritServerTests { | |||||||
|  |  | ||||||
|   @Inject private Provider<AnonymousUser> anonymousUser; |   @Inject private Provider<AnonymousUser> anonymousUser; | ||||||
|  |  | ||||||
|   @Inject protected InMemoryDatabase schemaFactory; |  | ||||||
|  |  | ||||||
|   @Inject protected SchemaCreator schemaCreator; |   @Inject protected SchemaCreator schemaCreator; | ||||||
|  |  | ||||||
|   @Inject protected ThreadLocalRequestContext requestContext; |   @Inject protected ThreadLocalRequestContext requestContext; | ||||||
| @@ -109,7 +104,6 @@ public abstract class AbstractQueryGroupsTest extends GerritServerTests { | |||||||
|  |  | ||||||
|   protected LifecycleManager lifecycle; |   protected LifecycleManager lifecycle; | ||||||
|   protected Injector injector; |   protected Injector injector; | ||||||
|   protected ReviewDb db; |  | ||||||
|   protected AccountInfo currentUserInfo; |   protected AccountInfo currentUserInfo; | ||||||
|   protected CurrentUser user; |   protected CurrentUser user; | ||||||
|  |  | ||||||
| @@ -129,11 +123,9 @@ public abstract class AbstractQueryGroupsTest extends GerritServerTests { | |||||||
|   @After |   @After | ||||||
|   public void cleanUp() { |   public void cleanUp() { | ||||||
|     lifecycle.stop(); |     lifecycle.stop(); | ||||||
|     db.close(); |  | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   protected void setUpDatabase() throws Exception { |   protected void setUpDatabase() throws Exception { | ||||||
|     db = schemaFactory.open(); |  | ||||||
|     schemaCreator.create(); |     schemaCreator.create(); | ||||||
|  |  | ||||||
|     Account.Id userId = |     Account.Id userId = | ||||||
| @@ -152,11 +144,6 @@ public abstract class AbstractQueryGroupsTest extends GerritServerTests { | |||||||
|       public CurrentUser getUser() { |       public CurrentUser getUser() { | ||||||
|         return requestUser; |         return requestUser; | ||||||
|       } |       } | ||||||
|  |  | ||||||
|       @Override |  | ||||||
|       public Provider<ReviewDb> getReviewDbProvider() { |  | ||||||
|         return Providers.of(db); |  | ||||||
|       } |  | ||||||
|     }; |     }; | ||||||
|   } |   } | ||||||
|  |  | ||||||
| @@ -167,11 +154,6 @@ public abstract class AbstractQueryGroupsTest extends GerritServerTests { | |||||||
|           public CurrentUser getUser() { |           public CurrentUser getUser() { | ||||||
|             return anonymousUser.get(); |             return anonymousUser.get(); | ||||||
|           } |           } | ||||||
|  |  | ||||||
|           @Override |  | ||||||
|           public Provider<ReviewDb> getReviewDbProvider() { |  | ||||||
|             return Providers.of(db); |  | ||||||
|           } |  | ||||||
|         }); |         }); | ||||||
|   } |   } | ||||||
|  |  | ||||||
| @@ -183,9 +165,6 @@ public abstract class AbstractQueryGroupsTest extends GerritServerTests { | |||||||
|     if (requestContext != null) { |     if (requestContext != null) { | ||||||
|       requestContext.setContext(null); |       requestContext.setContext(null); | ||||||
|     } |     } | ||||||
|     if (db != null) { |  | ||||||
|       db.close(); |  | ||||||
|     } |  | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   @Test |   @Test | ||||||
|   | |||||||
| @@ -38,7 +38,6 @@ import com.google.gerrit.index.project.ProjectIndexCollection; | |||||||
| import com.google.gerrit.lifecycle.LifecycleManager; | import com.google.gerrit.lifecycle.LifecycleManager; | ||||||
| import com.google.gerrit.reviewdb.client.Account; | import com.google.gerrit.reviewdb.client.Account; | ||||||
| import com.google.gerrit.reviewdb.client.Project; | import com.google.gerrit.reviewdb.client.Project; | ||||||
| import com.google.gerrit.reviewdb.server.ReviewDb; |  | ||||||
| import com.google.gerrit.server.AnonymousUser; | import com.google.gerrit.server.AnonymousUser; | ||||||
| import com.google.gerrit.server.CurrentUser; | import com.google.gerrit.server.CurrentUser; | ||||||
| import com.google.gerrit.server.IdentifiedUser; | import com.google.gerrit.server.IdentifiedUser; | ||||||
| @@ -56,11 +55,9 @@ import com.google.gerrit.server.util.OneOffRequestContext; | |||||||
| import com.google.gerrit.server.util.RequestContext; | import com.google.gerrit.server.util.RequestContext; | ||||||
| import com.google.gerrit.server.util.ThreadLocalRequestContext; | import com.google.gerrit.server.util.ThreadLocalRequestContext; | ||||||
| import com.google.gerrit.testing.GerritServerTests; | import com.google.gerrit.testing.GerritServerTests; | ||||||
| import com.google.gerrit.testing.InMemoryDatabase; |  | ||||||
| import com.google.inject.Inject; | import com.google.inject.Inject; | ||||||
| import com.google.inject.Injector; | import com.google.inject.Injector; | ||||||
| import com.google.inject.Provider; | import com.google.inject.Provider; | ||||||
| import com.google.inject.util.Providers; |  | ||||||
| import java.util.Arrays; | import java.util.Arrays; | ||||||
| import java.util.Iterator; | import java.util.Iterator; | ||||||
| import java.util.List; | import java.util.List; | ||||||
| @@ -86,8 +83,6 @@ public abstract class AbstractQueryProjectsTest extends GerritServerTests { | |||||||
|  |  | ||||||
|   @Inject private Provider<AnonymousUser> anonymousUser; |   @Inject private Provider<AnonymousUser> anonymousUser; | ||||||
|  |  | ||||||
|   @Inject protected InMemoryDatabase schemaFactory; |  | ||||||
|  |  | ||||||
|   @Inject protected SchemaCreator schemaCreator; |   @Inject protected SchemaCreator schemaCreator; | ||||||
|  |  | ||||||
|   @Inject protected ThreadLocalRequestContext requestContext; |   @Inject protected ThreadLocalRequestContext requestContext; | ||||||
| @@ -100,7 +95,6 @@ public abstract class AbstractQueryProjectsTest extends GerritServerTests { | |||||||
|  |  | ||||||
|   protected LifecycleManager lifecycle; |   protected LifecycleManager lifecycle; | ||||||
|   protected Injector injector; |   protected Injector injector; | ||||||
|   protected ReviewDb db; |  | ||||||
|   protected AccountInfo currentUserInfo; |   protected AccountInfo currentUserInfo; | ||||||
|   protected CurrentUser user; |   protected CurrentUser user; | ||||||
|  |  | ||||||
| @@ -120,11 +114,9 @@ public abstract class AbstractQueryProjectsTest extends GerritServerTests { | |||||||
|   @After |   @After | ||||||
|   public void cleanUp() { |   public void cleanUp() { | ||||||
|     lifecycle.stop(); |     lifecycle.stop(); | ||||||
|     db.close(); |  | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   protected void setUpDatabase() throws Exception { |   protected void setUpDatabase() throws Exception { | ||||||
|     db = schemaFactory.open(); |  | ||||||
|     schemaCreator.create(); |     schemaCreator.create(); | ||||||
|  |  | ||||||
|     Account.Id userId = createAccount("user", "User", "user@example.com", true); |     Account.Id userId = createAccount("user", "User", "user@example.com", true); | ||||||
| @@ -142,11 +134,6 @@ public abstract class AbstractQueryProjectsTest extends GerritServerTests { | |||||||
|       public CurrentUser getUser() { |       public CurrentUser getUser() { | ||||||
|         return requestUser; |         return requestUser; | ||||||
|       } |       } | ||||||
|  |  | ||||||
|       @Override |  | ||||||
|       public Provider<ReviewDb> getReviewDbProvider() { |  | ||||||
|         return Providers.of(db); |  | ||||||
|       } |  | ||||||
|     }; |     }; | ||||||
|   } |   } | ||||||
|  |  | ||||||
| @@ -157,11 +144,6 @@ public abstract class AbstractQueryProjectsTest extends GerritServerTests { | |||||||
|           public CurrentUser getUser() { |           public CurrentUser getUser() { | ||||||
|             return anonymousUser.get(); |             return anonymousUser.get(); | ||||||
|           } |           } | ||||||
|  |  | ||||||
|           @Override |  | ||||||
|           public Provider<ReviewDb> getReviewDbProvider() { |  | ||||||
|             return Providers.of(db); |  | ||||||
|           } |  | ||||||
|         }); |         }); | ||||||
|   } |   } | ||||||
|  |  | ||||||
| @@ -171,9 +153,6 @@ public abstract class AbstractQueryProjectsTest extends GerritServerTests { | |||||||
|       lifecycle.stop(); |       lifecycle.stop(); | ||||||
|     } |     } | ||||||
|     requestContext.setContext(null); |     requestContext.setContext(null); | ||||||
|     if (db != null) { |  | ||||||
|       db.close(); |  | ||||||
|     } |  | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   @Test |   @Test | ||||||
|   | |||||||
 Submodule plugins/replication updated: 534b041232...2054471ffa
									
								
							
		Reference in New Issue
	
	Block a user
	 Dave Borowitz
					Dave Borowitz