Please Note This forum exists for community support for the Mango product family and the Radix IoT Platform. Although Radix IoT employees participate in this forum from time to time, there is no guarantee of a response to anything posted here, nor can Radix IoT, LLC guarantee the accuracy of any information expressed or conveyed. Specific project questions from customers with active support contracts are asked to send requests to support@radixiot.com.

Radix IoT Website Mango 3 Documentation Website Mango 4 Documentation Website

Call to set event active when state is not active


  • In case anyone runs into this message it is because the point value has changed in between the time the point event detector was triggered and the point event detector delay expired and the new point value has caused the point event detector to be set to inactive. Generated from a multistate point on a virtual data source:

    WARN 2010-01-12 06:05:48,450 (com.serotonin.mango.rt.event.detectors.StateDetectorRT.setEventActive:94) - Call to set event active when state is not active. Ignoring.

    
    
    /**
     * @author Matthew Lohbihler
     */
    abstract public class StateDetectorRT extends TimeDelayedEventDetectorRT {
        private final Log log = LogFactory.getLog(StateDetectorRT.class);
        
        /**
         * State field. Whether the state has been detected or not. This field is used to prevent multiple events 
         * being raised during the duration of a single state detection.
         */
        private boolean stateActive;
    
        private long stateActiveTime;
        private long stateInactiveTime;
        
        /**
         * State field. Whether the event is currently active or not. This field is used to prevent multiple events being 
         * raised during the duration of a single state detection.
         */
        private boolean eventActive;
        
        protected boolean isActive() {
            return eventActive;
        }
        
        public boolean isEventActive() {
            return eventActive;
        }
        
        private void changeStateActive() {
            stateActive = !stateActive;
            
            if (stateActive)
                // Schedule a job that will call the event active if it runs.
                scheduleJob(stateActiveTime);
            else
                unscheduleJob();
        }
        
        abstract protected boolean stateDetected(PointValueTime newValue);
        
        @Override
        public void pointChanged(PointValueTime oldValue, PointValueTime newValue) {
            if (stateDetected(newValue)) {
                if (!stateActive) {
                    stateActiveTime = newValue.getTime();
                    changeStateActive();
                }
            }
            else {
                if (stateActive) {
                    stateInactiveTime = newValue.getTime();
                    changeStateActive();
                }
            }
        }
        
        @Override
        synchronized public void setEventActive(boolean b) {
            eventActive = b;
            if (eventActive) {
                // Just for the fun of it, make sure that the state is active.
                if (stateActive)
                    // Ok, things are good. Carry on...
                    // Raise the event.
                    raiseEvent(stateActiveTime + getDurationMS());
                else {
                    // Perhaps the job wasn't successfully unscheduled. Write a log entry and ignore.
                    log.warn("Call to set event active when state is not active. Ignoring."); // *******ERROR GENERATED HERE
                      eventActive = false;
                }
            }
            else
                // Deactive the event.
                returnToNormal(stateInactiveTime);
        }
    }
    
    

    The event detector had a delay of 1 second. It looks like pointChanged was called again before the one second delay on setEventActive was up. I've removed the delay and will see if the message still occurs.


  • Hi Craig,

    Is this version 1.8.0? Can you turn on the submission of exception messages to Serotonin (in the settings page)? I've seen this message before, and have some instrumentation in the code to track down the cause.