Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;

import org.apache.activemq.artemis.utils.collections.ConcurrentHashSet;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;

public class ProcessBuilder {

static ConcurrentHashSet<Process> processes = new ConcurrentHashSet<>();
static Set<Process> processes = ConcurrentHashMap.newKeySet();

static {
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@
import java.net.URLConnection;
import java.security.PrivilegedAction;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;

import org.apache.activemq.artemis.logs.ActiveMQUtilLogger;
import org.apache.activemq.artemis.utils.ActiveMQThreadFactory;
import org.apache.activemq.artemis.utils.Env;
import org.apache.activemq.artemis.utils.collections.ConcurrentHashSet;
import org.apache.activemq.artemis.utils.sm.SecurityManagerShim;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -46,9 +46,9 @@ public class NetworkHealthCheck extends ActiveMQScheduledComponent {

private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());

private final Set<ActiveMQComponent> componentList = new ConcurrentHashSet<>();
private final Set<String> addresses = new ConcurrentHashSet<>();
private final Set<URL> urls = new ConcurrentHashSet<>();
private final Set<ActiveMQComponent> componentList = ConcurrentHashMap.newKeySet();
private final Set<String> addresses = ConcurrentHashMap.newKeySet();
private final Set<URL> urls = ConcurrentHashMap.newKeySet();
private NetworkInterface networkInterface;

public static final String IPV6_DEFAULT_COMMAND = Env.isWindowsOs() ? "ping -n 1 -w %d000 %s" : "ping6 -c 1 %2$s";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
* <p>
* Offers same concurrency as ConcurrentHashMap but for a Set
*/
@Deprecated(forRemoval = true)
public class ConcurrentHashSet<E> extends AbstractSet<E> implements ConcurrentSet<E> {

Check warning on line 30 in artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/ConcurrentHashSet.java

View workflow job for this annotation

GitHub Actions / Checks (17)

org.apache.activemq.artemis.utils.collections.ConcurrentSet in org.apache.activemq.artemis.utils.collections has been deprecated and marked for removal

Check warning on line 30 in artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/ConcurrentHashSet.java

View workflow job for this annotation

GitHub Actions / Checks (17)

org.apache.activemq.artemis.utils.collections.ConcurrentSet in org.apache.activemq.artemis.utils.collections has been deprecated and marked for removal

Check warning on line 30 in artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/ConcurrentHashSet.java

View workflow job for this annotation

GitHub Actions / Checks (17)

org.apache.activemq.artemis.utils.collections.ConcurrentSet in org.apache.activemq.artemis.utils.collections has been deprecated and marked for removal

Check warning on line 30 in artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/ConcurrentHashSet.java

View workflow job for this annotation

GitHub Actions / Checks (17)

org.apache.activemq.artemis.utils.collections.ConcurrentSet in org.apache.activemq.artemis.utils.collections has been deprecated and marked for removal

Check warning on line 30 in artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/ConcurrentHashSet.java

View workflow job for this annotation

GitHub Actions / Checks (17)

org.apache.activemq.artemis.utils.collections.ConcurrentSet in org.apache.activemq.artemis.utils.collections has been deprecated and marked for removal

Check warning on line 30 in artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/ConcurrentHashSet.java

View workflow job for this annotation

GitHub Actions / Checks (17)

org.apache.activemq.artemis.utils.collections.ConcurrentSet in org.apache.activemq.artemis.utils.collections has been deprecated and marked for removal

Check warning on line 30 in artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/ConcurrentHashSet.java

View workflow job for this annotation

GitHub Actions / Checks (17)

org.apache.activemq.artemis.utils.collections.ConcurrentSet in org.apache.activemq.artemis.utils.collections has been deprecated and marked for removal

Check warning on line 30 in artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/ConcurrentHashSet.java

View workflow job for this annotation

GitHub Actions / Checks (17)

org.apache.activemq.artemis.utils.collections.ConcurrentSet in org.apache.activemq.artemis.utils.collections has been deprecated and marked for removal

Check warning on line 30 in artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/ConcurrentHashSet.java

View workflow job for this annotation

GitHub Actions / Checks (17)

org.apache.activemq.artemis.utils.collections.ConcurrentSet in org.apache.activemq.artemis.utils.collections has been deprecated and marked for removal

Check warning on line 30 in artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/ConcurrentHashSet.java

View workflow job for this annotation

GitHub Actions / Checks (17)

org.apache.activemq.artemis.utils.collections.ConcurrentSet in org.apache.activemq.artemis.utils.collections has been deprecated and marked for removal

Check warning on line 30 in artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/ConcurrentHashSet.java

View workflow job for this annotation

GitHub Actions / Test (25)

org.apache.activemq.artemis.utils.collections.ConcurrentSet in org.apache.activemq.artemis.utils.collections has been deprecated and marked for removal

Check warning on line 30 in artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/ConcurrentHashSet.java

View workflow job for this annotation

GitHub Actions / Test (25)

org.apache.activemq.artemis.utils.collections.ConcurrentSet in org.apache.activemq.artemis.utils.collections has been deprecated and marked for removal

Check warning on line 30 in artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/ConcurrentHashSet.java

View workflow job for this annotation

GitHub Actions / Test (25)

org.apache.activemq.artemis.utils.collections.ConcurrentSet in org.apache.activemq.artemis.utils.collections has been deprecated and marked for removal

Check warning on line 30 in artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/ConcurrentHashSet.java

View workflow job for this annotation

GitHub Actions / Test (25)

org.apache.activemq.artemis.utils.collections.ConcurrentSet in org.apache.activemq.artemis.utils.collections has been deprecated and marked for removal

Check warning on line 30 in artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/ConcurrentHashSet.java

View workflow job for this annotation

GitHub Actions / Test (25)

org.apache.activemq.artemis.utils.collections.ConcurrentSet in org.apache.activemq.artemis.utils.collections has been deprecated and marked for removal

Check warning on line 30 in artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/ConcurrentHashSet.java

View workflow job for this annotation

GitHub Actions / Checks (25)

org.apache.activemq.artemis.utils.collections.ConcurrentSet in org.apache.activemq.artemis.utils.collections has been deprecated and marked for removal

Check warning on line 30 in artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/ConcurrentHashSet.java

View workflow job for this annotation

GitHub Actions / Checks (25)

org.apache.activemq.artemis.utils.collections.ConcurrentSet in org.apache.activemq.artemis.utils.collections has been deprecated and marked for removal

Check warning on line 30 in artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/ConcurrentHashSet.java

View workflow job for this annotation

GitHub Actions / Checks (25)

org.apache.activemq.artemis.utils.collections.ConcurrentSet in org.apache.activemq.artemis.utils.collections has been deprecated and marked for removal

Check warning on line 30 in artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/ConcurrentHashSet.java

View workflow job for this annotation

GitHub Actions / Checks (25)

org.apache.activemq.artemis.utils.collections.ConcurrentSet in org.apache.activemq.artemis.utils.collections has been deprecated and marked for removal

Check warning on line 30 in artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/ConcurrentHashSet.java

View workflow job for this annotation

GitHub Actions / Checks (25)

org.apache.activemq.artemis.utils.collections.ConcurrentSet in org.apache.activemq.artemis.utils.collections has been deprecated and marked for removal

Check warning on line 30 in artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/ConcurrentHashSet.java

View workflow job for this annotation

GitHub Actions / Checks (21)

org.apache.activemq.artemis.utils.collections.ConcurrentSet in org.apache.activemq.artemis.utils.collections has been deprecated and marked for removal

Check warning on line 30 in artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/ConcurrentHashSet.java

View workflow job for this annotation

GitHub Actions / Checks (21)

org.apache.activemq.artemis.utils.collections.ConcurrentSet in org.apache.activemq.artemis.utils.collections has been deprecated and marked for removal

Check warning on line 30 in artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/ConcurrentHashSet.java

View workflow job for this annotation

GitHub Actions / Checks (21)

org.apache.activemq.artemis.utils.collections.ConcurrentSet in org.apache.activemq.artemis.utils.collections has been deprecated and marked for removal

Check warning on line 30 in artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/ConcurrentHashSet.java

View workflow job for this annotation

GitHub Actions / Checks (21)

org.apache.activemq.artemis.utils.collections.ConcurrentSet in org.apache.activemq.artemis.utils.collections has been deprecated and marked for removal

Check warning on line 30 in artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/ConcurrentHashSet.java

View workflow job for this annotation

GitHub Actions / Checks (21)

org.apache.activemq.artemis.utils.collections.ConcurrentSet in org.apache.activemq.artemis.utils.collections has been deprecated and marked for removal

Check warning on line 30 in artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/ConcurrentHashSet.java

View workflow job for this annotation

GitHub Actions / Checks (21)

org.apache.activemq.artemis.utils.collections.ConcurrentSet in org.apache.activemq.artemis.utils.collections has been deprecated and marked for removal

Check warning on line 30 in artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/ConcurrentHashSet.java

View workflow job for this annotation

GitHub Actions / Checks (21)

org.apache.activemq.artemis.utils.collections.ConcurrentSet in org.apache.activemq.artemis.utils.collections has been deprecated and marked for removal

Check warning on line 30 in artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/ConcurrentHashSet.java

View workflow job for this annotation

GitHub Actions / Checks (21)

org.apache.activemq.artemis.utils.collections.ConcurrentSet in org.apache.activemq.artemis.utils.collections has been deprecated and marked for removal

Check warning on line 30 in artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/ConcurrentHashSet.java

View workflow job for this annotation

GitHub Actions / Checks (21)

org.apache.activemq.artemis.utils.collections.ConcurrentSet in org.apache.activemq.artemis.utils.collections has been deprecated and marked for removal

Check warning on line 30 in artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/ConcurrentHashSet.java

View workflow job for this annotation

GitHub Actions / Checks (21)

org.apache.activemq.artemis.utils.collections.ConcurrentSet in org.apache.activemq.artemis.utils.collections has been deprecated and marked for removal

Check warning on line 30 in artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/ConcurrentHashSet.java

View workflow job for this annotation

GitHub Actions / Test (21)

org.apache.activemq.artemis.utils.collections.ConcurrentSet in org.apache.activemq.artemis.utils.collections has been deprecated and marked for removal

Check warning on line 30 in artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/ConcurrentHashSet.java

View workflow job for this annotation

GitHub Actions / Test (21)

org.apache.activemq.artemis.utils.collections.ConcurrentSet in org.apache.activemq.artemis.utils.collections has been deprecated and marked for removal

Check warning on line 30 in artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/ConcurrentHashSet.java

View workflow job for this annotation

GitHub Actions / Test (21)

org.apache.activemq.artemis.utils.collections.ConcurrentSet in org.apache.activemq.artemis.utils.collections has been deprecated and marked for removal

Check warning on line 30 in artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/ConcurrentHashSet.java

View workflow job for this annotation

GitHub Actions / Test (21)

org.apache.activemq.artemis.utils.collections.ConcurrentSet in org.apache.activemq.artemis.utils.collections has been deprecated and marked for removal

Check warning on line 30 in artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/ConcurrentHashSet.java

View workflow job for this annotation

GitHub Actions / Test (21)

org.apache.activemq.artemis.utils.collections.ConcurrentSet in org.apache.activemq.artemis.utils.collections has been deprecated and marked for removal

Check warning on line 30 in artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/ConcurrentHashSet.java

View workflow job for this annotation

GitHub Actions / Test (17)

org.apache.activemq.artemis.utils.collections.ConcurrentSet in org.apache.activemq.artemis.utils.collections has been deprecated and marked for removal

Check warning on line 30 in artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/ConcurrentHashSet.java

View workflow job for this annotation

GitHub Actions / Test (17)

org.apache.activemq.artemis.utils.collections.ConcurrentSet in org.apache.activemq.artemis.utils.collections has been deprecated and marked for removal

Check warning on line 30 in artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/ConcurrentHashSet.java

View workflow job for this annotation

GitHub Actions / Test (17)

org.apache.activemq.artemis.utils.collections.ConcurrentSet in org.apache.activemq.artemis.utils.collections has been deprecated and marked for removal

Check warning on line 30 in artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/ConcurrentHashSet.java

View workflow job for this annotation

GitHub Actions / Test (17)

org.apache.activemq.artemis.utils.collections.ConcurrentSet in org.apache.activemq.artemis.utils.collections has been deprecated and marked for removal

Check warning on line 30 in artemis-commons/src/main/java/org/apache/activemq/artemis/utils/collections/ConcurrentHashSet.java

View workflow job for this annotation

GitHub Actions / Test (17)

org.apache.activemq.artemis.utils.collections.ConcurrentSet in org.apache.activemq.artemis.utils.collections has been deprecated and marked for removal

private final ConcurrentMap<E, Object> theMap;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
*
* @param <E> The generic class
*/
@Deprecated(forRemoval = true)
public interface ConcurrentSet<E> extends Set<E> {

boolean addIfAbsent(E o);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,13 @@
import java.security.PrivilegedAction;
import java.util.ConcurrentModificationException;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.TimeUnit;

import org.apache.activemq.artemis.core.server.ActiveMQScheduledComponent;
import org.apache.activemq.artemis.utils.ActiveMQThreadFactory;
import org.apache.activemq.artemis.utils.collections.ConcurrentHashSet;
import org.apache.activemq.artemis.utils.sm.SecurityManagerShim;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -79,7 +80,7 @@ public void clear() {

private List<CriticalAction> actions = new CopyOnWriteArrayList<>();

private final ConcurrentHashSet<CriticalComponent> components = new ConcurrentHashSet<>();
private final Set<CriticalComponent> components = ConcurrentHashMap.newKeySet();

@Override
public int getNumberOfComponents() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,10 @@
import java.beans.PropertyDescriptor;
import java.lang.reflect.Method;
import java.util.Locale;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;

import org.apache.activemq.artemis.api.core.Pair;
import org.apache.activemq.artemis.utils.collections.ConcurrentHashSet;
import org.apache.commons.beanutils.FluentPropertyBeanIntrospector;
import org.apache.commons.beanutils.IntrospectionContext;
import org.slf4j.Logger;
Expand All @@ -34,7 +35,7 @@ public class FluentPropertyBeanIntrospectorWithIgnores extends FluentPropertyBea

static Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());

private static ConcurrentHashSet<Pair<String, String>> ignores = new ConcurrentHashSet<>();
private static Set<Pair<String, String>> ignores = ConcurrentHashMap.newKeySet();

public static void addIgnore(String className, String methodName) {
logger.trace("Adding ignore on {}/{}", className, methodName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
import java.lang.ref.WeakReference;
import java.security.PrivilegedAction;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Executor;
import java.util.concurrent.Future;
Expand Down Expand Up @@ -73,7 +73,6 @@
import org.apache.activemq.artemis.utils.UUIDGenerator;
import org.apache.activemq.artemis.utils.actors.ArtemisExecutor;
import org.apache.activemq.artemis.utils.actors.OrderedExecutorFactory;
import org.apache.activemq.artemis.utils.collections.ConcurrentHashSet;
import org.apache.activemq.artemis.utils.sm.SecurityManagerShim;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -104,7 +103,7 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C

private final long connectionTTL;

private final Set<ClientSessionInternal> sessions = new ConcurrentHashSet<>();
private final Set<ClientSessionInternal> sessions = ConcurrentHashMap.newKeySet();

private final Object createSessionLock = new Object();

Expand Down Expand Up @@ -138,9 +137,9 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C

private int failoverAttempts;

private final Set<SessionFailureListener> listeners = new ConcurrentHashSet<>();
private final Set<SessionFailureListener> listeners = ConcurrentHashMap.newKeySet();

private final Set<FailoverEventListener> failoverListeners = new ConcurrentHashSet<>();
private final Set<FailoverEventListener> failoverListeners = ConcurrentHashMap.newKeySet();

private Connector connector;

Expand All @@ -155,7 +154,7 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C

private volatile boolean closed;

public static final Set<CloseRunnable> CLOSE_RUNNABLES = Collections.synchronizedSet(new HashSet<>());
public static final Set<CloseRunnable> CLOSE_RUNNABLES = ConcurrentHashMap.newKeySet();

private final ConfirmationWindowWarning confirmationWindowWarning;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@
import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;

import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;

import org.apache.activemq.artemis.utils.TimeAndCounterIDGenerator;
import org.apache.activemq.artemis.utils.collections.ConcurrentHashSet;
import org.junit.jupiter.api.Test;

public class TimeAndCounterIDGeneratorTest {
Expand Down Expand Up @@ -66,7 +67,7 @@ public void testCalculationRefresh() {

@Test
public void testCalculationOnMultiThread() throws Throwable {
final ConcurrentHashSet<Long> hashSet = new ConcurrentHashSet<>();
final Set<Long> hashSet = ConcurrentHashMap.newKeySet();

final TimeAndCounterIDGenerator seq = new TimeAndCounterIDGenerator();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import java.security.PrivilegedAction;
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

Expand Down Expand Up @@ -55,7 +56,6 @@
import org.apache.activemq.artemis.utils.ActiveMQThreadFactory;
import org.apache.activemq.artemis.utils.UUIDGenerator;
import org.apache.activemq.artemis.utils.VersionLoader;
import org.apache.activemq.artemis.utils.collections.ConcurrentHashSet;
import org.apache.activemq.artemis.utils.sm.SecurityManagerShim;

/**
Expand All @@ -82,9 +82,9 @@ public class ActiveMQConnection extends ActiveMQConnectionForContextImpl impleme

private final int connectionType;

private final Set<ActiveMQSession> sessions = new ConcurrentHashSet<>();
private final Set<ActiveMQSession> sessions = ConcurrentHashMap.newKeySet();

private final Set<SimpleString> tempQueues = new ConcurrentHashSet<>();
private final Set<SimpleString> tempQueues = ConcurrentHashMap.newKeySet();

private volatile boolean hasNoLocal;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@

import javax.jms.IllegalStateException;
import java.util.Set;

import org.apache.activemq.artemis.utils.collections.ConcurrentHashSet;
import java.util.concurrent.ConcurrentHashMap;

/**
* Restricts what can be called on context passed in wrapped CompletionListener.
Expand All @@ -39,7 +38,7 @@ public class ThreadAwareContext {
* Use a set because JMSContext can create more than one JMSConsumer to receive asynchronously from different
* destinations.
*/
private final Set<Long> messageListenerThreads = new ConcurrentHashSet<>();
private final Set<Long> messageListenerThreads = ConcurrentHashMap.newKeySet();

/**
* Sets current thread to the context
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.Executor;
import java.util.concurrent.RejectedExecutionException;
Expand Down Expand Up @@ -87,7 +89,6 @@
import org.apache.activemq.artemis.utils.SimpleFuture;
import org.apache.activemq.artemis.utils.SimpleFutureImpl;
import org.apache.activemq.artemis.utils.actors.OrderedExecutorFactory;
import org.apache.activemq.artemis.utils.collections.ConcurrentHashSet;
import org.apache.activemq.artemis.utils.collections.ConcurrentLongHashMap;
import org.apache.activemq.artemis.utils.collections.LongHashSet;
import org.apache.activemq.artemis.utils.collections.SparseArrayLinkedList;
Expand Down Expand Up @@ -313,7 +314,7 @@ public JournalImpl setHistoryFolder(File historyFolder, long maxBytes, long peri

private Executor appendExecutor = null;

private final ConcurrentHashSet<CountDownLatch> latches = new ConcurrentHashSet<>();
private final Set<CountDownLatch> latches = ConcurrentHashMap.newKeySet();

private final ExecutorFactory providedIOThreadPool;
protected ExecutorFactory ioExecutorFactory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@

import java.lang.invoke.MethodHandles;
import java.util.Collection;
import java.util.concurrent.ConcurrentHashMap;
import org.apache.activemq.artemis.api.core.ActiveMQException;
import org.apache.activemq.artemis.core.config.amqpBrokerConnectivity.AMQPBridgeBrokerConnectionElement;
import org.apache.activemq.artemis.protocol.amqp.connect.AMQPBrokerConnection;
import org.apache.activemq.artemis.protocol.amqp.proton.AMQPSessionContext;
import org.apache.activemq.artemis.utils.collections.ConcurrentHashSet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -33,7 +33,7 @@ public class AMQPBridgeManagers {

private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());

private final Collection<AMQPBridgeManager> bridgeManagers = new ConcurrentHashSet<>();
private final Collection<AMQPBridgeManager> bridgeManagers = ConcurrentHashMap.newKeySet();
private final AMQPBrokerConnection brokerConnection;

public AMQPBridgeManagers(AMQPBrokerConnection brokerConnection) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;

import org.apache.activemq.artemis.api.core.Message;
import org.apache.activemq.artemis.core.io.IOCallback;
Expand All @@ -34,7 +35,6 @@
import org.apache.activemq.artemis.protocol.amqp.connect.federation.AMQPFederationMetrics.ConsumerMetrics;
import org.apache.activemq.artemis.protocol.amqp.federation.FederationConsumerInfo;
import org.apache.activemq.artemis.protocol.amqp.proton.AMQPSessionContext;
import org.apache.activemq.artemis.utils.collections.ConcurrentHashSet;
import org.apache.qpid.proton.amqp.messaging.Accepted;
import org.apache.qpid.proton.engine.Delivery;
import org.apache.qpid.proton.engine.Receiver;
Expand All @@ -59,7 +59,7 @@ public final class AMQPFederationAddressBindingsConsumer extends AMQPFederationA

private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());

private final Set<Binding> bindings = new ConcurrentHashSet<>();
private final Set<Binding> bindings = ConcurrentHashMap.newKeySet();
private final PostOffice postOffice;
private final StorageManager storageManager;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
import org.apache.activemq.artemis.spi.core.remoting.ReadyListener;
import org.apache.activemq.artemis.utils.ByteUtil;
import org.apache.activemq.artemis.utils.VersionLoader;
import org.apache.activemq.artemis.utils.collections.ConcurrentHashSet;
import org.apache.qpid.proton.amqp.Symbol;
import org.apache.qpid.proton.amqp.messaging.Source;
import org.apache.qpid.proton.amqp.messaging.TerminusExpiryPolicy;
Expand Down Expand Up @@ -127,7 +126,7 @@ public void enableAutoRead() {
private final Symbol[] desiredCapabilities;
private final ScheduledExecutorService scheduledPool;
private final Map<String, LinkCloseListener> linkCloseListeners = new ConcurrentHashMap<>();
private final Set<Consumer<AMQPConnectionContext>> remoteOpenedListeners = new ConcurrentHashSet<>();
private final Set<Consumer<AMQPConnectionContext>> remoteOpenedListeners = ConcurrentHashMap.newKeySet();

private final Map<Session, AMQPSessionContext> sessions = new ConcurrentHashMap<>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@
import org.apache.activemq.artemis.spi.core.remoting.Connection;
import org.apache.activemq.artemis.utils.UUIDGenerator;
import org.apache.activemq.artemis.utils.actors.ThresholdActor;
import org.apache.activemq.artemis.utils.collections.ConcurrentHashSet;
import org.apache.activemq.command.ActiveMQDestination;
import org.apache.activemq.command.ActiveMQMessage;
import org.apache.activemq.command.ActiveMQTempQueue;
Expand Down Expand Up @@ -208,7 +207,7 @@ public class OpenWireConnection extends AbstractRemotingConnection implements Se
private long maxInactivityDuration;
private volatile ThresholdActor<Command> openWireActor;

private final Set<SimpleString> knownDestinations = new ConcurrentHashSet<>();
private final Set<SimpleString> knownDestinations = ConcurrentHashMap.newKeySet();

private final AtomicBoolean disableTtl = new AtomicBoolean(false);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,14 @@
import javax.resource.spi.ManagedConnection;
import javax.resource.spi.ManagedConnectionFactory;

import org.apache.activemq.artemis.utils.collections.ConcurrentHashSet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.IOException;
import java.io.ObjectInputStream;
import java.lang.invoke.MethodHandles;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;

/**
* The connection manager used in non-managed environments.
Expand All @@ -42,7 +43,7 @@ public ActiveMQRAConnectionManager() {
logger.trace("constructor()");
}

transient ConcurrentHashSet<ManagedConnection> connections = new ConcurrentHashSet<>();
transient Set<ManagedConnection> connections = ConcurrentHashMap.newKeySet();

/**
* Allocates a connection
Expand Down Expand Up @@ -81,6 +82,6 @@ public void stop() {
*/
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
in.defaultReadObject();
connections = new ConcurrentHashSet<>();
connections = ConcurrentHashMap.newKeySet();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@
import java.util.ArrayList;
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.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.locks.ReentrantLock;
Expand Down Expand Up @@ -73,9 +73,9 @@ public final class ActiveMQRAManagedConnection implements ManagedConnection, Exc

private final AtomicBoolean isDestroyed = new AtomicBoolean(false);

private final List<ConnectionEventListener> eventListeners;
private final List<ConnectionEventListener> eventListeners = Collections.synchronizedList(new ArrayList<>());

private final Set<ActiveMQRASession> handles;
private final Set<ActiveMQRASession> handles = ConcurrentHashMap.newKeySet();

private ReentrantLock lock = new ReentrantLock();

Expand Down Expand Up @@ -111,8 +111,6 @@ public ActiveMQRAManagedConnection(final ActiveMQRAManagedConnectionFactory mcf,
this.ra = ra;
this.userName = userName;
this.password = password;
eventListeners = Collections.synchronizedList(new ArrayList<>());
handles = Collections.synchronizedSet(new HashSet<>());

connection = null;
nonXAsession = null;
Expand Down
Loading
Loading