public ServerProxy GetProxy(Helpers.EclipseWorkspace workspace) { if (workspace == null) return null; ServerProxy retVal = null; lock (proxyList) { if (!proxyList.TryGetValue(workspace, out retVal)) { Telemetry.Client.Get().TrackEvent("App.ServerLaunch"); retVal = new ServerProxy("javapkgsrv-" + Guid.NewGuid()); retVal.LIFORequests.Add(Protocol.Request.RequestType.ParamHelpPositionUpdate); if (retVal.Start(workspace.Name)) { proxyList.Add(workspace, retVal); refCounts.Add(retVal, 1); Telemetry_MaxInstances = Math.Max(proxyList.Count, Telemetry_MaxInstances); } else return null; } else ++refCounts[retVal]; } retVal.TerminatedAbnormally += ServerProxy_TerminatedAbnormally; return retVal; }
public JavaEditor(Collection<ITextBuffer> subjectBuffers, IWpfTextView textView, ServerProxy javaPkgServer, EclipseWorkspace eclipseWorkspace) : base(subjectBuffers, textView, eclipseWorkspace) { JavaPkgServer = javaPkgServer; OnIdleQueue = new Dictionary<object,Action>(); IdleActions = new List<Action>(3); TypeRootIdentifier = null; ParserEnabled = true; JavaPkgServer.TerminatedAbnormally += JavaPkgServer_TerminatedAbnormally; }
public void ReleaseProxy(ServerProxy proxy) { lock (proxyList) { int refCount = --refCounts[proxy]; if (refCount == 0) { Telemetry.Client.Get().TrackEvent("App.ServerStop"); proxy.Stop(); refCounts.Remove(proxy); var listKey = from item in proxyList where item.Value.Equals(proxy) select item.Key; proxyList.Remove(listKey.First()); } } }