private List<Uid> convertToList(InputObjectState aa_uids) { List<Uid> uids = new ArrayList<Uid>(); boolean moreUids = true; while (moreUids) { Uid theUid = null; try { theUid = UidHelper.unpackFrom(aa_uids); if (theUid.equals(Uid.nullUid())) { moreUids = false; } else { Uid newUid = new Uid(theUid); if (tsLogger.logger.isDebugEnabled()) { tsLogger.logger.debug("found transaction " + newUid); } uids.add(newUid); } } catch (IOException ex) { moreUids = false; } } return uids; }
private int getUidsCountInStore() throws Exception { final InputObjectState uids = new InputObjectState(); recoveryStore.allObjUids(ATOMIC_ACTION_TYPE, uids); int counter = 0; for (Uid uid = UidHelper.unpackFrom(uids); !uid.equals(Uid.nullUid()); uid = UidHelper.unpackFrom(uids)) { counter++; } return counter; }
/** * Read the object's committed state. * * @param uid The object to work on. * @param typeName The type of the object to work on. * @return the state of the object. * @throws ObjectStoreException if things go wrong. */ public InputObjectState read_committed(Uid uid, String typeName) throws ObjectStoreException { RecordInfo record = getContentForType(typeName).get(uid); if(record == null) { return null; } // this repeated unpacking is a little inefficient - subclass RecordInfo to hold unpacked form too? // not too much of an issue as log reads are done for recovery only. try { InputBuffer inputBuffer = new InputBuffer(record.data); Uid unpackedUid = UidHelper.unpackFrom(inputBuffer); String unpackedTypeName = inputBuffer.unpackString(); InputObjectState inputObjectState = new InputObjectState(uid, typeName, inputBuffer.unpackBytes()); return inputObjectState; } catch(Exception e) { throw new ObjectStoreException(e); } }
private static Set<Uid> getUids(Set<Uid> uids, 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())) { uids.add(uid); } else { finished = true; } } while (!finished); } } catch (Exception e) { e.printStackTrace(); } return uids; }
private List<Uid> convertToList(InputObjectState aa_uids) { List<Uid> uids = new ArrayList<Uid>(); boolean moreUids = true; while (moreUids) { Uid theUid = null; try { theUid = UidHelper.unpackFrom(aa_uids); if (theUid.equals(Uid.nullUid())) { moreUids = false; } else { Uid newUid = new Uid(theUid); if (tsLogger.logger.isDebugEnabled()) { tsLogger.logger.debug("found transaction " + newUid); } uids.add(newUid); } } catch (IOException ex) { moreUids = false; } } return uids; }
/** * Read the object's committed state. * * @param uid The object to work on. * @param typeName The type of the object to work on. * @return the state of the object. * @throws ObjectStoreException if things go wrong. */ public InputObjectState read_committed(Uid uid, String typeName) throws ObjectStoreException { RecordInfo record = getContentForType(typeName).get(uid); if(record == null) { return null; } // this repeated unpacking is a little inefficient - subclass RecordInfo to hold unpacked form too? // not too much of an issue as log reads are done for recovery only. try { InputBuffer inputBuffer = new InputBuffer(record.data); Uid unpackedUid = UidHelper.unpackFrom(inputBuffer); String unpackedTypeName = inputBuffer.unpackString(); InputObjectState inputObjectState = new InputObjectState(uid, typeName, inputBuffer.unpackBytes()); return inputObjectState; } catch(Exception e) { throw new ObjectStoreException(e); } }
throws ObjectStoreException InputObjectState ios = new InputObjectState(); Uid tempUid = new Uid(Uid.nullUid()); tempUid = UidHelper.unpackFrom(ios); if (tempUid.equals(objUid)) return ObjectStore.OS_COMMITTED; } while (tempUid.notEquals(Uid.nullUid()));
private List<Uid> convertToList(InputObjectState aa_uids) { List<Uid> uids = new ArrayList<Uid>(); boolean moreUids = true; while (moreUids) { Uid theUid = null; try { theUid = UidHelper.unpackFrom(aa_uids); if (theUid.equals(Uid.nullUid())) { moreUids = false; } else { Uid newUid = new Uid(theUid); if (tsLogger.logger.isDebugEnabled()) { tsLogger.logger.debug("found transaction " + newUid); } uids.add(newUid); } } catch (IOException ex) { moreUids = false; } } return uids; }
/** * Read the object's committed state. * * @param uid The object to work on. * @param typeName The type of the object to work on. * @return the state of the object. * @throws ObjectStoreException if things go wrong. */ public InputObjectState read_committed(Uid uid, String typeName) throws ObjectStoreException { RecordInfo record = getContentForType(typeName).get(uid); if(record == null) { return null; } // this repeated unpacking is a little inefficient - subclass RecordInfo to hold unpacked form too? // not too much of an issue as log reads are done for recovery only. try { InputBuffer inputBuffer = new InputBuffer(record.data); UidHelper.unpackFrom(inputBuffer); inputBuffer.unpackString(); return new InputObjectState(uid, typeName, inputBuffer.unpackBytes()); } catch(Exception e) { throw new ObjectStoreException(e); } }
throws ObjectStoreException InputObjectState ios = new InputObjectState(); Uid tempUid = new Uid(Uid.nullUid()); tempUid = UidHelper.unpackFrom(ios); if (tempUid.equals(objUid)) return StateStatus.OS_COMMITTED; } while (tempUid.notEquals(Uid.nullUid()));
private List<Uid> convertToList(InputObjectState aa_uids) { List<Uid> uids = new ArrayList<Uid>(); boolean moreUids = true; while (moreUids) { Uid theUid = null; try { theUid = UidHelper.unpackFrom(aa_uids); if (theUid.equals(Uid.nullUid())) { moreUids = false; } else { Uid newUid = new Uid(theUid); if (tsLogger.logger.isDebugEnabled()) { tsLogger.logger.debug("found transaction " + newUid); } uids.add(newUid); } } catch (IOException ex) { moreUids = false; } } return uids; }
/** * Read the object's committed state. * * @param uid The object to work on. * @param typeName The type of the object to work on. * @return the state of the object. * @throws ObjectStoreException if things go wrong. */ public InputObjectState read_committed(Uid uid, String typeName) throws ObjectStoreException { RecordInfo record = getContentForType(typeName).get(uid); if(record == null) { return null; } // this repeated unpacking is a little inefficient - subclass RecordInfo to hold unpacked form too? // not too much of an issue as log reads are done for recovery only. try { InputBuffer inputBuffer = new InputBuffer(record.data); UidHelper.unpackFrom(inputBuffer); inputBuffer.unpackString(); return new InputObjectState(uid, typeName, inputBuffer.unpackBytes()); } catch(Exception e) { throw new ObjectStoreException(e); } }
throws ObjectStoreException InputObjectState ios = new InputObjectState(); Uid tempUid = new Uid(Uid.nullUid()); tempUid = UidHelper.unpackFrom(ios); if (tempUid.equals(objUid)) return StateStatus.OS_COMMITTED; } while (tempUid.notEquals(Uid.nullUid()));
private List<Uid> convertToList(InputObjectState aa_uids) { List<Uid> uids = new ArrayList<Uid>(); boolean moreUids = true; while (moreUids) { Uid theUid = null; try { theUid = UidHelper.unpackFrom(aa_uids); if (theUid.equals(Uid.nullUid())) { moreUids = false; } else { Uid newUid = new Uid(theUid); if (tsLogger.logger.isDebugEnabled()) { tsLogger.logger.debug("found transaction " + newUid); } uids.add(newUid); } } catch (IOException ex) { moreUids = false; } } return uids; }
/** * Read the object's committed state. * * @param uid The object to work on. * @param typeName The type of the object to work on. * @return the state of the object. * @throws ObjectStoreException if things go wrong. */ public InputObjectState read_committed(Uid uid, String typeName) throws ObjectStoreException { RecordInfo record = getContentForType(typeName).get(uid); if(record == null) { return null; } // this repeated unpacking is a little inefficient - subclass RecordInfo to hold unpacked form too? // not too much of an issue as log reads are done for recovery only. try { InputBuffer inputBuffer = new InputBuffer(record.data); UidHelper.unpackFrom(inputBuffer); inputBuffer.unpackString(); return new InputObjectState(uid, typeName, inputBuffer.unpackBytes()); } catch(Exception e) { throw new ObjectStoreException(e); } }
throws ObjectStoreException InputObjectState ios = new InputObjectState(); Uid tempUid = new Uid(Uid.nullUid()); tempUid = UidHelper.unpackFrom(ios); if (tempUid.equals(objUid)) return StateStatus.OS_COMMITTED; } while (tempUid.notEquals(Uid.nullUid()));
private Vector processTransactions( InputObjectState uids ) { Vector uidVector = new Vector() ; if (RecoveryLogger.logger.isDebugEnabled()) { RecoveryLogger.logger.debug("processing " + _transactionType + " transactions"); } final Uid NULL_UID = Uid.nullUid(); Uid theUid = null; while (true) { try { theUid = UidHelper.unpackFrom( uids ) ; } catch ( Exception ex ) { break; } if (theUid.equals(NULL_UID )) { break; } if (RecoveryLogger.logger.isDebugEnabled()) { RecoveryLogger.logger.debug("found transaction " + theUid); } uidVector.addElement( theUid ) ; } return uidVector ; }
throws ObjectStoreException InputObjectState ios = new InputObjectState(); Uid tempUid = new Uid(Uid.nullUid()); tempUid = UidHelper.unpackFrom(ios); if (tempUid.equals(objUid)) return StateStatus.OS_COMMITTED; } while (tempUid.notEquals(Uid.nullUid()));
private Vector processTransactions( InputObjectState uids ) { Vector uidVector = new Vector() ; if (RecoveryLogger.logger.isDebugEnabled()) { RecoveryLogger.logger.debug("processing " + _transactionType + " transactions"); } final Uid NULL_UID = Uid.nullUid(); Uid theUid = null; while (true) { try { theUid = UidHelper.unpackFrom( uids ) ; } catch ( Exception ex ) { break; } if (theUid.equals(NULL_UID )) { break; } if (RecoveryLogger.logger.isDebugEnabled()) { RecoveryLogger.logger.debug("found transaction " + theUid); } uidVector.addElement( theUid ) ; } return uidVector ; }
private void clearObjectStore() throws Exception { final InputObjectState uids = new InputObjectState(); recoveryStore.allObjUids(ATOMIC_ACTION_TYPE, uids); for (Uid uid = UidHelper.unpackFrom(uids); !uid.equals(Uid.nullUid()); uid = UidHelper.unpackFrom(uids)) { recoveryStore.remove_committed(uid, ATOMIC_ACTION_TYPE); } }