Beispiel #1
0
        public static bool EventsAreEqualsAllowNull(
            EventBean first,
            EventBean second)
        {
            if (first == null) {
                return second == null;
            }

            return second != null && first.Equals(second);
        }
Beispiel #2
0
            public bool HandleFilterFault(EventBean theEvent, long version)
            {
                /*
                 * Handle filter faults such as
                 *   - a) App thread determines event E1 applies to CTX + CP1
                 *     b) Timer thread destroys CP1
                 *     c) App thread processes E1 for CTX allocating CP2, processing E1 for CP2
                 *     d) App thread processes E1 for CP1, filter-faulting and ending up dropping the event for CP1 because of this handler
                 *
                 *   - a) App thread determines event E1 applies to CTX + CP1
                 *     b) App thread processes E1 for CTX, no action
                 *     c) Timer thread destroys CP1
                 *     d) App thread processes E1 for CP1, filter-faulting and ending up processing E1 into CTX because of this handler
                 */

                AgentInstanceContext aiCreate = _contextControllerInitTerm.Factory.FactoryContext.AgentInstanceContextCreate;

                using (aiCreate.EpStatementAgentInstanceHandle.StatementAgentInstanceLock.AcquireWriteLock())
                {
                    Object    key     = _contextControllerInitTerm.GetDistinctKey(theEvent);
                    EventBean trigger = _contextControllerInitTerm.DistinctContexts.Get(key);

                    // see if we find that context partition
                    if (trigger != null)
                    {
                        // true for we have already handled this event
                        // false for filter fault
                        return(trigger.Equals(theEvent));
                    }

                    // not found: evaluate against context
                    StatementAgentInstanceUtil.EvaluateEventForStatement(
                        _contextControllerInitTerm.Factory.FactoryContext.ServicesContext,
                        theEvent, null, Collections.SingletonList(new AgentInstance(null, aiCreate, null)));

                    return(true); // we handled the event
                }
            }