Ejemplo n.º 1
0
        public void SetGetPropsComplete(ProcessInfo info, string[] propertyLabels, ulong[] propertyVersions)
        {
            lock (SyncRoot)
            {
                // For the Set part
                if (propertyLabels != null && propertyVersions != null)
                {
                    for (int i = 0; i < propertyLabels.Length; i++)
                    {
                        if (m_propertyListeners.ContainsKey(propertyLabels[i]))
                        {
                            List <ulong> versionsToRemove = new List <ulong>();
                            foreach (KeyValuePair <ulong, GetSetPropertyEventHandler> entry in m_propertyListeners[propertyLabels[i]])
                            {
                                if (entry.Key <= propertyVersions[i] || entry.Key == ulong.MaxValue)
                                {
                                    DryadLogger.LogDebug("SetGetProsComplete", "Set complete - m_id: {0} state: {1}, label: {2}", m_id, info.processState, propertyLabels[i]);
                                    XComputeProcessGetSetPropertyEventArgs e = new XComputeProcessGetSetPropertyEventArgs(m_id, info, propertyVersions);
                                    entry.Value(this, e);

                                    versionsToRemove.Add(entry.Key);
                                }
                            }
                            foreach (ulong version in versionsToRemove)
                            {
                                m_propertyListeners[propertyLabels[i]].Remove(version);
                            }
                        }
                    }
                }

                // For the Get part
                if (info != null && info.propertyInfos != null)
                {
                    foreach (ProcessPropertyInfo propInfo in info.propertyInfos)
                    {
                        if (m_propertyListeners.ContainsKey(propInfo.propertyLabel))
                        {
                            List <ulong> versionsToRemove = new List <ulong>();
                            foreach (KeyValuePair <ulong, GetSetPropertyEventHandler> entry in m_propertyListeners[propInfo.propertyLabel])
                            {
                                if (entry.Key <= propInfo.propertyVersion || entry.Key == ulong.MaxValue)
                                {
                                    DryadLogger.LogDebug("SetGetProsComplete", "Get complete - m_id: {0} state: {1}, label: {2}", m_id, info.processState, propInfo.propertyLabel);

                                    XComputeProcessGetSetPropertyEventArgs e = new XComputeProcessGetSetPropertyEventArgs(m_id, info, propertyVersions);
                                    entry.Value(this, e);

                                    versionsToRemove.Add(entry.Key);
                                }
                            }
                            foreach (ulong version in versionsToRemove)
                            {
                                m_propertyListeners[propInfo.propertyLabel].Remove(version);
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public void SetGetPropsComplete(ProcessInfo info, string[] propertyLabels, ulong[] propertyVersions)
        {
            lock (SyncRoot)
            {
                // For the Set part
                if (propertyLabels != null && propertyVersions != null)
                {
                    for (int i = 0; i < propertyLabels.Length; i++)
                    {
                        if (m_propertyListeners.ContainsKey(propertyLabels[i]))
                        {
                            List<ulong> versionsToRemove = new List<ulong>();
                            foreach (KeyValuePair<ulong, GetSetPropertyEventHandler> entry in m_propertyListeners[propertyLabels[i]])
                            {
                                if (entry.Key <= propertyVersions[i] || entry.Key == ulong.MaxValue)
                                {
                                    DryadLogger.LogDebug("SetGetProsComplete", "Set complete - m_id: {0} state: {1}, label: {2}", m_id, info.processState, propertyLabels[i]);
                                    XComputeProcessGetSetPropertyEventArgs e = new XComputeProcessGetSetPropertyEventArgs(m_id, info, propertyVersions);
                                    entry.Value(this, e);

                                    versionsToRemove.Add(entry.Key);
                                }
                            }
                            foreach (ulong version in versionsToRemove)
                            {
                                m_propertyListeners[propertyLabels[i]].Remove(version);
                            }
                        }
                    }
                }

                // For the Get part
                if (info != null && info.propertyInfos != null)
                {
                    foreach (ProcessPropertyInfo propInfo in info.propertyInfos)
                    {
                        if (m_propertyListeners.ContainsKey(propInfo.propertyLabel))
                        {
                            List<ulong> versionsToRemove = new List<ulong>();
                            foreach (KeyValuePair<ulong, GetSetPropertyEventHandler> entry in m_propertyListeners[propInfo.propertyLabel])
                            {
                                if (entry.Key <= propInfo.propertyVersion || entry.Key == ulong.MaxValue)
                                {
                                    DryadLogger.LogDebug("SetGetProsComplete", "Get complete - m_id: {0} state: {1}, label: {2}", m_id, info.processState, propInfo.propertyLabel);

                                    XComputeProcessGetSetPropertyEventArgs e = new XComputeProcessGetSetPropertyEventArgs(m_id, info, propertyVersions);
                                    entry.Value(this, e);

                                    versionsToRemove.Add(entry.Key);
                                }
                            }
                            foreach (ulong version in versionsToRemove)
                            {
                                m_propertyListeners[propInfo.propertyLabel].Remove(version);
                            }
                        }
                    }
                }
            }
        }