[ 
https://issues.apache.org/jira/browse/NIFI-784?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14693513#comment-14693513
 ] 

ASF GitHub Bot commented on NIFI-784:
-------------------------------------

Github user taftster commented on the pull request:

    https://github.com/apache/nifi/pull/71#issuecomment-130314880
  
    Why is propertyMap marked volatile?  The value is only ever set once at 
construction time.
    
    If the answer is because of thread safety, the contents of the HashMap are 
not "protected" just because the reference to the map is marked volatile.  
puts/gets to the map do not inherit the memory barrier protections associated 
to the volatile reference.  c.f.  
http://stackoverflow.com/questions/10357823/volatile-hashmap-vs-concurrenthashmap
    
    Maybe a review of the concurrency issues of this processor is in order 
before accepting this merge request?  I'm pretty sure that, even though the 
class will mostly behave correctly since values are set during OnScheduled and 
OnStopped, these are not "safely published" to the map.  While unlikely, other 
threads could potentially see stale values in this map.
    
    Either this class should likely be using ConcurrentHashMap here, or it 
should republish an entirely fresh map by calling "new HashMap()" instead of 
"clear()".


> Improve performance of RouteOnAttribute
> ---------------------------------------
>
>                 Key: NIFI-784
>                 URL: https://issues.apache.org/jira/browse/NIFI-784
>             Project: Apache NiFi
>          Issue Type: Improvement
>          Components: Extensions
>            Reporter: Brian Ghigiarelli
>              Labels: beginner, newbie
>   Original Estimate: 1h
>  Remaining Estimate: 1h
>
> RouteOnAttribute has a couple inefficiencies:
> * Recalculating the dynamic properties into a HashMap for each message in 
> onTrigger when this property map can be pre-computed when the processor is 
> scheduled
> * Logger statements are concatenating strings instead of using lazy 
> evaluation with a string formatter



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to