コード例 #1
0
        public List <Proxy_Event> GetHighLoadEvents(string[] classes, string eventOperation)
        {
            // this fires an event every 2 seconds (for this connection). This is roughly equivalent to the rate at which events occur
            // during a VM boot up.

            ReadOnlyCollection <string> typeNames = classes.Length == 0 || (classes.Length == 1 && classes[0] == "*")
                                               ? SimpleProxyMethodParser.AllTypes
                                               : new ReadOnlyCollection <string>(classes);

            List <Proxy_Event> output = new List <Proxy_Event>();

            if (HighLoadMode && DateTime.Now - lastHighLoadEvent > TimeSpan.FromSeconds(2))
            {
                lastHighLoadEvent = DateTime.Now;

                foreach (string typeName in typeNames)
                {
                    Response <object> resp;
                    if (TryGetAllRecords(typeName, out resp))
                    {
                        foreach (string opaqueRef in ((Hashtable)resp.Value).Keys)
                        {
                            output.Add(DbProxy.MakeProxyEvent(typeName, opaqueRef, eventOperation, TypeCache.GetProxyType(typeName), _proxy.get_record(typeName, opaqueRef, false)));
                        }
                    }
                }
            }
            return(output);
        }