modified implementation of MessageGroupQueue to use interruptible locks

Basically modeled it after LinkedBlockingQueue

changed to use ReadWriteLock

refactored MessageGroupQueue and added tests

changed MessageGroupQueue to use Condition

added messageGroupSize(groupId) method to MessageGroupStore and all the implementations

polishing based on Gary's comments

removed setStoreLock method in favor of additional constructors

polishing tests, decreased timeouts

made peek() thread safe

added logging
This commit is contained in:
Oleg Zhurakousky
2011-12-16 09:53:39 -05:00
committed by Mark Fisher
parent d1367e06d2
commit 86c574e493
12 changed files with 580 additions and 125 deletions

View File

@@ -16,8 +16,6 @@
package org.springframework.integration.store;
import static org.junit.Assert.assertEquals;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
@@ -25,10 +23,13 @@ import java.util.Iterator;
import java.util.List;
import org.junit.Test;
import org.springframework.integration.Message;
import org.springframework.integration.message.GenericMessage;
import org.springframework.test.util.ReflectionTestUtils;
import static org.junit.Assert.assertEquals;
/**
* @author Dave Syer
*/
@@ -94,18 +95,10 @@ public class MessageStoreTests {
return removed ? new SimpleMessageGroup(correlationKey) : testMessages;
}
public MessageGroup markMessageGroup(MessageGroup group) {
throw new UnsupportedOperationException();
}
public MessageGroup removeMessageFromGroup(Object key, Message<?> messageToRemove) {
throw new UnsupportedOperationException();
}
public MessageGroup markMessageFromGroup(Object key, Message<?> messageToMark) {
throw new UnsupportedOperationException();
}
public void removeMessageGroup(Object correlationKey) {
if (correlationKey.equals(testMessages.getGroupId())) {
removed = true;
@@ -122,10 +115,13 @@ public class MessageStoreTests {
}
public Message<?> pollMessageFromGroup(Object groupId) {
// TODO Auto-generated method stub
return null;
}
public int messageGroupSize(Object groupId) {
return 0;
}
}
}