private void init() { String s = settings.get(LAST_TRANSACTION_ID); if (s != null) { lastTransactionId = Long.parseLong(s); lastTransactionIdStored = lastTransactionId; } Long lastKey = openTransactions.lastKey(); if (lastKey != null && lastKey.longValue() > lastTransactionId) { throw DataUtils.newIllegalStateException("Last transaction not stored"); } Cursor<Long> cursor = openTransactions.keyIterator(null); while (cursor.hasNext()) { long id = cursor.next(); Object[] data = openTransactions.get(id); int status = (Integer) data[0]; String name = (String) data[1]; long[] next = {id + 1, -1}; long[] last = undoLog.floorKey(next); if (last == null) { // no entry } else if (last[0] == id) { Transaction t = new Transaction(this, id, status, name, last[1]); t.setStored(true); openTransactionMap.put(id, t); } } }