protected static OSRecordHolder readObjectStoreRecord(String type) { try { RecoveryStore recoveryStore = StoreManager.getRecoveryStore(); InputObjectState states = new InputObjectState(); if (recoveryStore.allObjUids(type, states) && states.notempty()) { Uid uid = UidHelper.unpackFrom(states); if (uid.notEquals(Uid.nullUid())) { InputObjectState ios = recoveryStore.read_committed(uid, type); return new OSRecordHolder(uid, type, ios); } } } catch (Exception e) { e.printStackTrace(); } return null; }
private static void clearObjectStore(String type) { try { RecoveryStore recoveryStore = StoreManager.getRecoveryStore(); InputObjectState states = new InputObjectState(); if (recoveryStore.allObjUids(type, states) && states.notempty()) { boolean finished = false; do { Uid uid = UidHelper.unpackFrom(states); if (uid.notEquals(Uid.nullUid())) { recoveryStore.remove_committed(uid, type); } else { finished = true; } } while (!finished); } } catch (Exception e) { e.printStackTrace(); } }