void refresh ( ) { // Request latest expressions from the server try { HttpResponse res = client . get ( uri ) . withConnectTimeout ( connectTimeout ) . withReadTimeout ( readTimeout ) . addHeader ( "If-None-Match" , etag ) . send ( ) . decompress ( ) ; if ( res . status ( ) == 304 ) { LOGGER . debug ( "no modification to subscriptions" ) ; } else if ( res . status ( ) != 200 ) { LOGGER . warn ( "failed to update subscriptions, received status {}" , res . status ( ) ) ; } else { etag = res . header ( "ETag" ) ; payload = filterByStep ( mapper . readValue ( res . entity ( ) , Subscriptions . class ) ) ; } } catch ( Exception e ) { LOGGER . warn ( "failed to update subscriptions (uri={})" , uri , e ) ; } // Update with the current payload, it will be null if there hasn't been a single // successful request if ( payload != null ) { long now = clock . wallTime ( ) ; payload . update ( subscriptions , now , now + configTTL ) ; } }
Refresh the subscriptions from the server .