You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ta...@apache.org on 2009/09/25 23:45:23 UTC
svn commit: r819035 -
/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompSubscription.java
Author: tabish
Date: Fri Sep 25 21:45:23 2009
New Revision: 819035
URL: http://svn.apache.org/viewvc?rev=819035&view=rev
Log:
Apply fix for: https://issues.apache.org/activemq/browse/AMQ-2426
Modified:
activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompSubscription.java
Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompSubscription.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompSubscription.java?rev=819035&r1=819034&r2=819035&view=diff
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompSubscription.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompSubscription.java Fri Sep 25 21:45:23 2009
@@ -35,7 +35,7 @@
/**
* Keeps track of the STOMP subscription so that acking is correctly done.
- *
+ *
* @author <a href="http://hiramchirino.com">chirino</a>
*/
public class StompSubscription {
@@ -54,7 +54,7 @@
private String ackMode = AUTO_ACK;
private ActiveMQDestination destination;
private String transformation;
-
+
public StompSubscription(ProtocolConverter stompTransport, String subscriptionId, ConsumerInfo consumerInfo, String transformation) {
this.protocolConverter = stompTransport;
@@ -79,7 +79,7 @@
}
boolean ignoreTransformation = false;
-
+
if (transformation != null) {
message.setReadOnlyProperties(false);
message.setStringProperty(Stomp.Headers.TRANSFORMATION, transformation);
@@ -88,21 +88,21 @@
ignoreTransformation = true;
}
}
-
+
StompFrame command = protocolConverter.convertMessage(message, ignoreTransformation);
command.setAction(Stomp.Responses.MESSAGE);
if (subscriptionId != null) {
command.getHeaders().put(Stomp.Headers.Message.SUBSCRIPTION, subscriptionId);
}
-
+
protocolConverter.getTransportFilter().sendToStomp(command);
}
-
+
synchronized void onStompAbort(TransactionId transactionId) {
unconsumedMessage.clear();
}
-
+
synchronized void onStompCommit(TransactionId transactionId) {
for (Iterator iter = dispatchedMessage.entrySet().iterator(); iter.hasNext();) {
Map.Entry entry = (Entry)iter.next();
@@ -116,9 +116,9 @@
}
synchronized MessageAck onStompMessageAck(String messageId, TransactionId transactionId) {
-
+
MessageId msgId = new MessageId(messageId);
-
+
if (!dispatchedMessage.containsKey(msgId)) {
return null;
}
@@ -139,7 +139,7 @@
if (ack.getFirstMessageId() == null) {
ack.setFirstMessageId(id);
}
-
+
if (transactionId != null) {
if (!unconsumedMessage.contains(msg)) {
unconsumedMessage.add(msg);
@@ -147,8 +147,8 @@
} else {
iter.remove();
}
-
-
+
+
count++;
if (id.equals(msgId)) {
@@ -168,8 +168,8 @@
if (transactionId != null) {
unconsumedMessage.add(dispatchedMessage.get(msgId));
ack.setTransactionId(transactionId);
- }
- dispatchedMessage.remove(messageId);
+ }
+ dispatchedMessage.remove(msgId);
}
return ack;
}