`RecordManager.java`
`01 package trail.mdb; 02 03 import java.sql.Timestamp; 04 import java.util.ArrayList; 05 06 public class RecordManager { 07 08 private static ArrayList <CalculationRecord> crs = 09 new ArrayList <CalculationRecord> (); 10 // The manager holds 100 messages maximum 11 // This should work for low volume sites 12 private static int maxSize = 100; 13 14 public static void addRecord (Timestamp sent, double result) { 15 // Remove the earliest item if the cache is full 16 if (crs.size () > maxSize) { 17 crs.remove (0); 18 } 19 20 Timestamp processed = 21 new Timestamp (System.currentTimeMillis()); 22 crs.add(new CalculationRecord (sent, processed, result )); 23 } 24 25 // The sent timestamp acts as the ID of the message 26 // reasonable for low volume sites 27 public static CalculationRecord getRecord (long sent) { 28 for (int i = 0; i < crs.size (); i++) { 29 CalculationRecord cr = crs.get(i); 30 if (cr.sent.equals(new Timestamp(sent))) { 31 return cr; 32 } 33 } 34 return null; 35 } 36 37 }`