#include "ArbitrationRound.h"
#include "Commit.h"
+#include "CommitPart.h"
ArbitrationRound::ArbitrationRound(Commit *_commit, Hashset<Abort *> *_abortsBefore) :
abortsBefore(_abortsBefore),
ArbitrationRound::~ArbitrationRound() {
delete abortsBefore;
+ uint partsSize = parts->size();
+ for (uint i = 0; i < partsSize; i++) {
+ Entry * part = parts->get(i);
+ part->releaseRef();
+ }
delete parts;
if (commit != NULL)
delete commit;
if (didGenerateParts) {
return;
}
+ uint partsSize = parts->size();
+ for (uint i = 0; i < partsSize; i++) {
+ Entry * part = parts->get(i);
+ part->releaseRef();
+ }
parts->clear();
SetIterator<Abort *, Abort *> *abit = abortsBefore->iterator();
while (abit->hasNext())
Vector<CommitPart *> *cParts = commit->getParts();
uint cPartsSize = cParts->size();
for (uint i = 0; i < cPartsSize; i++) {
- parts->add((Entry *)cParts->get(i));
+ CommitPart * part = cParts->get(i);
+ part->acquireRef();
+ parts->add((Entry *)part);
}
}
}
}
void ArbitrationRound::removeParts(Vector<Entry *> *removeParts) {
- parts->removeAll(removeParts);
+ uint size = removeParts->size();
+ for(uint i=0; i < size; i++) {
+ Entry * e = removeParts->get(i);
+ if (parts->remove(e))
+ e->releaseRef();
+ }
didSendPart = true;
}