Adds a DisconnectInterceptor to receive callbacks during the disconnection process.
Useful for programmatic configuration.
@param interceptor the connect interceptor to add
422679
public void addDisconnectInterceptor(DisconnectInterceptor<?> interceptor) {
		Class<?> serviceApiType = GenericTypeResolver.resolveTypeArgument(interceptor.getClass(), DisconnectInterceptor.class);
		disconnectInterceptors.add(serviceApiType, interceptor);
	}
193232
private List<HandlerInterceptor> adaptInterceptors(List<Object> interceptors, ApplicationContext context) {
        List<HandlerInterceptor> handlerInterceptors = new ArrayList<HandlerInterceptor>();

        if (context.containsBean(LOGGING_INTERCEPTOR_BEAN_NAME)) {
            LoggingHandlerInterceptor loggingInterceptor = context.getBean(LOGGING_INTERCEPTOR_BEAN_NAME, LoggingHandlerInterceptor.class);
            handlerInterceptors.add(loggingInterceptor);
        }

        if (interceptors != null) {
            for (Object interceptor : interceptors) {
                if (interceptor instanceof MappedInterceptor) {
                    handlerInterceptors.add(new MappedInterceptorAdapter((MappedInterceptor)interceptor,
                            new UrlPathHelper(), new AntPathMatcher()));
                } else if (interceptor instanceof HandlerInterceptor) {
                    handlerInterceptors.add((HandlerInterceptor) interceptor);
                } else if (interceptor instanceof WebRequestInterceptor) {
                    handlerInterceptors.add(new WebRequestHandlerInterceptorAdapter((WebRequestInterceptor) interceptor));
                } else {
                    log.warn("Unsupported interceptor type: {}", interceptor.getClass().getName());
                }
            }
        }

        return handlerInterceptors;
    }
546504
public Interceptors addGlobalServiceInterceptor(Interceptor globalServiceInterceptor) {
		if (globalServiceInterceptor == null) {
			throw new IllegalArgumentException("globalServiceInterceptor can not be null.");
		}
		InterceptorManager.me().addGlobalServiceInterceptor(globalServiceInterceptor);
		return this;
	}
601356
@Override
    public void addConnectionEventListener( ConnectionEventListener listener ) {
        if (listener == null) {
            throw new IllegalArgumentException("Listener is null");
        }
        listeners.add(listener);
    }
1355843
@Override
    final public void removeConnectionEventListener(
                                                    final ConnectionEventListener listener) {

        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
            SibTr.entry(this, TRACE, "removeConnectionEventListener", listener);
        }

        synchronized (_connectionListeners) {
            _connectionListeners.remove(listener);
        }

        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
            SibTr.exit(this, TRACE, "removeConnectionEventListener");
        }

    }
1003857
public final S withInterceptors(ClientInterceptor... interceptors) {
    return build(ClientInterceptors.intercept(channel, interceptors), callOptions);
  }
267860
static <WReqT, WRespT> ClientInterceptor wrapClientInterceptor(
      final ClientInterceptor interceptor,
      final Marshaller<WReqT> reqMarshaller,
      final Marshaller<WRespT> respMarshaller) {
    return new ClientInterceptor() {
      @Override
      public <ReqT, RespT> ClientCall<ReqT, RespT> interceptCall(
          final MethodDescriptor<ReqT, RespT> method, CallOptions callOptions, Channel next) {
        final MethodDescriptor<WReqT, WRespT> wrappedMethod =
            method.toBuilder(reqMarshaller, respMarshaller).build();
        final ClientCall<WReqT, WRespT> wrappedCall =
            interceptor.interceptCall(wrappedMethod, callOptions, next);
        return new PartialForwardingClientCall<ReqT, RespT>() {
          @Override
          public void start(final Listener<RespT> responseListener, Metadata headers) {
            wrappedCall.start(new PartialForwardingClientCallListener<WRespT>() {
              @Override
              public void onMessage(WRespT wMessage) {
                InputStream bytes = respMarshaller.stream(wMessage);
                RespT message = method.getResponseMarshaller().parse(bytes);
                responseListener.onMessage(message);
              }

              @Override
              protected Listener<?> delegate() {
                return responseListener;
              }
            }, headers);
          }

          @Override
          public void sendMessage(ReqT message) {
            InputStream bytes = method.getRequestMarshaller().stream(message);
            WReqT wReq = reqMarshaller.parse(bytes);
            wrappedCall.sendMessage(wReq);
          }

          @Override
          protected ClientCall<?, ?> delegate() {
            return wrappedCall;
          }
        };
      }
    };
  }
363836
protected void applyInterceptors(ServiceContext<?> context, InterceptorProvider client, String serviceName) {

    client.getOutInterceptors().add(new PerformanceStartInterceptor());
    client.getInInterceptors().add(new PerformanceStopInterceptor());
    client.getInFaultInterceptors().add(new TechnicalExceptionInterceptor(serviceName));
  }
