Source:
<code>public StreamEvent find(CompiledCondition compiledCondition, StateEvent matchingEvent) throws ConnectionUnavailableException { RecordStoreCompiledCondition recordStoreCompiledCondition; if (isCacheEnabled) { <START> RecordStoreCompiledCondition compiledConditionTemp = (RecordStoreCompiledCondition) compiledCondition; <END> CompiledConditionWithCache compiledConditionAggregation = (CompiledConditionWithCache) compiledConditionTemp.compiledCondition; recordStoreCompiledCondition = new RecordStoreCompiledCondition(compiledConditionTemp. variableExpressionExecutorMap, compiledConditionAggregation.getStoreCompileCondition()); StreamEvent cacheResults = cachedTable.find(compiledConditionAggregation.getCacheCompileCondition(), matchingEvent); if (cacheResults != null) { return cacheResults; } } else { recordStoreCompiledCondition = ((RecordStoreCompiledCondition) compiledCondition); } Map<String, Object> findConditionParameterMap = new HashMap<>(); for (Map.Entry<String, ExpressionExecutor> entry : recordStoreCompiledCondition.variableExpressionExecutorMap .entrySet()) { findConditionParameterMap.put(entry.getKey(), entry.getValue().execute(matchingEvent)); } Iterator<Object[]> records; if (recordTableHandler != null) { records = recordTableHandler.find(matchingEvent.getTimestamp(), findConditionParameterMap, recordStoreCompiledCondition.compiledCondition); } else { records = find(findConditionParameterMap, recordStoreCompiledCondition.compiledCondition); } ComplexEventChunk<StreamEvent> streamEventComplexEventChunk = new ComplexEventChunk<>(true); if (records != null) { while (records.hasNext()) { Object[] record = records.next(); StreamEvent streamEvent = storeEventPool.newInstance(); System.arraycopy(record, 0, streamEvent.getOutputData(), 0, record.length); streamEventComplexEventChunk.add(streamEvent); } } return streamEventComplexEventChunk.getFirst(); }</code><technical_language>a read lock for find</technical_language>

Target:
public StreamEvent find(CompiledCondition compiledCondition, StateEvent matchingEvent) throws ConnectionUnavailableException { RecordStoreCompiledCondition recordStoreCompiledCondition; CompiledConditionWithCache compiledConditionAggregation = null; if (isCacheEnabled) { RecordStoreCompiledCondition compiledConditionTemp = (RecordStoreCompiledCondition) compiledCondition; compiledConditionAggregation = (CompiledConditionWithCache) compiledConditionTemp.compiledCondition; recordStoreCompiledCondition = new RecordStoreCompiledCondition(compiledConditionTemp. variableExpressionExecutorMap, compiledConditionAggregation.getStoreCompileCondition()); } else { recordStoreCompiledCondition = ((RecordStoreCompiledCondition) compiledCondition); } Map<String, Object> findConditionParameterMap = new HashMap<>(); for (Map.Entry<String, ExpressionExecutor> entry : recordStoreCompiledCondition.variableExpressionExecutorMap .entrySet()) { findConditionParameterMap.put(entry.getKey(), entry.getValue().execute(matchingEvent)); } Iterator<Object[]> records; if (isCacheEnabled) { assert compiledConditionAggregation != null; readWriteLock.readLock().lock(); try { StreamEvent cacheResults = cachedTable.find(compiledConditionAggregation.getCacheCompileCondition(), matchingEvent); if (cacheResults != null) { return cacheResults; } if (recordTableHandler != null) { records = recordTableHandler.find(matchingEvent.getTimestamp(), findConditionParameterMap, recordStoreCompiledCondition.compiledCondition); } else { records = find(findConditionParameterMap, recordStoreCompiledCondition.compiledCondition); } } finally { readWriteLock.readLock().unlock(); } } else { if (recordTableHandler != null) { records = recordTableHandler.find(matchingEvent.getTimestamp(), findConditionParameterMap, recordStoreCompiledCondition.compiledCondition); } else { records = find(findConditionParameterMap, recordStoreCompiledCondition.compiledCondition); } } ComplexEventChunk<StreamEvent> streamEventComplexEventChunk = new ComplexEventChunk<>(true); if (records != null) { while (records.hasNext()) { Object[] record = records.next(); StreamEvent streamEvent = storeEventPool.newInstance(); System.arraycopy(record, 0, streamEvent.getOutputData(), 0, record.length); streamEventComplexEventChunk.add(streamEvent); } } return streamEventComplexEventChunk.getFirst(); }