You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lens.apache.org by am...@apache.org on 2014/12/29 09:05:57 UTC
incubator-lens git commit: LENS-167 : Add compile time type checks in
event service (Rajat Khandelwal via amareshwari)
Repository: incubator-lens
Updated Branches:
refs/heads/master f2fe73fd3 -> cc828a530
LENS-167 : Add compile time type checks in event service (Rajat Khandelwal via amareshwari)
Project: http://git-wip-us.apache.org/repos/asf/incubator-lens/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-lens/commit/cc828a53
Tree: http://git-wip-us.apache.org/repos/asf/incubator-lens/tree/cc828a53
Diff: http://git-wip-us.apache.org/repos/asf/incubator-lens/diff/cc828a53
Branch: refs/heads/master
Commit: cc828a5303e033dd145b70f5683393f5472a27e5
Parents: f2fe73f
Author: Amareshwari Sriramdasu <am...@inmobi.com>
Authored: Mon Dec 29 13:35:42 2014 +0530
Committer: Amareshwari Sriramdasu <am...@inmobi.com>
Committed: Mon Dec 29 13:35:42 2014 +0530
----------------------------------------------------------------------
.../server/api/events/LensEventService.java | 8 +++---
.../apache/lens/server/EventServiceImpl.java | 28 ++++++++++----------
2 files changed, 18 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/cc828a53/lens-server-api/src/main/java/org/apache/lens/server/api/events/LensEventService.java
----------------------------------------------------------------------
diff --git a/lens-server-api/src/main/java/org/apache/lens/server/api/events/LensEventService.java b/lens-server-api/src/main/java/org/apache/lens/server/api/events/LensEventService.java
index 6004063..f7d6f08 100644
--- a/lens-server-api/src/main/java/org/apache/lens/server/api/events/LensEventService.java
+++ b/lens-server-api/src/main/java/org/apache/lens/server/api/events/LensEventService.java
@@ -39,7 +39,7 @@ public interface LensEventService {
* @param listener the listener
* @param eventType the event type
*/
- void addListenerForType(LensEventListener listener, Class<? extends LensEvent> eventType);
+ <T extends LensEvent> void addListenerForType(LensEventListener<? super T> listener, Class<T> eventType);
/**
* Remove listener for a given event type.
@@ -47,14 +47,14 @@ public interface LensEventService {
* @param listener the listener
* @param eventType the event type
*/
- void removeListenerForType(LensEventListener listener, Class<? extends LensEvent> eventType);
+ <T extends LensEvent> void removeListenerForType(LensEventListener<? super T> listener, Class<T> eventType);
/**
* Remove this listener instance from all subscribed event types.
*
* @param listener the listener
*/
- void removeListener(LensEventListener listener);
+ <T extends LensEvent> void removeListener(LensEventListener<? super T> listener);
/**
* Process an event, and notify all listeners interested in this event.
@@ -70,5 +70,5 @@ public interface LensEventService {
* @param changeType the change type
* @return all the listeners
*/
- Collection<LensEventListener> getListeners(Class<? extends LensEvent> changeType);
+ <T extends LensEvent> Collection<LensEventListener> getListeners(Class<T> changeType);
}
http://git-wip-us.apache.org/repos/asf/incubator-lens/blob/cc828a53/lens-server/src/main/java/org/apache/lens/server/EventServiceImpl.java
----------------------------------------------------------------------
diff --git a/lens-server/src/main/java/org/apache/lens/server/EventServiceImpl.java b/lens-server/src/main/java/org/apache/lens/server/EventServiceImpl.java
index aadd0e1..377cb8b 100644
--- a/lens-server/src/main/java/org/apache/lens/server/EventServiceImpl.java
+++ b/lens-server/src/main/java/org/apache/lens/server/EventServiceImpl.java
@@ -63,7 +63,7 @@ public class EventServiceImpl extends AbstractService implements LensEventServic
/*
* (non-Javadoc)
- *
+ *
* @see org.apache.hive.service.AbstractService#init(org.apache.hadoop.hive.conf.HiveConf)
*/
@Override
@@ -76,10 +76,10 @@ public class EventServiceImpl extends AbstractService implements LensEventServic
/*
* (non-Javadoc)
- *
+ *
* @see
- * org.apache.lens.server.api.events.LensEventService#removeListener(org.apache.lens.server.api.events.LensEventListener
- * )
+ * org.apache.lens.server.api.events.LensEventService#removeListener
+ * (org.apache.lens.server.api.events.LensEventListener)
*/
@Override
public void removeListener(LensEventListener listener) {
@@ -133,7 +133,7 @@ public class EventServiceImpl extends AbstractService implements LensEventServic
/*
* (non-Javadoc)
- *
+ *
* @see java.lang.Runnable#run()
*/
public void run() {
@@ -154,7 +154,7 @@ public class EventServiceImpl extends AbstractService implements LensEventServic
/*
* (non-Javadoc)
- *
+ *
* @see org.apache.lens.server.api.events.LensEventService#notifyEvent(org.apache.lens.server.api.events.LensEvent)
*/
@SuppressWarnings("unchecked")
@@ -172,17 +172,17 @@ public class EventServiceImpl extends AbstractService implements LensEventServic
/*
* (non-Javadoc)
- *
+ *
* @see org.apache.lens.server.api.events.LensEventService#getListeners(java.lang.Class)
*/
@Override
- public Collection<LensEventListener> getListeners(Class<? extends LensEvent> eventType) {
+ public <T extends LensEvent> Collection<LensEventListener> getListeners(Class<T> eventType) {
return Collections.unmodifiableList(eventListeners.get(eventType));
}
/*
* (non-Javadoc)
- *
+ *
* @see org.apache.hive.service.AbstractService#start()
*/
@Override
@@ -192,7 +192,7 @@ public class EventServiceImpl extends AbstractService implements LensEventServic
/*
* (non-Javadoc)
- *
+ *
* @see org.apache.hive.service.AbstractService#stop()
*/
@Override
@@ -220,12 +220,12 @@ public class EventServiceImpl extends AbstractService implements LensEventServic
/*
* (non-Javadoc)
- *
+ *
* @see org.apache.lens.server.api.events.LensEventService#addListenerForType(org.apache.lens.server.api.events.
* LensEventListener, java.lang.Class)
*/
@Override
- public void addListenerForType(LensEventListener listener, Class<? extends LensEvent> eventType) {
+ public <T extends LensEvent> void addListenerForType(LensEventListener<? super T> listener, Class<T> eventType) {
synchronized (eventListeners) {
List<LensEventListener> listeners = eventListeners.get(eventType);
if (listeners == null) {
@@ -239,12 +239,12 @@ public class EventServiceImpl extends AbstractService implements LensEventServic
/*
* (non-Javadoc)
- *
+ *
* @see org.apache.lens.server.api.events.LensEventService#removeListenerForType(org.apache.lens.server.api.events.
* LensEventListener, java.lang.Class)
*/
@Override
- public void removeListenerForType(LensEventListener listener, Class<? extends LensEvent> eventType) {
+ public <T extends LensEvent> void removeListenerForType(LensEventListener<? super T> listener, Class<T> eventType) {
synchronized (eventListeners) {
List<LensEventListener> listeners = eventListeners.get(eventType);
if (listeners != null) {