Github user ravipesala commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/1473#discussion_r149900866
--- Diff:
core/src/main/java/org/apache/carbondata/events/OperationListenerBus.java ---
@@ -0,0 +1,105 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.carbondata.events;
+
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import org.apache.carbondata.core.constants.CarbonCommonConstants;
+
+/**
+ * An event bus which posts events to its listeners.
+ */
+public class OperationListenerBus {
+
+ /**
+ * singleton instance
+ */
+ private static final OperationListenerBus INSTANCE = new
OperationListenerBus();
+
+ /**
+ * Event map to hold all listeners corresponding to an event
+ */
+ protected Map<String, List<OperationEventListener>> eventMap =
+ new
ConcurrentHashMap<>(CarbonCommonConstants.DEFAULT_COLLECTION_SIZE);
+
+ /**
+ * @return
+ */
+ public static OperationListenerBus getInstance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Add a listener to listen events. This method is thread-safe and can
be called in any thread.
+ *
+ * @param eventType
+ * @param operationEventListener
+ */
+ public void addListener(String eventType, OperationEventListener
operationEventListener) {
--- End diff --
Pass the event class instead of String, like Class<? extends Event>
---