@Override
    public void updateOrAdd(ComplexEventChunk<StateEvent> updateOrAddingEventChunk,
                            CompiledCondition compiledCondition,
                            CompiledUpdateSet compiledUpdateSet,
                            AddingStreamEventExtractor addingStreamEventExtractor) {
        readWriteLock.writeLock().lock();
        TableState state = stateHolder.getState();
        InMemoryCompiledCondition inMemoryCompiledCondition = (InMemoryCompiledCondition) compiledCondition;
        try {
            ComplexEventChunk<StateEvent> failedEvents =
                    ((Operator) inMemoryCompiledCondition.getOperatorCompiledCondition()).
                            tryUpdate(updateOrAddingEventChunk, state.eventHolder,
                                    (InMemoryCompiledUpdateSet) compiledUpdateSet,
                                    addingStreamEventExtractor);
            if (failedEvents != null && failedEvents.getFirst() != null) {
                state.eventHolder.add(reduceEventsForUpdateOrInsert(
                        addingStreamEventExtractor, inMemoryCompiledCondition,
                        (InMemoryCompiledUpdateSet) compiledUpdateSet, failedEvents));
            }
        } finally {
            stateHolder.returnState(state);
            readWriteLock.writeLock().unlock();
        }
    }
In-memory event table implementation of SiddhiQL.
modules/siddhi-core/src/main/java/io/siddhi/core/table/InMemoryTable.java