/** @param args */ public static void main(String[] args) { // check that multiple instances share same storage: KeyValueBaseImpl k = new KeyValueBaseImpl(); KeyValueBaseImpl k2 = new KeyValueBaseImpl(); try { k.init("testinitdata"); System.out.println(" first read" + k2.read(new KeyImpl(24))); /** * TEST SCAN */ Predicate<ValueListImpl> p = new Predicate<ValueListImpl>() { @Override public boolean evaluate(ValueListImpl input) { // just returns all valuelistimpl return true; } }; System.out.println("Scanning memory"); List<ValueListImpl> scantest = k.scan(new KeyImpl(1), new KeyImpl(25), p); for (ValueListImpl vlist : scantest) { System.out.println(vlist); } System.out.println("test read (25): " + k.read(new KeyImpl(25))); // try another thread which will try to add a load of keys Thread writer = new Thread(inserter); Thread changer = new Thread(updater); System.out.println("Starting threads"); writer.start(); changer.start(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ServiceAlreadyInitializedException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ServiceInitializingException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (BeginGreaterThanEndException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (ServiceNotInitializedException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (KeyNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } }