/** * Adds an interceptor to the stack for message processing<br> * Interceptors are ordered in the way they are added.<br> * <code>channel.addInterceptor(A);</code><br> * <code>channel.addInterceptor(C);</code><br> * <code>channel.addInterceptor(B);</code><br> * Will result in a interceptor stack like this:<br> * <code>A -> C -> B</code><br> * The complete stack will look like this:<br> * <code>Channel -> A -> C -> B -> ChannelCoordinator</code><br> * * @param interceptor ChannelInterceptorBase */ @Override public void addInterceptor(ChannelInterceptor interceptor) throws RemoteException, RemoteException { if (interceptors == null) { interceptors = interceptor; interceptors.setNext(coordinator); interceptors.setPrevious(null); coordinator.setPrevious(interceptors); } else { ChannelInterceptor last = interceptors; while (last.getNext() != coordinator) { last = last.getNext(); } last.setNext(interceptor); interceptor.setNext(coordinator); interceptor.setPrevious(last); coordinator.setPrevious(interceptor); } }