public void disconnectOnChange ( @ Observes final iOSVariantUpdateEvent iOSVariantUpdateEvent ) { final iOSVariant variant = iOSVariantUpdateEvent . getiOSVariant ( ) ; final String connectionKey = extractConnectionKey ( variant ) ; final ApnsClient client = apnsClientExpiringMap . remove ( connectionKey ) ; logger . debug ( "Removed client from cache for {}" , variant . getVariantID ( ) ) ; if ( client != null ) { tearDownApnsHttp2Connection ( client ) ; } }
Receives iOS variant change event to remove client from the cache and also tear down the connection .