Github user markap14 commented on a diff in the pull request:
https://github.com/apache/nifi/pull/2986#discussion_r216411528
--- Diff:
nifi-nar-bundles/nifi-cassandra-bundle/nifi-cassandra-processors/src/main/java/org/apache/nifi/processors/cassandra/PutCassandraQL.java
---
@@ -399,11 +434,13 @@ protected void setStatementObject(final
BoundStatement statement, final int para
@OnUnscheduled
public void stop() {
super.stop();
+ statementCache.clear();
--- End diff --
Would recommend putting this into an @OnStopped method instead of
@OnUnscheduled. As-is, we could get into a race condition where line 225 calls
statementCache.get(), which returns null. Then the @OnUnscheduled method clears
the cache, and then line 228 adds the value to the cache. Then, the next time
this processor is run, the cache is already populated. Given that we are
calling `clear()` here I'm assuming we expect it clear when the processor
starts.
---