Make the call to adapter.getDestinations() only once.

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@1344778 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Timothy A. Bish 2012-05-31 15:34:59 +00:00
parent 7504bc7a01
commit 30f677e56a
1 changed files with 3 additions and 2 deletions

View File

@ -318,8 +318,9 @@ public class MultiKahaDBPersistenceAdapter extends DestinationMap implements Per
private void registerExistingAdapter(FilteredKahaDBPersistenceAdapter filteredAdapter, File candidate) {
KahaDBPersistenceAdapter adapter = adapterFromTemplate(filteredAdapter.getPersistenceAdapter(), candidate.getName());
startAdapter(adapter, candidate.getName());
if (adapter.getDestinations().size() != 0) {
registerAdapter(adapter, adapter.getDestinations().toArray(new ActiveMQDestination[]{})[0]);
Set<ActiveMQDestination> destinations = adapter.getDestinations();
if (destinations.size() != 0) {
registerAdapter(adapter, destinations.toArray(new ActiveMQDestination[]{})[0]);
} else {
stopAdapter(adapter, candidate.getName());
}