Implemented OfferWriter and RequestWriter, made all the writers

reusable (though not thread-safe), and guiced the readers.
This commit is contained in:
akwizgran
2011-07-26 21:36:55 +01:00
parent 426e415676
commit 9e78837055
23 changed files with 249 additions and 46 deletions

View File

@@ -676,11 +676,10 @@ class ReadWriteLockDatabaseComponent<Txn> extends DatabaseComponentImpl<Txn> {
try {
subscriptionLock.readLock().lock();
try {
BitSet request;
Collection<MessageId> offered = o.getMessages();
BitSet request = new BitSet(offered.size());
Txn txn = db.startTransaction();
try {
Collection<MessageId> offered = o.getMessages();
request = new BitSet(offered.size());
Iterator<MessageId> it = offered.iterator();
for(int i = 0; it.hasNext(); i++) {
// If the message is not in the database, or if
@@ -694,7 +693,7 @@ class ReadWriteLockDatabaseComponent<Txn> extends DatabaseComponentImpl<Txn> {
db.abortTransaction(txn);
throw e;
}
r.writeBitmap(request);
r.writeBitmap(request, offered.size());
} finally {
subscriptionLock.readLock().unlock();
}