Example #1
0
        public void AddPropertyListener(string label, ulong version, GetSetPropertyEventHandler handler)
        {
            lock (SyncRoot)
            {
                // Is there an entry for this label?
                if (m_propertyListeners.ContainsKey(label) == false)
                {
                    m_propertyListeners.Add(label, new Dictionary <ulong, GetSetPropertyEventHandler>());
                }

                // Is there an entry for this version
                if (m_propertyListeners[label].ContainsKey(version))
                {
                    m_propertyListeners[label][version] += handler;
                }
                else
                {
                    m_propertyListeners[label].Add(version, handler);
                }
            }
        }
Example #2
0
        public void AddPropertyListener(string label, ulong version, GetSetPropertyEventHandler handler)
        {
            lock (SyncRoot)
            {
                // Is there an entry for this label?
                if (m_propertyListeners.ContainsKey(label) == false)
                {
                    m_propertyListeners.Add(label, new Dictionary<ulong,GetSetPropertyEventHandler>());
                }

                // Is there an entry for this version
                if (m_propertyListeners[label].ContainsKey(version))
                {
                    m_propertyListeners[label][version] += handler;
                }
                else
                {
                    m_propertyListeners[label].Add(version, handler);
                }
            }
        }
Example #3
0
        public bool SetGetProps(int processId, ProcessPropertyInfo[] infos, string blockOnLabel, ulong blockOnVersion, long maxBlockTime, string getPropLabel, bool ProcessStatistics, GetSetPropertyEventHandler handler)
        {
            if (this.processTable.ContainsKey(processId))
            {
                if (infos != null && infos.Length > 0)
                {
                    // Only add for the first property info since we only want to fire completion once per request
                    this.processTable[processId].AddPropertyListener(infos[0].propertyLabel, infos[0].propertyVersion, handler);
                }
                else if (getPropLabel != null && getPropLabel.Length > 0)
                {
                    this.processTable[processId].AddPropertyListener(getPropLabel, 0, handler);
                }
                else
                {
                    DryadLogger.LogError(0, null, "infos and getPropLabel both empty");
                    return false;
                }

                lock (this.processTable[processId].SyncRoot)
                {
                    if (this.processTable[processId].Dispatcher != null)
                    {
                        if (this.processTable[processId].Dispatcher.SetGetProps(replyUri, processId, infos, blockOnLabel, blockOnVersion, maxBlockTime, getPropLabel, ProcessStatistics))
                        {
                            return true;
                        }
                    }
                }

                // Keep returning error to GM and let its fault-tolerance kick in
                if (dispatcherPool.Count == 0)
                {
                    DryadLogger.LogCritical(0, null, "All dispatchers are faulted.");
                }
                return false;
            }
            else
            {
                DryadLogger.LogError(0, null, "process id {0} not found in process table", processId);
                return false;
            }
        }