1 package au.gov.amsa.geo.distance; 2 3 import java.io.File; 4 import java.io.IOException; 5 6 import org.mapdb.DB; 7 import org.mapdb.DBMaker; 8 9 public enum MapDb { 10 11 INSTANCE; 12 13 private DB db; 14 15 private MapDb() { 16 try { 17 File file = File.createTempFile("geo-analyzer", ".db"); 18 db = DBMaker.newFileDB(file).asyncWriteEnable().cacheSize(100000) 19 .closeOnJvmShutdown().transactionDisable().make(); 20 } catch (IOException e) { 21 throw new RuntimeException(e); 22 } 23 } 24 25 public DB getDb() { 26 return db; 27 } 28 29 }