Search in sources :

Example 1 with EventListener

use of com.facebook.presto.spi.eventlistener.EventListener in project presto by prestodb.

the class EventListenerManager method setConfiguredEventListener.

@VisibleForTesting
protected void setConfiguredEventListener(String name, Map<String, String> properties) {
    requireNonNull(name, "name is null");
    requireNonNull(properties, "properties is null");
    log.info("-- Loading event listener --");
    EventListenerFactory eventListenerFactory = eventListenerFactories.get(name);
    checkState(eventListenerFactory != null, "Event listener %s is not registered", name);
    try (ThreadContextClassLoader ignored = new ThreadContextClassLoader(eventListenerFactory.getClass().getClassLoader())) {
        EventListener eventListener = eventListenerFactory.create(ImmutableMap.copyOf(properties));
        this.configuredEventListener.set(Optional.of(eventListener));
    }
    log.info("-- Loaded event listener %s --", name);
}
Also used : EventListenerFactory(com.facebook.presto.spi.eventlistener.EventListenerFactory) EventListener(com.facebook.presto.spi.eventlistener.EventListener) ThreadContextClassLoader(com.facebook.presto.spi.classloader.ThreadContextClassLoader) VisibleForTesting(com.google.common.annotations.VisibleForTesting)

Aggregations

ThreadContextClassLoader (com.facebook.presto.spi.classloader.ThreadContextClassLoader)1 EventListener (com.facebook.presto.spi.eventlistener.EventListener)1 EventListenerFactory (com.facebook.presto.spi.eventlistener.EventListenerFactory)1 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1