resolve failure if DestinationRemoveRestartTest - destinations were auto created in the store on resetbatch which ocurred on shutdown

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@982180 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Gary Tully 2010-08-04 09:41:54 +00:00
parent 8c4bb36bbe
commit 6f7e3fc1d5
3 changed files with 16 additions and 3 deletions

View File

@ -520,8 +520,10 @@ public class KahaDBStore extends MessageDatabase implements PersistenceAdapter {
try {
pageFile.tx().execute(new Transaction.Closure<Exception>() {
public void execute(Transaction tx) throws Exception {
StoredDestination sd = getStoredDestination(dest, tx);
StoredDestination sd = getExistingStoredDestination(dest, tx);
if (sd != null) {
sd.orderIndex.resetCursorPosition();}
}
});
} catch (Exception e) {
LOG.error("Failed to reset batching",e);

View File

@ -1392,6 +1392,16 @@ public class MessageDatabase extends ServiceSupport implements BrokerServiceAwar
return rc;
}
protected StoredDestination getExistingStoredDestination(KahaDestination destination, Transaction tx) throws IOException {
String key = key(destination);
StoredDestination rc = storedDestinations.get(key);
if (rc == null && metadata.destinations.containsKey(tx, key)) {
rc = getStoredDestination(destination, tx);
}
return rc;
}
/**
* @param tx
* @param key

View File

@ -24,7 +24,7 @@ import org.apache.activemq.command.ActiveMQDestination;
// from https://issues.apache.org/activemq/browse/AMQ-2216
public class DestinationRemoveRestartTest extends CombinationTestSupport {
private final static String destinationName = "TEST";
public byte destinationType;
public byte destinationType = ActiveMQDestination.QUEUE_TYPE;
BrokerService broker;
@Override
@ -36,6 +36,7 @@ public class DestinationRemoveRestartTest extends CombinationTestSupport {
BrokerService broker = new BrokerService();
broker.setUseJmx(false);
broker.setPersistent(true);
broker.setDeleteAllMessagesOnStartup(true);
broker.start();
return broker;
}