private void loadBuckets ( ) { Properties props = new Properties ( ) ; try ( FileReader reader = new FileReader ( savedRates ) ) { props . load ( reader ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } for ( Entry < Object , Object > entry : props . entrySet ( ) ) { String key = entry . getKey ( ) . toString ( ) ; String value = entry . getValue ( ) . toString ( ) ; String [ ] split = value . split ( "=" ) ; //$NON-NLS-1$ long count = new Long ( split [ 0 ] ) ; long last = new Long ( split [ 1 ] ) ; RateLimiterBucket bucket = new RateLimiterBucket ( ) ; bucket . setCount ( count ) ; bucket . setLast ( last ) ; this . buckets . put ( key , bucket ) ; } }
Loads the saved rates from a file . Done only on startup .