Register a listener to be called only on success, with the result.
199089
public final void listenInline(Listener<T> onSuccess) {
		listenInline(new AsyncWorkListener<T,TError>() {
			@Override
			public void ready(T result) {
				onSuccess.fire(result);
			}
			
			@Override
			public void error(TError error) {
			}
			
			@Override
			public void cancelled(CancelException event) {
			}
			
			@Override
			public String toString() {
				return "AsyncWork.listenInline: " + onSuccess;
			}
		});
	}
860811
private static synchronized void registerListener() {

        if (!m_listenerRegistered) {
            OpenCms.getEventManager().addCmsEventListener(
                new CmsIconUtil(),
                new int[] {I_CmsEventListener.EVENT_CLEAR_CACHES});
            m_listenerRegistered = true;
        }
    }
228858
void register(Object listener) {
    Multimap<Class<?>, Subscriber> listenerMethods = findAllSubscribers(listener);

    for (Map.Entry<Class<?>, Collection<Subscriber>> entry : listenerMethods.asMap().entrySet()) {
      Class<?> eventType = entry.getKey();
      Collection<Subscriber> eventMethodsInListener = entry.getValue();

      CopyOnWriteArraySet<Subscriber> eventSubscribers = subscribers.get(eventType);

      if (eventSubscribers == null) {
        CopyOnWriteArraySet<Subscriber> newSet = new CopyOnWriteArraySet<Subscriber>();
        eventSubscribers =
            MoreObjects.firstNonNull(subscribers.putIfAbsent(eventType, newSet), newSet);
      }

      eventSubscribers.addAll(eventMethodsInListener);
    }
  }
553779
public void registerInstanceListener(Object instanceListener) {
        for (Method method : instanceListener.getClass().getMethods()) {
            evaluateMethod(instanceListener, PostCreate.class, method, postCreateMethods);
            evaluateMethod(instanceListener, PreUpdate.class, method, preUpdateMethods);
            evaluateMethod(instanceListener, PostUpdate.class, method, postUpdateMethods);
            evaluateMethod(instanceListener, PreDelete.class, method, preDeleteMethods);
            evaluateMethod(instanceListener, PostDelete.class, method, postDeleteMethods);
            evaluateMethod(instanceListener, PostLoad.class, method, postLoadMethods);
        }
    }
1333500
private void registerListeners() {
    protocol.registerAppendHandler(this::append);
    protocol.registerBackupHandler(this::backup);
    protocol.registerConsumeHandler(this::consume);
    protocol.registerResetConsumer(this::reset, threadContext);
  }
1129346
public void registerListener(RetryListener listener) {
		List<RetryListener> list = new ArrayList<RetryListener>(
				Arrays.asList(this.listeners));
		list.add(listener);
		this.listeners = list.toArray(new RetryListener[list.size()]);
	}
10759
public static <T extends Event> HandlerRegistration bind(EventTarget target, EventType<T, ?> type,
            EventCallbackFn<T> listener) {
        return bind(target, type.name, e -> listener.onEvent(Js.cast(e)));
    }
467222
public void addlistener(final ChangeListener listener) {
        synchronized (LISTENER_LOCK) {
            if (listeners.contains(listener)) {
                LOGGER.warn("Skip listener registration. listener[" + listener + "] is already registered!");
                return;
            }
            listeners.add(listener);
        }
    }
227620
def register(listener):
    
    if not isinstance(listener, _EventListener):
        raise TypeError("Listeners for %s must be either a "
                        "CommandListener, ServerHeartbeatListener, "
                        "ServerListener, or TopologyListener." % (listener,))
    if isinstance(listener, CommandListener):
        _LISTENERS.command_listeners.append(listener)
    if isinstance(listener, ServerHeartbeatListener):
        _LISTENERS.server_heartbeat_listeners.append(listener)
    if isinstance(listener, ServerListener):
        _LISTENERS.server_listeners.append(listener)
    if isinstance(listener, TopologyListener):
        _LISTENERS.topology_listeners.append(listener)
155435
private void registerSessionListener() {
        ISessionLifecycle sessionTracker = new ISessionLifecycle() {
            
            @Override
            public void onSessionCreate(Session session) {
                try {
                    AppContextFinder.createAppContext(session.getPage());
                } catch (Exception e) {
                    throw new SessionInitException(e);
                }
            }
            
            @Override
            public void onSessionDestroy(Session session) {
                AppContextFinder.destroyAppContext(session.getPage());
            }
            
        };

        Sessions.getInstance().addLifecycleListener(sessionTracker);
    }
174964
protected void addListeners() {
    // Listen for result changes, including the one we monitor
    context.addResultListener(this);
    context.addVisualizationListener(this);
    // Listen for database events only when needed.
    if(task.has(UpdateFlag.ON_DATA)) {
      context.addDataStoreListener(this);
    }
  }
472586
function registerListener(context, listener, ...arg) {
    if (context.set) {
        for (let i = 0; i < arg.length; i++) {
            if (isFunction(arg[i])) {
                listener.push(arg[i]);
            }
        }
    }
    return context;
}
248052
protected void notifyListener(final ExecutorService executor,
    final Future<?> future, final GenericCompletionListener listener) {
    executor.submit(new Runnable() {
      @Override
      public void run() {
        try {
          listener.onComplete(future);
        } catch(Throwable t) {
          getLogger().warn(
            "Exception thrown wile executing " + listener.getClass().getName()
              + ".operationComplete()", t);
        }
      }
    });
  }
1203684
public S onFailure(CheckedConsumer<? extends ExecutionCompletedEvent<R>> listener) {
    failureListener = EventListener.of(Assert.notNull(listener, "listener"));
    return (S) this;
  }
786996
protected function registerListeners()
    {
        $this->process->getDispatcher()->addListener(LogEvent::EVENT_NAME, function (LogEvent $event) {
            $this->data = $event->toArray();
            $this->stream();
        });
    }
6975
public void registerListener(ResponseListener listener) {
		if (! listeners.contains(listener)) {
			boolean unique = true;
			
			for (ResponseListener existing : listeners) {
				if (existing.getClass().equals(listener.getClass())) {
					unique = false;
					break;
				}
			}
			
			if (unique) {
				listeners.add(listener);
			}
		}
	}
1179967
@Override
  public FailsafeExecutor<R> onFailure(CheckedConsumer<? extends ExecutionCompletedEvent<R>> listener) {
    return super.onFailure(listener);
  }