diff --git a/plugins/git4idea/src/META-INF/plugin.xml b/plugins/git4idea/src/META-INF/plugin.xml index 2d3afc086997..80bc6a187329 100644 --- a/plugins/git4idea/src/META-INF/plugin.xml +++ b/plugins/git4idea/src/META-INF/plugin.xml @@ -149,8 +149,8 @@ serviceInterface="git4idea.history.wholeTree.GitCommitsSequentially"/> - + handlers = new THashMap(); + @NotNull + public static GitSSHService getInstance() { + return ServiceManager.getService(GitSSHService.class); + } + /** * @return the port number for XML RCP */ - public abstract int getXmlRcpPort(); + public int getXmlRcpPort() { + return WebServerManager.getInstance().waitForStart().getPort(); + } /** * Get file to the script service @@ -78,8 +88,6 @@ public abstract class GitSSHService { return null; } - protected abstract void addInternalHandler(); - /** * Register handler. Note that handlers must be unregistered using {@link #unregisterHandler(int)}. * @@ -87,7 +95,10 @@ public abstract class GitSSHService { * @return an identifier to pass to the environment variable */ public synchronized int registerHandler(@NotNull Handler handler) { - addInternalHandler(); + XmlRpcServer xmlRpcServer = XmlRpcServer.SERVICE.getInstance(); + if (!xmlRpcServer.hasHandler(GitSSHHandler.HANDLER_NAME)) { + xmlRpcServer.addHandler(GitSSHHandler.HANDLER_NAME, new InternalRequestHandler()); + } while (true) { int candidate = RANDOM.nextInt();