private void saveBuckets ( ) { if ( lastModifiedOn > lastSavedOn ) { System . out . println ( "Persisting current rates to: " + savedRates ) ; //$NON-NLS-1$ Properties props = new Properties ( ) ; for ( Entry < String , RateLimiterBucket > entry : buckets . entrySet ( ) ) { String value = entry . getValue ( ) . getCount ( ) + "|" + entry . getValue ( ) . getLast ( ) ; //$NON-NLS-1$ props . setProperty ( entry . getKey ( ) , value ) ; } try ( FileWriter writer = new FileWriter ( savedRates ) ) { props . store ( writer , "All apiman rate limits" ) ; //$NON-NLS-1$ } catch ( IOException e ) { e . printStackTrace ( ) ; } lastSavedOn = System . currentTimeMillis ( ) ; } }
Saves the current list of buckets into a file .