Use a CopyOnWriteArrayList to ensure that traversals of the adapters
list do not generate ConcurrentModificationException if a new adapter is
added during that time.
This commit is contained in:
Timothy Bish 2015-02-11 17:22:26 -05:00
parent 8d4234345b
commit 2b17fd8050
1 changed files with 8 additions and 2 deletions

View File

@ -20,7 +20,13 @@ import java.io.File;
import java.io.FileFilter;
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.*;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArrayList;
import javax.transaction.xa.Xid;
@ -78,7 +84,7 @@ public class MultiKahaDBPersistenceAdapter extends LockableServiceSupport implem
final DelegateDestinationMap destinationMap = new DelegateDestinationMap();
BrokerService brokerService;
List<PersistenceAdapter> adapters = new LinkedList<PersistenceAdapter>();
List<PersistenceAdapter> adapters = new CopyOnWriteArrayList<PersistenceAdapter>();
private File directory = new File(IOHelper.getDefaultDataDirectory() + File.separator + "mKahaDB");
MultiKahaDBTransactionStore transactionStore = new MultiKahaDBTransactionStore(this);