class SimpleStanzaHandlerInterceptorChain implements StanzaHandlerInterceptorChain {

    @Override
    public void intercept(Stanza stanza, ServerRuntimeContext serverRuntimeContext, boolean isOutboundStanza,
            SessionContext sessionContext, SessionStateHolder sessionStateHolder, StanzaBroker stanzaBroker)
            throws ProtocolException {
        StanzaHandlerInterceptor interceptor = interceptors.poll();
        if (interceptor == null) {
            LOG.debug("No more interceptor to execute. Executing stanza handler {}.", stanzaHandler);
            stanzaHandler.execute(stanza, serverRuntimeContext, isOutboundStanza, sessionContext, sessionStateHolder,
                    stanzaBroker);
            return;
        }
        LOG.debug("Executing interceptor {}", interceptor);
        interceptor.intercept(stanza, serverRuntimeContext, isOutboundStanza, sessionContext, sessionStateHolder,
                stanzaBroker, this);
    }

    public  SimpleStanzaHandlerInterceptorChain(StanzaHandler stanzaHandler,
            List<StanzaHandlerInterceptor> interceptors);

}