INT-1054: Fix bug in SimpleMesssageStore; INT-1112: Tweak method names in MessageGroupStore
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
|
||||
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
|
||||
<classpathentry kind="src" output="target/classes" path="src/main/resources"/>
|
||||
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
#Wed Apr 28 07:56:59 BST 2010
|
||||
#Tue May 04 06:48:00 BST 2010
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.5
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
|
||||
|
||||
@@ -249,12 +249,12 @@ public class CorrelatingMessageHandler extends AbstractMessageHandler implements
|
||||
}
|
||||
|
||||
private void mark(MessageGroup group) {
|
||||
store.mark(group);
|
||||
store.markMessageGroup(group);
|
||||
}
|
||||
|
||||
private void remove(MessageGroup group) {
|
||||
Object correlationKey = group.getCorrelationKey();
|
||||
store.deleteMessageGroup(correlationKey);
|
||||
store.removeMessageGroup(correlationKey);
|
||||
locks.remove(correlationKey);
|
||||
}
|
||||
|
||||
|
||||
@@ -34,19 +34,17 @@ public interface MessageGroupStore {
|
||||
* {@link #addMessageToGroup(Object, Collection)} with this correlation id.
|
||||
*
|
||||
* @return a group of messages, empty if none exists for this key
|
||||
*
|
||||
* @see org.springframework.integration.core.MessageHeaders#getCorrelationId()
|
||||
*/
|
||||
MessageGroup getMessageGroup(Object correlationId);
|
||||
MessageGroup getMessageGroup(Object correlationKey);
|
||||
|
||||
/**
|
||||
* Store a message with an association to a correlation id. This can be used to group messages together instead of
|
||||
* Store a message with an association to a correlation key. This can be used to group messages together instead of
|
||||
* storing them just under their id.
|
||||
*
|
||||
* @param correlationId the correlation id to store the message under
|
||||
* @param correlationKey the correlation id to store the message under
|
||||
* @param message a message
|
||||
*/
|
||||
void addMessageToGroup(Object correlationId, Message<?> message);
|
||||
void addMessageToGroup(Object correlationKey, Message<?> message);
|
||||
|
||||
/**
|
||||
* Persist the mark on all the messages from the group. The group is modified in the process as all its unmarked
|
||||
@@ -54,13 +52,13 @@ public interface MessageGroupStore {
|
||||
*
|
||||
* @param group a MessageGroup with no unmarked messages
|
||||
*/
|
||||
void mark(MessageGroup group);
|
||||
void markMessageGroup(MessageGroup group);
|
||||
|
||||
/**
|
||||
* Delete all the messages from the association with this correlation id.
|
||||
* Remove the message group with this correlation key.
|
||||
*
|
||||
* @param correlationId the correlation id to remove
|
||||
* @param correlationKey the correlation id to remove
|
||||
*/
|
||||
void deleteMessageGroup(Object correlationId);
|
||||
void removeMessageGroup(Object correlationKey);
|
||||
|
||||
}
|
||||
@@ -60,17 +60,13 @@ public class SimpleMessageStore implements MessageStore, MessageGroupStore {
|
||||
this(0);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public <T> Message<T> addMessage(Message<T> message) {
|
||||
if (!upperBound.tryAcquire(0)) {
|
||||
throw new MessagingException(this.getClass().getSimpleName()
|
||||
+ " was out of capacity at, try constructing it with a larger capacity.");
|
||||
}
|
||||
Object correlationId = message.getHeaders().getCorrelationId();
|
||||
if (correlationId != null) {
|
||||
getMessageGroupInternal(correlationId).add(message);
|
||||
}
|
||||
return (Message<T>) this.idToMessage.put(message.getHeaders().getId(), message);
|
||||
this.idToMessage.put(message.getHeaders().getId(), message);
|
||||
return message;
|
||||
}
|
||||
|
||||
public Message<?> getMessage(UUID key) {
|
||||
@@ -86,10 +82,6 @@ public class SimpleMessageStore implements MessageStore, MessageGroupStore {
|
||||
return null;
|
||||
}
|
||||
|
||||
public int size() {
|
||||
return this.idToMessage.size();
|
||||
}
|
||||
|
||||
public MessageGroup getMessageGroup(Object correlationId) {
|
||||
Assert.notNull(correlationId, "'correlationKey' must not be null");
|
||||
MessageGroup collection = correlationToMessageGroup.get(correlationId);
|
||||
@@ -103,14 +95,14 @@ public class SimpleMessageStore implements MessageStore, MessageGroupStore {
|
||||
getMessageGroupInternal(correlationId).add(message);
|
||||
}
|
||||
|
||||
public void mark(MessageGroup group) {
|
||||
public void markMessageGroup(MessageGroup group) {
|
||||
Object correlationId = group.getCorrelationKey();
|
||||
MessageGroup internal = getMessageGroupInternal(correlationId);
|
||||
internal.mark();
|
||||
group.mark();
|
||||
}
|
||||
|
||||
public void deleteMessageGroup(Object correlationId) {
|
||||
public void removeMessageGroup(Object correlationId) {
|
||||
correlationToMessageGroup.remove(correlationId);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user