예제 #1
0
        public void UnregisterCallback(String variableName, int agentInstanceId, VariableChangeCallback variableChangeCallback)
        {
            var metaData = _variables.Get(variableName);

            if (metaData == null)
            {
                return;
            }

            var cps = _changeCallbacksPerCP[metaData.VariableNumber];

            if (cps == null)
            {
                return;
            }

            if (metaData.ContextPartitionName == null)
            {
                agentInstanceId = 0;
            }

            ICollection <VariableChangeCallback> callbacks = cps.Get(agentInstanceId);

            if (callbacks != null)
            {
                callbacks.Remove(variableChangeCallback);
            }
        }
        public void UnregisterCallback(
            string deploymentId,
            string variableName,
            int agentInstanceId,
            VariableChangeCallback variableChangeCallback)
        {
            var entry = DeploymentsWithVariables.Get(deploymentId);

            var variable = entry?.GetVariable(variableName);
            if (variable == null) {
                return;
            }

            var cps = changeCallbacksPerCP[variable.VariableNumber];
            if (cps == null) {
                return;
            }

            if (variable.MetaData.OptionalContextName == null) {
                agentInstanceId = 0;
            }

            var callbacks = cps.Get(agentInstanceId);
            callbacks?.Remove(variableChangeCallback);
        }
예제 #3
0
        public void RegisterCallback(String variableName, int agentInstanceId, VariableChangeCallback variableChangeCallback)
        {
            var metaData = _variables.Get(variableName);

            if (metaData == null)
            {
                return;
            }

            IDictionary <int, ICollection <VariableChangeCallback> > cps = _changeCallbacksPerCP[metaData.VariableNumber];

            if (cps == null)
            {
                cps = new Dictionary <int, ICollection <VariableChangeCallback> >();
                _changeCallbacksPerCP[metaData.VariableNumber] = cps;
            }

            if (metaData.ContextPartitionName == null)
            {
                agentInstanceId = EPStatementStartMethodConst.DEFAULT_AGENT_INSTANCE_ID;
            }

            ICollection <VariableChangeCallback> callbacks = cps.Get(agentInstanceId);

            if (callbacks == null)
            {
                callbacks = new CopyOnWriteArraySet <VariableChangeCallback>();
                cps.Put(agentInstanceId, callbacks);
            }
            callbacks.Add(variableChangeCallback);
        }
        public void RegisterCallback(
            string deploymentId,
            string variableName,
            int agentInstanceId,
            VariableChangeCallback variableChangeCallback)
        {
            var entry = DeploymentsWithVariables.Get(deploymentId);

            var variable = entry?.GetVariable(variableName);
            if (variable == null) {
                return;
            }

            var cps = changeCallbacksPerCP[variable.VariableNumber];
            if (cps == null) {
                cps = new Dictionary<int, ICollection<VariableChangeCallback>>();
                changeCallbacksPerCP[variable.VariableNumber] = cps;
            }

            if (variable.MetaData.OptionalContextName == null) {
                agentInstanceId = DEFAULT_AGENT_INSTANCE_ID;
            }

            var callbacks = cps.Get(agentInstanceId);
            if (callbacks == null) {
                callbacks = new CopyOnWriteArraySet<VariableChangeCallback>();
                cps.Put(agentInstanceId, callbacks);
            }

            callbacks.Add(variableChangeCallback);
        }