Move REST endpoints to singleton scope
The majority of REST endpoints don't maintain state and don't need to be created each time they are used. Exceptions are endpoints with @Option annotation and therefore must stay in default scope. Change-Id: Ia2ac8cfccf41966daa48334cedcb7a20101474d2
This commit is contained in:
committed by
Shawn Pearce
parent
f10c28adc7
commit
75f1583de0
@@ -20,6 +20,7 @@ import com.google.gerrit.extensions.restapi.RestReadView;
|
||||
import com.google.gerrit.reviewdb.client.Project;
|
||||
import com.google.gerrit.server.git.GitRepositoryManager;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Singleton;
|
||||
|
||||
import org.eclipse.jgit.lib.ObjectLoader;
|
||||
import org.eclipse.jgit.lib.Repository;
|
||||
@@ -30,6 +31,7 @@ import org.eclipse.jgit.treewalk.TreeWalk;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
|
||||
@Singleton
|
||||
public class GetContent implements RestReadView<FileResource> {
|
||||
private final GitRepositoryManager repoManager;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user