1242277
public function addInterceptors(array $interceptors)
    {
        foreach ($interceptors as $interceptor) {
            if ($interceptor instanceof HandlerInterceptor) {
                array_push($this->interceptors, $interceptor);
            }
        }
    }
1104578
public void addConnectionEventListener(ConnectionEventListener listener) {
    log.finest("addConnectionEventListener()");
    if (listener == null)
      throw new IllegalArgumentException("Listener is null");
    listeners.add(listener);
  }
1098467
public static Interceptor[] build(Intercept annotation) {
		if (annotation == null) {
			return null;
		}

		Class<? extends Interceptor>[] interceptorClasses = annotation.value();
		int count = interceptorClasses.length;
		if (count == 0) {
			return null;
		}

		final List<Interceptor> interceptorList = new ArrayList<>(interceptorClasses.length);
		for (int i = 0; i < count; i++) {
			Interceptor interceptor = pool.get(interceptorClasses[i]);
			if (interceptor == null) {
				try {
					interceptor = interceptorClasses[i].newInstance();
					log.debug("New Interceptor: [{}]", interceptor.getClass().getName());
					pool.put(interceptorClasses[i], interceptor);
				} catch (Exception e) {
					log.error(e, "Init interceptor error!");
					continue;
				}
			}
			if(null != interceptor){
				interceptorList.add(interceptor);
			}
		}
		return interceptorList.toArray(new Interceptor[interceptorList.size()]);
	}
848272
protected void configureHandlerInterceptor(ApplicationContext context) {
        if (context.containsBean(HANDLER_INTERCEPTOR_BEAN_NAME)) {
            DelegatingHandlerInterceptor handlerInterceptor = context.getBean(HANDLER_INTERCEPTOR_BEAN_NAME, DelegatingHandlerInterceptor.class);
            handlerInterceptor.setInterceptors(adaptInterceptors(httpServer.getInterceptors(), context));
        }
    }
213154
private void addDefaultInterceptors()
                    throws EJBConfigurationException
    {
        final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
        if (isTraceOn && tc.isEntryEnabled())
        {
            Tr.entry(tc, "addDefaultInterceptorNames");
        }

        // Get list of default interceptor names from interceptor-binding for EJB name *.
        List<String> names = new LinkedList<String>();
        if (ivModuleInterceptorBinding != null)
        {
            if (!ivModuleInterceptorBinding.ivInterceptorClassNames.isEmpty()) // d453477
            {
                names = ivModuleInterceptorBinding.ivInterceptorClassNames;
            }
            else if (!ivModuleInterceptorBinding.ivInterceptorOrder.isEmpty()) // d453477
            {
                // interceptor-order and interceptor-classes are mutually exclusive
                // in xml schema.  So only 1 will occur, not both.
                names = ivModuleInterceptorBinding.ivInterceptorOrder;
            }
        }

        // Process any default interceptor names found for the module this bean is in.
        if (names.size() > 0)
        {
            updateNamesToClassMap(names); // d630717

            // Remember list of default interceptor names.
            ivDefaultInterceptorNames.addAll(names);
        }

        if (isTraceOn && tc.isEntryEnabled())
        {
            Tr.exit(tc, "addDefaultInterceptorNames: " + ivDefaultInterceptorNames);
        }
    }
9438
@Override
    public void removeConnectionEventListener( ConnectionEventListener listener ) {
        if (listener == null) {
            throw new IllegalArgumentException("Listener is null");
        }
        listeners.remove(listener);
    }
1158916
public void executeAround(Object interceptor, Method method) {
		if (method != null) {
			Object[] params = parametersResolver.parametersFor(method);
			stepInvoker.tryToInvoke(interceptor, method, params);
		} else {
			simpleInterceptorStack.get().next();
		}
	}
732631
static void addDetachObserver(HTMLElement element, ObserverCallback callback) {
        if (!ready) {
            startObserving();
        }
        detachObservers.add(createObserver(element, callback, DETACH_UID_KEY));
    }
925100
public static void addInterceptors(InterceptorProvider provider) {
        PhaseManager phases = BusFactory.getDefaultBus().getExtension(PhaseManager.class);
        for (Phase p : phases.getInPhases()) {
            provider.getInInterceptors().add(new DemoInterceptor(p.getName()));
            provider.getInFaultInterceptors().add(new DemoInterceptor(p.getName()));
        }
        for (Phase p : phases.getOutPhases()) {
            provider.getOutInterceptors().add(new DemoInterceptor(p.getName()));
            provider.getOutFaultInterceptors().add(new DemoInterceptor(p.getName()));
        }
    }