mirror of https://github.com/apache/activemq.git
https://issues.apache.org/jira/browse/AMQ-4656 - first stab at improving keepDurableSubsActive feature, by not stoping/starting cursor on subscription (de)activating
git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1511333 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
45c399d810
commit
a7533ba922
|
@ -162,6 +162,7 @@ public class DurableTopicSubscription extends PrefetchSubscription implements Us
|
||||||
}
|
}
|
||||||
|
|
||||||
synchronized (pendingLock) {
|
synchronized (pendingLock) {
|
||||||
|
if (!((StoreDurableSubscriberCursor) pending).isStarted() || !keepDurableSubsActive) {
|
||||||
pending.setSystemUsage(memoryManager);
|
pending.setSystemUsage(memoryManager);
|
||||||
pending.setMemoryUsageHighWaterMark(getCursorMemoryHighWaterMark());
|
pending.setMemoryUsageHighWaterMark(getCursorMemoryHighWaterMark());
|
||||||
pending.setMaxAuditDepth(getMaxAuditDepth());
|
pending.setMaxAuditDepth(getMaxAuditDepth());
|
||||||
|
@ -176,6 +177,7 @@ public class DurableTopicSubscription extends PrefetchSubscription implements Us
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
this.active.set(true);
|
this.active.set(true);
|
||||||
this.offlineTimestamp.set(-1);
|
this.offlineTimestamp.set(-1);
|
||||||
dispatchPending();
|
dispatchPending();
|
||||||
|
@ -195,7 +197,9 @@ public class DurableTopicSubscription extends PrefetchSubscription implements Us
|
||||||
List<MessageReference> savedDispateched = null;
|
List<MessageReference> savedDispateched = null;
|
||||||
|
|
||||||
synchronized (pendingLock) {
|
synchronized (pendingLock) {
|
||||||
|
if (!keepDurableSubsActive) {
|
||||||
pending.stop();
|
pending.stop();
|
||||||
|
}
|
||||||
|
|
||||||
synchronized (dispatchLock) {
|
synchronized (dispatchLock) {
|
||||||
for (Destination destination : durableDestinations.values()) {
|
for (Destination destination : durableDestinations.values()) {
|
||||||
|
|
|
@ -309,7 +309,7 @@ public abstract class AbstractPendingMessageCursor implements PendingMessageCurs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected synchronized boolean isStarted() {
|
public synchronized boolean isStarted() {
|
||||||
return started;
|
return started;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -211,7 +211,7 @@ public abstract class AbstractStoreCursor extends AbstractPendingMessageCursor i
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public final synchronized void addMessageFirst(MessageReference node) throws Exception {
|
public synchronized void addMessageFirst(MessageReference node) throws Exception {
|
||||||
setCacheEnabled(false);
|
setCacheEnabled(false);
|
||||||
size++;
|
size++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
*/
|
*/
|
||||||
package org.apache.activemq.broker.region.cursors;
|
package org.apache.activemq.broker.region.cursors;
|
||||||
|
|
||||||
|
import org.apache.activemq.broker.region.MessageReference;
|
||||||
import org.apache.activemq.broker.region.Subscription;
|
import org.apache.activemq.broker.region.Subscription;
|
||||||
import org.apache.activemq.broker.region.Topic;
|
import org.apache.activemq.broker.region.Topic;
|
||||||
import org.apache.activemq.command.Message;
|
import org.apache.activemq.command.Message;
|
||||||
|
@ -60,6 +61,11 @@ class TopicStorePrefetch extends AbstractStoreCursor {
|
||||||
throw new RuntimeException("Not supported");
|
throw new RuntimeException("Not supported");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public synchronized void addMessageFirst(MessageReference node) throws Exception {
|
||||||
|
batchList.addMessageFirst(node);
|
||||||
|
size++;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized boolean recoverMessage(Message message, boolean cached) throws Exception {
|
public synchronized boolean recoverMessage(Message message, boolean cached) throws Exception {
|
||||||
|
|
|
@ -213,6 +213,7 @@ public class DurableConsumerTest extends CombinationTestSupport{
|
||||||
public void testConcurrentDurableConsumer() throws Exception{
|
public void testConcurrentDurableConsumer() throws Exception{
|
||||||
|
|
||||||
broker.start();
|
broker.start();
|
||||||
|
broker.waitUntilStarted();
|
||||||
|
|
||||||
factory = createConnectionFactory();
|
factory = createConnectionFactory();
|
||||||
final String topicName = getName();
|
final String topicName = getName();
|
||||||
|
@ -408,6 +409,7 @@ public class DurableConsumerTest extends CombinationTestSupport{
|
||||||
super.tearDown();
|
super.tearDown();
|
||||||
if (broker != null) {
|
if (broker != null) {
|
||||||
broker.stop();
|
broker.stop();
|
||||||
|
broker.waitUntilStopped();
|
||||||
broker = null;
|
broker = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -225,8 +225,10 @@ public class DurableSubSelectorDelayWithRestartTest {
|
||||||
} while (true);
|
} while (true);
|
||||||
|
|
||||||
} finally {
|
} finally {
|
||||||
|
try {
|
||||||
sess.close();
|
sess.close();
|
||||||
con.close();
|
con.close();
|
||||||
|
} catch (Exception e) {}
|
||||||
|
|
||||||
LOG.info(toString() + " OFFLINE.");
|
LOG.info(toString() + " OFFLINE.");
|
||||||
}
|
}
|
||||||
|
|
|
@ -130,6 +130,7 @@ public class DurableSubscriptionOfflineTest extends org.apache.activemq.TestSupp
|
||||||
((KahaDBPersistenceAdapter)broker.getPersistenceAdapter()).setJournalMaxFileLength(journalMaxFileLength);
|
((KahaDBPersistenceAdapter)broker.getPersistenceAdapter()).setJournalMaxFileLength(journalMaxFileLength);
|
||||||
}
|
}
|
||||||
broker.start();
|
broker.start();
|
||||||
|
broker.waitUntilStarted();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void destroyBroker() throws Exception {
|
private void destroyBroker() throws Exception {
|
||||||
|
@ -1120,6 +1121,7 @@ public class DurableSubscriptionOfflineTest extends org.apache.activemq.TestSupp
|
||||||
LOG.info("Iteration: " + i);
|
LOG.info("Iteration: " + i);
|
||||||
doTestOrderOnActivateDeactivate();
|
doTestOrderOnActivateDeactivate();
|
||||||
broker.stop();
|
broker.stop();
|
||||||
|
broker.waitUntilStopped();
|
||||||
createBroker(true /*deleteAllMessages*/);
|
createBroker(true /*deleteAllMessages*/);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue