Beispiel #1
0
        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;
        }
Beispiel #2
0
        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;
        }
Beispiel #3
0
        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());
                }
            }
        }