Register lifecycle listener(s) with these token services.

@param lifecycleListeners The listeners.
180303
@Autowired ( required = false )
  public void register(OAuthTokenLifecycleListener... lifecycleListeners) {
    if (lifecycleListeners != null) {
      this.lifecycleListeners.addAll(Arrays.asList(lifecycleListeners));
    }
  }
983964
def add_listener(self, on_lifecycle_change):
        
        id = str(uuid.uuid4())
        self._listeners[id] = on_lifecycle_change
        return id
423232
private void notifyStart()
    {
        if (eventHandler instanceof LifecycleAware)
        {
            try
            {
                ((LifecycleAware) eventHandler).onStart();
            }
            catch (final Throwable ex)
            {
                exceptionHandler.handleOnStartException(ex);
            }
        }
    }
331217
private synchronized void initializeListeners()
    {
        if (this.listenersByName == null) {
            this.listenersByEvent = new ConcurrentHashMap<>();
            this.listenersByName = new ConcurrentHashMap<>();

            // Can be null in unit tests
            if (this.componentManager != null) {
                try {
                    for (EventListener listener : this.componentManager
                        .<EventListener>getInstanceList(EventListener.class)) {
                        addListener(listener);
                    }
                } catch (ComponentLookupException e) {
                    this.logger.error("Failed to lookup listeners", e);
                }
            }
        }
    }
1346315
public void addListener(LifecycleListener listener)
  {
    synchronized (this) {
      if (isDestroyed()) {
        IllegalStateException e = new IllegalStateException("attempted to add listener to a destroyed lifecyle " + this);

        if (_log != null)
          _log.log(Level.WARNING, e.toString(), e);
        else
          Logger.getLogger(Lifecycle.class.getName()).log(Level.WARNING, e.toString(), e);

        return;
      }

      if (_listeners == null)
        _listeners = new ArrayList<WeakReference<LifecycleListener>>();

      for (int i = _listeners.size() - 1; i >= 0; i--) {
        LifecycleListener oldListener = _listeners.get(i).get();

        if (listener == oldListener)
          return;
        else if (oldListener == null)
          _listeners.remove(i);
      }

      _listeners.add(new WeakReference<LifecycleListener>(listener));
    }
  }
48420
public static void registerActivityLifecycleCallbacks(Application application, ActivityLifecycleCallbacksCompat callback) {
        if (PRE_ICS) {
            preIcsRegisterActivityLifecycleCallbacks(callback);
        } else {
            postIcsRegisterActivityLifecycleCallbacks(application, callback);
        }
    }
566762
public void setListeners(Collection<RetryListener> globalListeners) {
		ArrayList<RetryListener> retryListeners = new ArrayList<RetryListener>(
				globalListeners);
		AnnotationAwareOrderComparator.sort(retryListeners);
		this.globalListeners = retryListeners.toArray(new RetryListener[0]);
	}
1338969
public function registerListeners(array $listeners)
    {
        foreach ($listeners as $event => $listener) {
            $this->events[$event][] = $listener;
        }
    }
1013160
public void registerListener(ConfigurationListener<?> listener) {
    if(!listeners.contains(listener)) {
      listeners.add(listener);
      Set<ConfigurationListener<?>> newListener = new HashSet<ConfigurationListener<?>>();
      newListener.add(listener);
      notifyListeners(newListener, liveConfigParser, log);
    }
  }
813456
public void start()
  {
    if (! getLifecycle().toStarting()) {
      startListeners();
      return;
    }
    
    //sendAddLoaderEvent();

    //bind();
    
    try {
      make();
    } catch (Exception e) {
      log().log(Level.WARNING, e.toString(), e);
      e.printStackTrace();
    }

    startListeners();

    getLifecycle().toActive();
    
    if (isAdminEnable()) {
      Thread thread = Thread.currentThread();
      ClassLoader loader = thread.getContextClassLoader();
      
      try {
        thread.setContextClassLoader(this);
      
        //_admin = new EnvironmentAdmin(this);
        //_admin.register();
      } finally {
        thread.setContextClassLoader(loader);
      }
    }
  }
547182
public static void setEventListener(final Activity activity,
                                        final KeyboardVisibilityEventListener listener) {

        final Unregistrar unregistrar = registerEventListener(activity, listener);
        activity.getApplication()
                .registerActivityLifecycleCallbacks(new AutoActivityLifecycleCallback(activity) {
                    @Override
                    protected void onTargetActivityDestroyed() {
                        unregistrar.unregister();
                    }
                });
    }
1152026
public void removeLifeCycleListener(EventListener listener) {
        if (listener != null) {
            if (listener instanceof javax.servlet.ServletContextListener) {
                // add to the context listener list
                servletContextListeners.remove(listener);
            }
            if (listener instanceof javax.servlet.ServletContextAttributeListener) {
                // add to the context attr listener list
                servletContextLAttrListeners.remove(listener);
            }

            if (listener instanceof javax.servlet.http.HttpSessionListener) {
                // session context currently has no way to remove
                // lifecycle listeners
            }
            
            // For Servlet 3.1 need to ensure we check to see if it is a HttpSessionIdListener
            if (isHttpSessionIdListener(listener)) {
                // session context currently has no way to remove lifecycle listener
            }

            // 2.4 Listeners
            if (listener instanceof javax.servlet.ServletRequestListener) {
                servletRequestListeners.remove(listener);
            }
            if (listener instanceof javax.servlet.ServletRequestAttributeListener) {
                servletRequestLAttrListeners.remove(listener);
            }
        }
    }
403877
protected function registerListeners()
    {
        Event::listen(RouteMatched::class, BlockLoad::class);
        Event::listen(GzeroRouteMatched::class, BlockLoad::class);
        Event::listen('block.*', BlockCacheClear::class);
    }
1089075
protected boolean register(IEventListener listener) {
        log.debug("register - listener: {}", listener);
        boolean registered = listeners.add(listener);
        if (registered) {
            listenerStats.increment();
            // prepare response for new client
            ownerMessage.addEvent(Type.CLIENT_INITIAL_DATA, null, null);
            if (!isPersistent()) {
                ownerMessage.addEvent(Type.CLIENT_CLEAR_DATA, null, null);
            }
            if (!attributes.isEmpty()) {
                ownerMessage.addEvent(new SharedObjectEvent(Type.CLIENT_UPDATE_DATA, null, getAttributes()));
            }
            // we call notifyModified here to send response if we're not in a beginUpdate block
            notifyModified();
        }
        return registered;
    }
1298398
@Override
    public void register(Object listener)
    {
        if (!(listener instanceof EventListener))
        {
            throw new IllegalArgumentException("Listener must implement EventListener");
        }
        listeners.add(((EventListener) listener));
    }
1301117
public void setLifecycleHooks(java.util.Collection<LifecycleHook> lifecycleHooks) {
        if (lifecycleHooks == null) {
            this.lifecycleHooks = null;
            return;
        }

        this.lifecycleHooks = new com.amazonaws.internal.SdkInternalList<LifecycleHook>(lifecycleHooks);
    }
24021
public void registerListener(IPluginEvent listener) {
        if (pluginEventListeners1 == null) {
            pluginEventListeners1 = new ArrayList<>();
        }

        if (!pluginEventListeners1.contains(listener)) {
            pluginEventListeners1.add(listener);
        }
    }