class RpcStopApplicationListener implements ApplicationListener, ApplicationContextAware {

    private final ProviderConfigContainer providerConfigContainer;

    private final ServerConfigContainer   serverConfigContainer;

    private ApplicationContext            applicationContext;

    public RpcStopApplicationListener(ProviderConfigContainer providerConfigContainer,
                                      ServerConfigContainer serverConfigContainer) {
        this.providerConfigContainer = providerConfigContainer;
        this.serverConfigContainer = serverConfigContainer;
    }

    @Override
    public void onApplicationEvent(ApplicationEvent event) {<FILL_FUNCTION_BODY>}

    @Override
    public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        this.applicationContext = applicationContext;
    }
}

        if ((event instanceof ContextClosedEvent) || (event instanceof ContextStoppedEvent)) {
            if (applicationContext
                .equals(((ApplicationContextEvent) event).getApplicationContext())) {
                providerConfigContainer.unExportAllProviderConfig();
                serverConfigContainer.closeAllServer();
            }
        }
    
<no_super_class>