mirror of https://github.com/apache/activemq.git
fix for: https://issues.apache.org/jira/browse/AMQ-4487 and https://issues.apache.org/jira/browse/AMQ-4372
Additional testing and updates. git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1490032 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
05796e7600
commit
d97f28c490
|
@ -244,6 +244,7 @@ public class PolicyEntry extends DestinationMapEntry {
|
||||||
// is done. We should refactor the browsers to better handle message dispatch so
|
// is done. We should refactor the browsers to better handle message dispatch so
|
||||||
// we can remove this and perform a more efficient dispatch.
|
// we can remove this and perform a more efficient dispatch.
|
||||||
sub.setMaxProducersToAudit(Integer.MAX_VALUE);
|
sub.setMaxProducersToAudit(Integer.MAX_VALUE);
|
||||||
|
sub.setMaxAuditDepth(Short.MAX_VALUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void configure(Broker broker, SystemUsage memoryManager, QueueSubscription sub) {
|
public void configure(Broker broker, SystemUsage memoryManager, QueueSubscription sub) {
|
||||||
|
|
|
@ -0,0 +1,70 @@
|
||||||
|
/**
|
||||||
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
|
* contributor license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright ownership.
|
||||||
|
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||||
|
* (the "License"); you may not use this file except in compliance with
|
||||||
|
* the License. You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.apache.activemq;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertFalse;
|
||||||
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
|
import org.apache.activemq.command.ConnectionId;
|
||||||
|
import org.apache.activemq.command.MessageId;
|
||||||
|
import org.apache.activemq.command.ProducerId;
|
||||||
|
import org.apache.activemq.command.SessionId;
|
||||||
|
import org.apache.activemq.util.IdGenerator;
|
||||||
|
import org.apache.activemq.util.LongSequenceGenerator;
|
||||||
|
import org.junit.After;
|
||||||
|
import org.junit.Before;
|
||||||
|
import org.junit.Test;
|
||||||
|
|
||||||
|
public class ActiveMQMessageAuditNotSyncTest {
|
||||||
|
|
||||||
|
private final IdGenerator connectionIdGenerator = new IdGenerator();
|
||||||
|
private final LongSequenceGenerator sessionIdGenerator = new LongSequenceGenerator();
|
||||||
|
private final LongSequenceGenerator producerIdGenerator = new LongSequenceGenerator();
|
||||||
|
private final LongSequenceGenerator sequenceIdGenerator = new LongSequenceGenerator();
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void setUp() throws Exception {
|
||||||
|
}
|
||||||
|
|
||||||
|
@After
|
||||||
|
public void tearDown() throws Exception {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testAuditDepth() {
|
||||||
|
|
||||||
|
int maxAuditDepth = Integer.MAX_VALUE;
|
||||||
|
|
||||||
|
ConnectionId connectionId = new ConnectionId(connectionIdGenerator.generateId());
|
||||||
|
SessionId sessionId = new SessionId(connectionId, sessionIdGenerator.getNextSequenceId());
|
||||||
|
ProducerId producerId = new ProducerId(sessionId, producerIdGenerator.getNextSequenceId());
|
||||||
|
|
||||||
|
ActiveMQMessageAuditNoSync audit = new ActiveMQMessageAuditNoSync();
|
||||||
|
audit.setAuditDepth(maxAuditDepth);
|
||||||
|
|
||||||
|
MessageId msgId = new MessageId(producerId, 0);
|
||||||
|
for (int i = 0; i < maxAuditDepth; i++) {
|
||||||
|
msgId.setProducerSequenceId(sequenceIdGenerator.getNextSequenceId());
|
||||||
|
assertFalse(audit.isDuplicate(msgId));
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < maxAuditDepth; i++) {
|
||||||
|
assertTrue(audit.isDuplicate(msgId));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -307,7 +307,9 @@ public class JmsQueueBrowserTest extends JmsTestSupport {
|
||||||
|
|
||||||
MessageProducer producer = session.createProducer(destination);
|
MessageProducer producer = session.createProducer(destination);
|
||||||
|
|
||||||
for (int i = 0; i < 1000; i++) {
|
int numberOfMessages = 4096;
|
||||||
|
|
||||||
|
for (int i = 0; i < numberOfMessages; i++) {
|
||||||
producer.send(session.createTextMessage("Message: " + i));
|
producer.send(session.createTextMessage("Message: " + i));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -329,7 +331,7 @@ public class JmsQueueBrowserTest extends JmsTestSupport {
|
||||||
}
|
}
|
||||||
|
|
||||||
System.out.println("Number browsed: " + numberBrowsed);
|
System.out.println("Number browsed: " + numberBrowsed);
|
||||||
assertEquals(1000, numberBrowsed);
|
assertEquals(numberOfMessages, numberBrowsed);
|
||||||
browser.close();
|
browser.close();
|
||||||
producer.close();
|
producer.close();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue