org.apache.lens.server
Class EventServiceImpl

java.lang.Object
  extended by org.apache.hive.service.AbstractService
      extended by org.apache.lens.server.EventServiceImpl
All Implemented Interfaces:
org.apache.hive.service.Service, LensEventService

public class EventServiceImpl
extends org.apache.hive.service.AbstractService
implements LensEventService

Implementation of LensEventService


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.hive.service.Service
org.apache.hive.service.Service.STATE
 
Field Summary
static org.apache.commons.logging.Log LOG
          The Constant LOG.
 
Fields inherited from interface org.apache.lens.server.api.events.LensEventService
NAME
 
Constructor Summary
EventServiceImpl(String name)
          Instantiates a new event service impl.
 
Method Summary
<T extends LensEvent>
void
addListenerForType(LensEventListener<? super T> listener, Class<T> eventType)
          Add a listener for the given event type.
 Map<Class<? extends LensEvent>,List<LensEventListener>> getEventListeners()
           
<T extends LensEvent>
Collection<LensEventListener>
getListeners(Class<T> eventType)
          Get all listeners of a particular type.
 void init(org.apache.hadoop.hive.conf.HiveConf hiveConf)
           
 void notifyEvent(LensEvent evt)
          Process an event, and notify all listeners interested in this event.
 void removeListener(LensEventListener listener)
          Remove this listener instance from all subscribed event types.
<T extends LensEvent>
void
removeListenerForType(LensEventListener<? super T> listener, Class<T> eventType)
          Remove listener for a given event type.
 void start()
           
 void stop()
           
 
Methods inherited from class org.apache.hive.service.AbstractService
getHiveConf, getName, getServiceState, getStartTime, register, unregister
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOG

public static final org.apache.commons.logging.Log LOG
The Constant LOG.

Constructor Detail

EventServiceImpl

public EventServiceImpl(String name)
Instantiates a new event service impl.

Parameters:
name - the name
Method Detail

init

public void init(org.apache.hadoop.hive.conf.HiveConf hiveConf)
Specified by:
init in interface org.apache.hive.service.Service
Overrides:
init in class org.apache.hive.service.AbstractService

removeListener

public void removeListener(LensEventListener listener)
Description copied from interface: LensEventService
Remove this listener instance from all subscribed event types.

Specified by:
removeListener in interface LensEventService
Parameters:
listener - the listener

notifyEvent

public void notifyEvent(LensEvent evt)
                 throws LensException
Description copied from interface: LensEventService
Process an event, and notify all listeners interested in this event.

Specified by:
notifyEvent in interface LensEventService
Parameters:
evt - object
Throws:
LensException - the lens exception

getListeners

public <T extends LensEvent> Collection<LensEventListener> getListeners(Class<T> eventType)
Description copied from interface: LensEventService
Get all listeners of a particular type.

Specified by:
getListeners in interface LensEventService
Parameters:
eventType - the change type
Returns:
all the listeners

start

public void start()
Specified by:
start in interface org.apache.hive.service.Service
Overrides:
start in class org.apache.hive.service.AbstractService

stop

public void stop()
Specified by:
stop in interface org.apache.hive.service.Service
Overrides:
stop in class org.apache.hive.service.AbstractService

getEventListeners

public Map<Class<? extends LensEvent>,List<LensEventListener>> getEventListeners()

addListenerForType

public <T extends LensEvent> void addListenerForType(LensEventListener<? super T> listener,
                                                     Class<T> eventType)
Description copied from interface: LensEventService
Add a listener for the given event type. Use this method to register if the same class is expected to receive events of different types

Specified by:
addListenerForType in interface LensEventService
Parameters:
listener - the listener
eventType - the event type

removeListenerForType

public <T extends LensEvent> void removeListenerForType(LensEventListener<? super T> listener,
                                                        Class<T> eventType)
Description copied from interface: LensEventService
Remove listener for a given event type.

Specified by:
removeListenerForType in interface LensEventService
Parameters:
listener - the listener
eventType - the event type


Copyright © 2014–2015 Apache Software Foundation. All rights reserved.