Remove PerThreadCache
PerThreadCache was added Id5de21ed as a concept to cache state while processing a request. Some things have changed since then, most importantly, we have added more 'regular' caches to Gerrit. The only current use of this cache is to cache RefControls inside DefaultPermissionBackend#ForProject. We have instrumented the relevant code a while ago - PermissionCollection#filterLatency that is. The 99.99%-ile is 3ms, so extremely fast. This is a strong indication that we can just stop this caching without replacement. Change-Id: I1378ad083266f49484cc3f9b0584cd38d87c8211
This commit is contained in:
		| @@ -34,7 +34,6 @@ import com.google.gerrit.server.CurrentUser; | ||||
| import com.google.gerrit.server.IdentifiedUser; | ||||
| import com.google.gerrit.server.PeerDaemonUser; | ||||
| import com.google.gerrit.server.account.CapabilityCollection; | ||||
| import com.google.gerrit.server.cache.PerThreadCache; | ||||
| import com.google.gerrit.server.project.ProjectCache; | ||||
| import com.google.gerrit.server.project.ProjectState; | ||||
| import com.google.inject.Inject; | ||||
| @@ -105,11 +104,7 @@ public class DefaultPermissionBackend extends PermissionBackend { | ||||
|     public ForProject project(Project.NameKey project) { | ||||
|       try { | ||||
|         ProjectState state = projectCache.get(project).orElseThrow(illegalState(project)); | ||||
|         ProjectControl control = | ||||
|             PerThreadCache.getOrCompute( | ||||
|                 PerThreadCache.Key.create(ProjectControl.class, project, user.getCacheKey()), | ||||
|                 () -> projectControlFactory.create(user, state)); | ||||
|         return control.asForProject(); | ||||
|         return projectControlFactory.create(user, state).asForProject(); | ||||
|       } catch (Exception e) { | ||||
|         Throwable cause = e.getCause() != null ? e.getCause() : e; | ||||
|         return FailedPermissionBackend.project( | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Patrick Hiesel
					Patrick Hiesel