You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@carbondata.apache.org by kunal642 <gi...@git.apache.org> on 2018/01/17 13:39:53 UTC

[GitHub] carbondata pull request #1821: [HOTFIX] Listeners not getting registered to ...

Github user kunal642 commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/1821#discussion_r162052102
  
    --- Diff: core/src/main/java/org/apache/carbondata/events/OperationListenerBus.java ---
    @@ -57,9 +57,9 @@ public OperationListenerBus addListener(Class<? extends Event> eventClass,
           OperationEventListener operationEventListener) {
     
         String eventType = eventClass.getName();
    -    List<OperationEventListener> operationEventListeners = eventMap.get(eventType);
    +    Set<OperationEventListener> operationEventListeners = eventMap.get(eventType);
         if (null == operationEventListeners) {
    -      operationEventListeners = new CopyOnWriteArrayList<>();
    +      operationEventListeners = new CopyOnWriteArraySet<>();
    --- End diff --
    
    1) Changed the code to use addIfAbsent method instead of add. This will take care of dublicate entries.
    2) changed the OperationEventListener interface to abstract class with equals and hashcode which will compare the class name.


---