diff --git a/artemis-boot/src/main/java/org/apache/activemq/artemis/boot/Artemis.java b/artemis-boot/src/main/java/org/apache/activemq/artemis/boot/Artemis.java index b0458a2d75..bc2910df41 100644 --- a/artemis-boot/src/main/java/org/apache/activemq/artemis/boot/Artemis.java +++ b/artemis-boot/src/main/java/org/apache/activemq/artemis/boot/Artemis.java @@ -53,7 +53,7 @@ public class Artemis { /** This is a good method for booting an embedded command */ public static Object execute(File fileHome, File fileInstance, String ... args) throws Throwable { - ArrayList dirs = new ArrayList(); + ArrayList dirs = new ArrayList<>(); if (fileHome != null) { dirs.add(new File(fileHome, "lib")); } @@ -62,7 +62,7 @@ public class Artemis { } - ArrayList urls = new ArrayList(); + ArrayList urls = new ArrayList<>(); // Without the etc on the config, things like JGroups configuration wouldn't be loaded if (fileInstance != null) { @@ -79,7 +79,7 @@ public class Artemis { if (bootdir.exists() && bootdir.isDirectory()) { // Find the jar files in the directory.. - ArrayList files = new ArrayList(); + ArrayList files = new ArrayList<>(); for (File f : bootdir.listFiles()) { if (f.getName().endsWith(".jar") || f.getName().endsWith(".zip")) { files.add(f); diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java index cd7eb5da03..cb1ae12d4f 100644 --- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java +++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/Create.java @@ -460,7 +460,7 @@ public class Create extends InputAbstract { context.out.println(String.format("Creating ActiveMQ Artemis instance at: %s", directory.getCanonicalPath())); - HashMap filters = new HashMap(); + HashMap filters = new HashMap<>(); filters.put("${master-slave}", isSlave() ? "slave" : "master"); @@ -681,7 +681,7 @@ public class Create extends InputAbstract { String writesPerMillisecondStr = new DecimalFormat("###.##").format(writesPerMillisecond); - HashMap syncFilter = new HashMap(); + HashMap syncFilter = new HashMap<>(); syncFilter.put("${nanoseconds}", Long.toString(nanoseconds)); syncFilter.put("${writesPerMillisecond}", writesPerMillisecondStr); diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/tools/DecodeJournal.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/tools/DecodeJournal.java index 88c761ffce..f2c20d9d22 100644 --- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/tools/DecodeJournal.java +++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/tools/DecodeJournal.java @@ -122,7 +122,7 @@ public class DecodeJournal extends LockAbstract { String line; - HashMap txCounters = new HashMap(); + HashMap txCounters = new HashMap<>(); long lineNumber = 0; diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/tools/PrintData.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/tools/PrintData.java index 4cd4716aa4..c148484b75 100644 --- a/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/tools/PrintData.java +++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/cli/commands/tools/PrintData.java @@ -148,7 +148,7 @@ public class PrintData extends LockAbstract { }; final StorageManager sm = new NullStorageManager(); PagingStoreFactory pageStoreFactory = new PagingStoreFactoryNIO(sm, pageDirectory, 1000L, scheduled, execfactory, false, null); - HierarchicalRepository addressSettingsRepository = new HierarchicalObjectRepository(); + HierarchicalRepository addressSettingsRepository = new HierarchicalObjectRepository<>(); addressSettingsRepository.setDefault(new AddressSettings()); PagingManager manager = new PagingManagerImpl(pageStoreFactory, addressSettingsRepository); @@ -241,7 +241,7 @@ public class PrintData extends LockAbstract { Set set = cursorInfo.getCursorRecords().get(encoding.queueID); if (set == null) { - set = new HashSet(); + set = new HashSet<>(); cursorInfo.getCursorRecords().put(encoding.queueID, set); } @@ -281,11 +281,11 @@ public class PrintData extends LockAbstract { private static class PageCursorsInfo { - private final Map> cursorRecords = new HashMap>(); + private final Map> cursorRecords = new HashMap<>(); - private final Set pgTXs = new HashSet(); + private final Set pgTXs = new HashSet<>(); - private final Map> completePages = new HashMap>(); + private final Map> completePages = new HashMap<>(); public PageCursorsInfo() { } @@ -315,7 +315,7 @@ public class PrintData extends LockAbstract { Set completePagesSet = completePages.get(queueID); if (completePagesSet == null) { - completePagesSet = new HashSet(); + completePagesSet = new HashSet<>(); completePages.put(queueID, completePagesSet); } diff --git a/artemis-cli/src/main/java/org/apache/activemq/artemis/integration/FileBroker.java b/artemis-cli/src/main/java/org/apache/activemq/artemis/integration/FileBroker.java index 04f658f977..8ae5729ebe 100644 --- a/artemis-cli/src/main/java/org/apache/activemq/artemis/integration/FileBroker.java +++ b/artemis-cli/src/main/java/org/apache/activemq/artemis/integration/FileBroker.java @@ -95,7 +95,7 @@ public class FileBroker implements Broker { * will need impproving if we get more. * */ public ArrayList getComponentsByStartOrder(Map components) { - ArrayList activeMQComponents = new ArrayList(); + ArrayList activeMQComponents = new ArrayList<>(); ActiveMQComponent jmsComponent = components.get("jms"); if (jmsComponent != null) { activeMQComponents.add(jmsComponent); diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/api/core/ActiveMQExceptionType.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/api/core/ActiveMQExceptionType.java index 6aca1d013d..f135653950 100644 --- a/artemis-commons/src/main/java/org/apache/activemq/artemis/api/core/ActiveMQExceptionType.java +++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/api/core/ActiveMQExceptionType.java @@ -206,7 +206,7 @@ public enum ActiveMQExceptionType { private static final Map TYPE_MAP; static { - HashMap map = new HashMap(); + HashMap map = new HashMap<>(); for (ActiveMQExceptionType type : EnumSet.allOf(ActiveMQExceptionType.class)) { map.put(type.getCode(), type); } diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/api/core/SimpleString.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/api/core/SimpleString.java index b9f8861cb2..70cf4cf5be 100644 --- a/artemis-commons/src/main/java/org/apache/activemq/artemis/api/core/SimpleString.java +++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/api/core/SimpleString.java @@ -262,7 +262,7 @@ public final class SimpleString implements CharSequence, Serializable, Comparabl // For that reason I'm allocating the ArrayList with 2 already // I have thought about using LinkedList here but I think this will be good enough already // Note by Clebert - all = new ArrayList(2); + all = new ArrayList<>(2); } all.add(new SimpleString(bytes)); } diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/ConcurrentHashSet.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/ConcurrentHashSet.java index 9a3ae8ce1e..1b4e5d7753 100644 --- a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/ConcurrentHashSet.java +++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/ConcurrentHashSet.java @@ -33,7 +33,7 @@ public class ConcurrentHashSet extends AbstractSet implements ConcurrentSe private static final Object dummy = new Object(); public ConcurrentHashSet() { - theMap = new ConcurrentHashMap(); + theMap = new ConcurrentHashMap<>(); } @Override diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/FactoryFinder.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/FactoryFinder.java index 748006d18c..70b9c83488 100644 --- a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/FactoryFinder.java +++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/FactoryFinder.java @@ -52,7 +52,7 @@ public class FactoryFinder { */ protected static class StandaloneObjectFactory implements ObjectFactory { - final ConcurrentMap classMap = new ConcurrentHashMap(); + final ConcurrentMap classMap = new ConcurrentHashMap<>(); @Override public Object create(final String path) throws InstantiationException, IllegalAccessException, ClassNotFoundException, IOException { diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/FileUtil.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/FileUtil.java index 9ec689ceab..81008af6a8 100644 --- a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/FileUtil.java +++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/FileUtil.java @@ -37,7 +37,7 @@ public class FileUtil { public static void makeExec(File file) throws IOException { try { - Files.setPosixFilePermissions(file.toPath(), new HashSet(Arrays.asList(OWNER_READ, OWNER_WRITE, OWNER_EXECUTE, GROUP_READ, GROUP_WRITE, GROUP_EXECUTE, OTHERS_READ, OTHERS_EXECUTE))); + Files.setPosixFilePermissions(file.toPath(), new HashSet<>(Arrays.asList(OWNER_READ, OWNER_WRITE, OWNER_EXECUTE, GROUP_READ, GROUP_WRITE, GROUP_EXECUTE, OTHERS_READ, OTHERS_EXECUTE))); } catch (Throwable ignore) { // Our best effort was not good enough :) diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/PasswordMaskingUtil.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/PasswordMaskingUtil.java index 99c4cba01b..6be5e054cc 100644 --- a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/PasswordMaskingUtil.java +++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/PasswordMaskingUtil.java @@ -63,7 +63,7 @@ public class PasswordMaskingUtil { }); if (parts.length > 1) { - Map props = new HashMap(); + Map props = new HashMap<>(); for (int i = 1; i < parts.length; i++) { String[] keyVal = parts[i].split("="); diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/TypedProperties.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/TypedProperties.java index 432e46ff2c..5bff66fdbe 100644 --- a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/TypedProperties.java +++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/TypedProperties.java @@ -71,7 +71,7 @@ public final class TypedProperties { } public TypedProperties(final TypedProperties other) { - properties = other.properties == null ? null : new HashMap(other.properties); + properties = other.properties == null ? null : new HashMap<>(other.properties); size = other.size; } @@ -376,7 +376,7 @@ public final class TypedProperties { else { int numHeaders = buffer.readInt(); - properties = new HashMap(numHeaders); + properties = new HashMap<>(numHeaders); size = 0; for (int i = 0; i < numHeaders; i++) { @@ -546,7 +546,7 @@ public final class TypedProperties { private void checkCreateProperties() { if (properties == null) { - properties = new HashMap(); + properties = new HashMap<>(); } } @@ -935,7 +935,7 @@ public final class TypedProperties { } public Map getMap() { - Map m = new HashMap(); + Map m = new HashMap<>(); for (Entry entry : properties.entrySet()) { Object val = entry.getValue().getValue(); if (val instanceof SimpleString) { diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/UTF8Util.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/UTF8Util.java index 18dca846c3..5af507e397 100644 --- a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/UTF8Util.java +++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/UTF8Util.java @@ -35,7 +35,7 @@ public final class UTF8Util { private static final boolean isTrace = ActiveMQUtilLogger.LOGGER.isTraceEnabled(); - private static final ThreadLocal> currenBuffer = new ThreadLocal>(); + private static final ThreadLocal> currenBuffer = new ThreadLocal<>(); public static void saveUTF(final ActiveMQBuffer out, final String str) { StringUtilBuffer buffer = UTF8Util.getThreadLocalBuffer(); @@ -149,7 +149,7 @@ public final class UTF8Util { StringUtilBuffer value; if (softReference == null) { value = new StringUtilBuffer(); - softReference = new SoftReference(value); + softReference = new SoftReference<>(value); UTF8Util.currenBuffer.set(softReference); } else { @@ -158,7 +158,7 @@ public final class UTF8Util { if (value == null) { value = new StringUtilBuffer(); - softReference = new SoftReference(value); + softReference = new SoftReference<>(value); UTF8Util.currenBuffer.set(softReference); } diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/UUIDGenerator.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/UUIDGenerator.java index df9607b919..e9878d1f60 100644 --- a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/UUIDGenerator.java +++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/UUIDGenerator.java @@ -258,7 +258,7 @@ public final class UUIDGenerator { try { networkInterfaces = NetworkInterface.getNetworkInterfaces(); - List ifaces = new ArrayList(); + List ifaces = new ArrayList<>(); while (networkInterfaces.hasMoreElements()) { ifaces.add(networkInterfaces.nextElement()); } @@ -275,7 +275,7 @@ public final class UUIDGenerator { final Method isLoopbackMethod, final Method isVirtualMethod) { ExecutorService executor = Executors.newFixedThreadPool(ifaces.size()); - Collection> tasks = new ArrayList>(ifaces.size()); + Collection> tasks = new ArrayList<>(ifaces.size()); for (final NetworkInterface networkInterface : ifaces) { tasks.add(new Callable() { diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/uri/URISchema.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/uri/URISchema.java index 335833130c..b76ceb1944 100644 --- a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/uri/URISchema.java +++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/uri/URISchema.java @@ -108,7 +108,7 @@ public abstract class URISchema { public static Map parseQuery(String uri, Map propertyOverrides) throws URISyntaxException { try { - Map rc = new HashMap(); + Map rc = new HashMap<>(); if (uri != null && !uri.isEmpty()) { String[] parameters = uri.split("&"); for (int i = 0; i < parameters.length; i++) { diff --git a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/PairTest.java b/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/PairTest.java index b441c7b92a..a45886ecaf 100644 --- a/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/PairTest.java +++ b/artemis-commons/src/test/java/org/apache/activemq/artemis/utils/PairTest.java @@ -25,7 +25,7 @@ public class PairTest extends Assert { @Test public void testPair() { - Pair p = new Pair(Integer.valueOf(12), Integer.valueOf(13)); + Pair p = new Pair<>(Integer.valueOf(12), Integer.valueOf(13)); int hash = p.hashCode(); p.setA(null); assertTrue(hash != p.hashCode()); diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/JGroupsBroadcastEndpoint.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/JGroupsBroadcastEndpoint.java index e419dfc1c7..5bcddbc548 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/JGroupsBroadcastEndpoint.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/JGroupsBroadcastEndpoint.java @@ -134,7 +134,7 @@ public abstract class JGroupsBroadcastEndpoint implements BroadcastEndpoint { */ private static final class JGroupsReceiver extends ReceiverAdapter { - private final BlockingQueue dequeue = new LinkedBlockingDeque(); + private final BlockingQueue dequeue = new LinkedBlockingDeque<>(); @Override public void receive(org.jgroups.Message msg) { @@ -160,7 +160,7 @@ public abstract class JGroupsBroadcastEndpoint implements BroadcastEndpoint { int refCount = 1; JChannel channel; String channelName; - final List receivers = new ArrayList(); + final List receivers = new ArrayList<>(); public JChannelWrapper(String channelName, JChannel channel) throws Exception { this.refCount = 1; diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/TransportConfiguration.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/TransportConfiguration.java index 3ad7a735ba..6f91537421 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/TransportConfiguration.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/TransportConfiguration.java @@ -310,7 +310,7 @@ public class TransportConfiguration implements Serializable { if (params == null) { if (num > 0) { - params = new HashMap(); + params = new HashMap<>(); } } else { diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ManagementHelper.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ManagementHelper.java index 8cd7e2ec12..fb7d88bfcf 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ManagementHelper.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/api/core/management/ManagementHelper.java @@ -209,7 +209,7 @@ public final class ManagementHelper { else if (val instanceof JSONObject) { JSONObject jsonObject = (JSONObject) val; - Map map = new HashMap(); + Map map = new HashMap<>(); Iterator iter = jsonObject.keys(); @@ -222,7 +222,7 @@ public final class ManagementHelper { innerVal = ManagementHelper.fromJSONArray(((JSONArray) innerVal)); } else if (innerVal instanceof JSONObject) { - Map innerMap = new HashMap(); + Map innerMap = new HashMap<>(); JSONObject o = (JSONObject) innerVal; Iterator it = o.keys(); while (it.hasNext()) { diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/AddressQueryImpl.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/AddressQueryImpl.java index aeec614e60..3a1f62bc6d 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/AddressQueryImpl.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/AddressQueryImpl.java @@ -34,7 +34,7 @@ public class AddressQueryImpl implements ClientSession.AddressQuery { final List queueNames, final boolean autoCreateJmsQueues) { this.exists = exists; - this.queueNames = new ArrayList(queueNames); + this.queueNames = new ArrayList<>(queueNames); this.autoCreateJmsQueues = autoCreateJmsQueues; } diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientConsumerImpl.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientConsumerImpl.java index 727ba740ee..8013b72f4b 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientConsumerImpl.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientConsumerImpl.java @@ -87,7 +87,7 @@ public final class ClientConsumerImpl implements ClientConsumerInternal { private final int ackBatchSize; - private final PriorityLinkedList buffer = new PriorityLinkedListImpl(ClientConsumerImpl.NUM_PRIORITIES); + private final PriorityLinkedList buffer = new PriorityLinkedListImpl<>(ClientConsumerImpl.NUM_PRIORITIES); private final Runner runner = new Runner(); diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientProducerCreditManagerImpl.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientProducerCreditManagerImpl.java index 229dc829bd..982ce29df9 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientProducerCreditManagerImpl.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientProducerCreditManagerImpl.java @@ -27,9 +27,9 @@ public class ClientProducerCreditManagerImpl implements ClientProducerCreditMana public static final int MAX_UNREFERENCED_CREDITS_CACHE_SIZE = 1000; - private final Map producerCredits = new LinkedHashMap(); + private final Map producerCredits = new LinkedHashMap<>(); - private final Map unReferencedCredits = new LinkedHashMap(); + private final Map unReferencedCredits = new LinkedHashMap<>(); private final ClientSessionInternal session; diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionFactoryImpl.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionFactoryImpl.java index 1a67dfff31..3b36345b9c 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionFactoryImpl.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionFactoryImpl.java @@ -97,7 +97,7 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C private final long connectionTTL; - private final Set sessions = new HashSet(); + private final Set sessions = new HashSet<>(); private final Object createSessionLock = new Object(); @@ -123,9 +123,9 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C private int reconnectAttempts; - private final Set listeners = new ConcurrentHashSet(); + private final Set listeners = new ConcurrentHashSet<>(); - private final Set failoverListeners = new ConcurrentHashSet(); + private final Set failoverListeners = new ConcurrentHashSet<>(); private Connector connector; @@ -222,7 +222,7 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C confirmationWindowWarning = new ConfirmationWindowWarning(serverLocator.getConfirmationWindowSize() < 0); - lifeCycleListeners = new HashSet(); + lifeCycleListeners = new HashSet<>(); connectionReadyForWrites = true; } @@ -456,7 +456,7 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C private void closeCleanSessions(boolean close) { HashSet sessionsToClose; synchronized (sessions) { - sessionsToClose = new HashSet(sessions); + sessionsToClose = new HashSet<>(sessions); } // work on a copied set. the session will be removed from sessions when session.close() is // called @@ -633,7 +633,7 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C if (connection == null) { synchronized (sessions) { - sessionsToClose = new HashSet(sessions); + sessionsToClose = new HashSet<>(sessions); } callFailoverListeners(FailoverEventType.FAILOVER_FAILED); callSessionFailureListeners(me, true, false, scaleDownTargetNodeID); @@ -697,7 +697,7 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C final boolean afterReconnect, final boolean failedOver, final String scaleDownTargetNodeID) { - final List listenersClone = new ArrayList(listeners); + final List listenersClone = new ArrayList<>(listeners); for (final SessionFailureListener listener : listenersClone) { try { @@ -741,7 +741,7 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C final ActiveMQException cause) { HashSet sessionsToFailover; synchronized (sessions) { - sessionsToFailover = new HashSet(sessions); + sessionsToFailover = new HashSet<>(sessions); } for (ClientSessionInternal session : sessionsToFailover) { @@ -1195,7 +1195,7 @@ public class ClientSessionFactoryImpl implements ClientSessionFactoryInternal, C private final WeakReference pingRunnable; ActualScheduledPinger(final PingRunnable runnable) { - pingRunnable = new WeakReference(runnable); + pingRunnable = new WeakReference<>(runnable); } @Override diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionImpl.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionImpl.java index 2942b8c2dd..ca7e7672c2 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionImpl.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionImpl.java @@ -54,7 +54,7 @@ import org.apache.activemq.artemis.utils.XidCodecSupport; public final class ClientSessionImpl implements ClientSessionInternal, FailureListener { - private final Map metadata = new HashMap(); + private final Map metadata = new HashMap<>(); private final ClientSessionFactoryInternal sessionFactory; @@ -74,10 +74,10 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi /** * All access to producers are guarded (i.e. synchronized) on itself. */ - private final Set producers = new HashSet(); + private final Set producers = new HashSet<>(); // Consumers must be an ordered map so if we fail we recreate them in the same order with the same ids - private final Map consumers = new LinkedHashMap(); + private final Map consumers = new LinkedHashMap<>(); private volatile boolean closed; @@ -1012,7 +1012,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi HashMap metaDataToSend; synchronized (metadata) { - metaDataToSend = new HashMap(metadata); + metaDataToSend = new HashMap<>(metadata); } sessionContext.resetMetadata(metaDataToSend); @@ -1652,7 +1652,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi Set producersClone; synchronized (producers) { - producersClone = new HashSet(producers); + producersClone = new HashSet<>(producers); } return producersClone; } @@ -1664,7 +1664,7 @@ public final class ClientSessionImpl implements ClientSessionInternal, FailureLi */ public Set cloneConsumers() { synchronized (consumers) { - return new HashSet(consumers.values()); + return new HashSet<>(consumers.values()); } } diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/DelegatingSession.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/DelegatingSession.java index 95bb26f7e5..dde59d2d17 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/DelegatingSession.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/DelegatingSession.java @@ -51,7 +51,7 @@ public class DelegatingSession implements ClientSessionInternal { private volatile boolean closed; - private static Set sessions = new ConcurrentHashSet(); + private static Set sessions = new ConcurrentHashSet<>(); public static volatile boolean debug; diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ServerLocatorImpl.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ServerLocatorImpl.java index 0a608a1298..a483f5d4ad 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ServerLocatorImpl.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/ServerLocatorImpl.java @@ -90,9 +90,9 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery private transient String identity; - private final Set factories = new HashSet(); + private final Set factories = new HashSet<>(); - private final Set connectingFactories = new HashSet(); + private final Set connectingFactories = new HashSet<>(); private volatile TransportConfiguration[] initialConnectors; @@ -183,9 +183,9 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery private transient STATE state; private transient CountDownLatch latch; - private final List incomingInterceptors = new CopyOnWriteArrayList(); + private final List incomingInterceptors = new CopyOnWriteArrayList<>(); - private final List outgoingInterceptors = new CopyOnWriteArrayList(); + private final List outgoingInterceptors = new CopyOnWriteArrayList<>(); private static ExecutorService globalThreadPool; @@ -1427,7 +1427,7 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery Set clonedFactory; synchronized (factories) { - clonedFactory = new HashSet(factories); + clonedFactory = new HashSet<>(factories); factories.clear(); } @@ -1536,7 +1536,7 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery TopologyMember actMember = topology.getMember(nodeID); if (actMember != null && actMember.getLive() != null && actMember.getBackup() != null) { - HashSet clonedFactories = new HashSet(); + HashSet clonedFactories = new HashSet<>(); synchronized (factories) { clonedFactories.addAll(factories); } @@ -1802,7 +1802,7 @@ public final class ServerLocatorImpl implements ServerLocatorInternal, Discovery } } } - connectors = new ArrayList(); + connectors = new ArrayList<>(); if (initialConnectors != null) { for (TransportConfiguration initialConnector : initialConnectors) { ClientSessionFactoryInternal factory = new ClientSessionFactoryImpl(ServerLocatorImpl.this, initialConnector, callTimeout, callFailoverTimeout, clientFailureCheckPeriod, connectionTTL, retryInterval, retryIntervalMultiplier, maxRetryInterval, reconnectAttempts, threadPool, scheduledThreadPool, incomingInterceptors, outgoingInterceptors); diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/Topology.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/Topology.java index 35bfb5d861..526d9f0100 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/Topology.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/Topology.java @@ -345,7 +345,7 @@ public final class Topology { final Map copy; synchronized (Topology.this) { - copy = new HashMap(topology); + copy = new HashMap<>(topology); } for (Map.Entry entry : copy.entrySet()) { diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/TopologyMemberImpl.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/TopologyMemberImpl.java index 1696efca61..50bb50b42e 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/TopologyMemberImpl.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/client/impl/TopologyMemberImpl.java @@ -46,7 +46,7 @@ public final class TopologyMemberImpl implements TopologyMember { this.nodeId = nodeId; this.backupGroupName = backupGroupName; this.scaleDownGroupName = scaleDownGroupName; - this.connector = new Pair(a, b); + this.connector = new Pair<>(a, b); uniqueEventID = System.currentTimeMillis(); } diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/cluster/DiscoveryGroup.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/cluster/DiscoveryGroup.java index 4a91f65063..40b48a6fd8 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/cluster/DiscoveryGroup.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/cluster/DiscoveryGroup.java @@ -49,7 +49,7 @@ public final class DiscoveryGroup implements ActiveMQComponent { private static final boolean isTrace = ActiveMQClientLogger.LOGGER.isTraceEnabled(); - private final List listeners = new ArrayList(); + private final List listeners = new ArrayList<>(); private final String name; @@ -59,7 +59,7 @@ public final class DiscoveryGroup implements ActiveMQComponent { private final Object waitLock = new Object(); - private final Map connectors = new ConcurrentHashMap(); + private final Map connectors = new ConcurrentHashMap<>(); private final long timeout; @@ -67,7 +67,7 @@ public final class DiscoveryGroup implements ActiveMQComponent { private final String nodeID; - private final Map uniqueIDMap = new HashMap(); + private final Map uniqueIDMap = new HashMap<>(); private final BroadcastEndpoint endpoint; @@ -192,7 +192,7 @@ public final class DiscoveryGroup implements ActiveMQComponent { } public synchronized List getDiscoveryEntries() { - List list = new ArrayList(connectors.values()); + List list = new ArrayList<>(connectors.values()); return list; } diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/message/impl/MessageImpl.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/message/impl/MessageImpl.java index 1d82beecdc..f27402eae7 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/message/impl/MessageImpl.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/message/impl/MessageImpl.java @@ -408,7 +408,7 @@ public abstract class MessageImpl implements MessageInternal { @Override public Map toMap() { - Map map = new HashMap(); + Map map = new HashMap<>(); map.put("messageID", messageID); if (userID != null) { diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ChannelImpl.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ChannelImpl.java index b152156987..a0985fc965 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ChannelImpl.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ChannelImpl.java @@ -130,7 +130,7 @@ public final class ChannelImpl implements Channel { this.confWindowSize = confWindowSize; if (confWindowSize != -1) { - resendCache = new ConcurrentLinkedQueue(); + resendCache = new ConcurrentLinkedQueue<>(); } else { resendCache = null; diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/RemotingConnectionImpl.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/RemotingConnectionImpl.java index a19c3f325d..1cb4f2a8b4 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/RemotingConnectionImpl.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/RemotingConnectionImpl.java @@ -52,7 +52,7 @@ public class RemotingConnectionImpl extends AbstractRemotingConnection implement // ----------------------------------------------------------------------------------- private final PacketDecoder packetDecoder; - private final Map channels = new ConcurrentHashMap(); + private final Map channels = new ConcurrentHashMap<>(); private final long blockingCallTimeout; @@ -246,7 +246,7 @@ public class RemotingConnectionImpl extends AbstractRemotingConnection implement // method is // complete - Set allChannels = new HashSet(channels.values()); + Set allChannels = new HashSet<>(channels.values()); if (!criticalError) { removeAllChannels(); diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/ClusterTopologyChangeMessage.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/ClusterTopologyChangeMessage.java index f0195764b5..48c786281b 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/ClusterTopologyChangeMessage.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/ClusterTopologyChangeMessage.java @@ -132,7 +132,7 @@ public class ClusterTopologyChangeMessage extends PacketImpl { else { b = null; } - pair = new Pair(a, b); + pair = new Pair<>(a, b); last = buffer.readBoolean(); } } diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/ClusterTopologyChangeMessage_V2.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/ClusterTopologyChangeMessage_V2.java index 76860e1f56..a39dda901a 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/ClusterTopologyChangeMessage_V2.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/ClusterTopologyChangeMessage_V2.java @@ -126,7 +126,7 @@ public class ClusterTopologyChangeMessage_V2 extends ClusterTopologyChangeMessag else { b = null; } - pair = new Pair(a, b); + pair = new Pair<>(a, b); last = buffer.readBoolean(); } if (buffer.readableBytes() > 0) { diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionBindingQueryResponseMessage.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionBindingQueryResponseMessage.java index 7d77edcc1c..65a0d254b2 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionBindingQueryResponseMessage.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionBindingQueryResponseMessage.java @@ -74,7 +74,7 @@ public class SessionBindingQueryResponseMessage extends PacketImpl { public void decodeRest(final ActiveMQBuffer buffer) { exists = buffer.readBoolean(); int numQueues = buffer.readInt(); - queueNames = new ArrayList(numQueues); + queueNames = new ArrayList<>(numQueues); for (int i = 0; i < numQueues; i++) { queueNames.add(buffer.readSimpleString()); } diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionXAGetInDoubtXidsResponseMessage.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionXAGetInDoubtXidsResponseMessage.java index 92260b136b..a78bad4a75 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionXAGetInDoubtXidsResponseMessage.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionXAGetInDoubtXidsResponseMessage.java @@ -60,7 +60,7 @@ public class SessionXAGetInDoubtXidsResponseMessage extends PacketImpl { @Override public void decodeRest(final ActiveMQBuffer buffer) { int len = buffer.readInt(); - xids = new ArrayList(len); + xids = new ArrayList<>(len); for (int i = 0; i < len; i++) { Xid xid = XidCodecSupport.decodeXid(buffer); diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/TransportConfigurationUtil.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/TransportConfigurationUtil.java index 60b8336521..cfadcfa633 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/TransportConfigurationUtil.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/TransportConfigurationUtil.java @@ -76,7 +76,7 @@ public class TransportConfigurationUtil { } private static Map cloneDefaults(Map defaults) { - Map cloned = new HashMap(); + Map cloned = new HashMap<>(); for (Map.Entry entry : defaults.entrySet()) { cloned.put((String) entry.getKey(), entry.getValue()); } diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnection.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnection.java index 2c1f1c8f00..6f2f792550 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnection.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnection.java @@ -65,7 +65,7 @@ public class NettyConnection implements Connection { private final Semaphore writeLock = new Semaphore(1); - private final Set readyListeners = new ConcurrentHashSet(); + private final Set readyListeners = new ConcurrentHashSet<>(); private RemotingConnection protocolConnection; diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnector.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnector.java index 60d913ce6c..3f5624880f 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnector.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnector.java @@ -135,7 +135,7 @@ public class NettyConnector extends AbstractConnector { ResourceLeakDetector.setEnabled(false); // Set default Configuration - Map config = new HashMap(); + Map config = new HashMap<>(); config.put(TransportConstants.HOST_PROP_NAME, TransportConstants.DEFAULT_HOST); config.put(TransportConstants.PORT_PROP_NAME, TransportConstants.DEFAULT_PORT); DEFAULT_CONFIG = Collections.unmodifiableMap(config); @@ -202,7 +202,7 @@ public class NettyConnector extends AbstractConnector { private long batchDelay; - private ConcurrentMap connections = new ConcurrentHashMap(); + private ConcurrentMap connections = new ConcurrentHashMap<>(); private String servletPath; diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/SharedNioEventLoopGroup.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/SharedNioEventLoopGroup.java index 7656130ccc..b9b1a31bce 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/SharedNioEventLoopGroup.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/SharedNioEventLoopGroup.java @@ -36,7 +36,7 @@ public class SharedNioEventLoopGroup extends NioEventLoopGroup { private static SharedNioEventLoopGroup instance; - private final AtomicReference> shutdown = new AtomicReference>(); + private final AtomicReference> shutdown = new AtomicReference<>(); private final AtomicLong nioChannelFactoryCount = new AtomicLong(); private final Promise terminationPromise = ImmediateEventExecutor.INSTANCE.newPromise(); diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/TransportConstants.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/TransportConstants.java index b241ac50d4..f373639f93 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/TransportConstants.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/TransportConstants.java @@ -200,7 +200,7 @@ public class TransportConstants { public static final long DEFAULT_CONNECTIONS_ALLOWED = -1L; static { - Set allowableAcceptorKeys = new HashSet(); + Set allowableAcceptorKeys = new HashSet<>(); allowableAcceptorKeys.add(TransportConstants.SSL_ENABLED_PROP_NAME); allowableAcceptorKeys.add(TransportConstants.HTTP_RESPONSE_TIME_PROP_NAME); allowableAcceptorKeys.add(TransportConstants.HTTP_SERVER_SCAN_PERIOD_PROP_NAME); @@ -237,7 +237,7 @@ public class TransportConstants { ALLOWABLE_ACCEPTOR_KEYS = Collections.unmodifiableSet(allowableAcceptorKeys); - Set allowableConnectorKeys = new HashSet(); + Set allowableConnectorKeys = new HashSet<>(); allowableConnectorKeys.add(TransportConstants.SSL_ENABLED_PROP_NAME); allowableConnectorKeys.add(TransportConstants.HTTP_ENABLED_PROP_NAME); allowableConnectorKeys.add(TransportConstants.HTTP_CLIENT_IDLE_PROP_NAME); diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/reader/MessageUtil.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/reader/MessageUtil.java index b56abc4be0..f61384df7a 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/reader/MessageUtil.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/reader/MessageUtil.java @@ -124,7 +124,7 @@ public class MessageUtil { public static void clearProperties(Message message) { - List toRemove = new ArrayList(); + List toRemove = new ArrayList<>(); for (SimpleString propName : message.getPropertyNames()) { if (!propName.startsWith(JMS) || propName.startsWith(JMSX) || @@ -139,7 +139,7 @@ public class MessageUtil { } public static Set getPropertyNames(Message message) { - HashSet set = new HashSet(); + HashSet set = new HashSet<>(); for (SimpleString propName : message.getPropertyNames()) { if ((!propName.startsWith(JMS) || propName.startsWith(JMSX) || diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/protocol/AbstractRemotingConnection.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/protocol/AbstractRemotingConnection.java index 7670740e57..32df48c77e 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/protocol/AbstractRemotingConnection.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/protocol/AbstractRemotingConnection.java @@ -32,8 +32,8 @@ import org.apache.activemq.artemis.spi.core.remoting.Connection; public abstract class AbstractRemotingConnection implements RemotingConnection { - protected final List failureListeners = new CopyOnWriteArrayList(); - protected final List closeListeners = new CopyOnWriteArrayList(); + protected final List failureListeners = new CopyOnWriteArrayList<>(); + protected final List closeListeners = new CopyOnWriteArrayList<>(); protected final Connection transportConnection; protected final Executor executor; protected final long creationTime; @@ -47,11 +47,11 @@ public abstract class AbstractRemotingConnection implements RemotingConnection { @Override public List getFailureListeners() { - return new ArrayList(failureListeners); + return new ArrayList<>(failureListeners); } protected void callFailureListeners(final ActiveMQException me, String scaleDownTargetNodeID) { - final List listenersClone = new ArrayList(failureListeners); + final List listenersClone = new ArrayList<>(failureListeners); for (final FailureListener listener : listenersClone) { try { @@ -71,7 +71,7 @@ public abstract class AbstractRemotingConnection implements RemotingConnection { } protected void callClosingListeners() { - final List listenersClone = new ArrayList(closeListeners); + final List listenersClone = new ArrayList<>(closeListeners); for (final CloseListener listener : listenersClone) { try { @@ -140,7 +140,7 @@ public abstract class AbstractRemotingConnection implements RemotingConnection { @Override public List removeCloseListeners() { - List ret = new ArrayList(closeListeners); + List ret = new ArrayList<>(closeListeners); closeListeners.clear(); diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/ConfigurationHelper.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/ConfigurationHelper.java index 76326b68cc..8771451135 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/ConfigurationHelper.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/ConfigurationHelper.java @@ -124,7 +124,7 @@ public class ConfigurationHelper { } public static Set checkKeys(final Set allowableKeys, final Set keys) { - Set invalid = new HashSet(); + Set invalid = new HashSet<>(); for (String key : keys) { if (!allowableKeys.contains(key)) { @@ -135,7 +135,7 @@ public class ConfigurationHelper { } public static Set checkKeysExist(final Set requiredKeys, final Set keys) { - Set invalid = new HashSet(requiredKeys); + Set invalid = new HashSet<>(requiredKeys); for (String key : keys) { if (requiredKeys.contains(key)) { diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/LinkedListImpl.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/LinkedListImpl.java index e455db8464..4262274532 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/LinkedListImpl.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/LinkedListImpl.java @@ -29,7 +29,7 @@ public class LinkedListImpl implements LinkedList { private static final int INITIAL_ITERATOR_ARRAY_SIZE = 10; - private final Node head = new Node(null); + private final Node head = new Node<>(null); private Node tail = null; @@ -48,7 +48,7 @@ public class LinkedListImpl implements LinkedList { @Override public void addHead(E e) { - Node node = new Node(e); + Node node = new Node<>(e); node.next = head.next; @@ -73,7 +73,7 @@ public class LinkedListImpl implements LinkedList { addHead(e); } else { - Node node = new Node(e); + Node node = new Node<>(e); node.prev = tail; diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/MemorySize.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/MemorySize.java index dfb3f01e41..b3e47cc2b7 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/MemorySize.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/MemorySize.java @@ -105,7 +105,7 @@ public class MemorySize { } private static void forceGC() { - WeakReference dumbReference = new WeakReference(new Object()); + WeakReference dumbReference = new WeakReference<>(new Object()); // A loop that will wait GC, using the minimal time as possible while (dumbReference.get() != null) { System.gc(); diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/OrderedExecutorFactory.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/OrderedExecutorFactory.java index 949970bdfc..74755260d0 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/OrderedExecutorFactory.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/OrderedExecutorFactory.java @@ -56,7 +56,7 @@ public final class OrderedExecutorFactory implements ExecutorFactory { */ private static final class OrderedExecutor implements Executor { - private final ConcurrentLinkedQueue tasks = new ConcurrentLinkedQueue(); + private final ConcurrentLinkedQueue tasks = new ConcurrentLinkedQueue<>(); // @protected by tasks private boolean running; diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/PriorityLinkedListImpl.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/PriorityLinkedListImpl.java index 6556ef57d8..06b24326ef 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/PriorityLinkedListImpl.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/PriorityLinkedListImpl.java @@ -40,7 +40,7 @@ public class PriorityLinkedListImpl implements PriorityLinkedList { levels = (LinkedListImpl[]) Array.newInstance(LinkedListImpl.class, priorities); for (int i = 0; i < priorities; i++) { - levels[i] = new LinkedListImpl(); + levels[i] = new LinkedListImpl<>(); } } diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/SecurityFormatter.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/SecurityFormatter.java index d79f7d6732..1df12b1b82 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/SecurityFormatter.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/SecurityFormatter.java @@ -40,7 +40,7 @@ public class SecurityFormatter { List consume = toList(consumeRoles); List manage = toList(manageRoles); - Set allRoles = new HashSet(); + Set allRoles = new HashSet<>(); allRoles.addAll(createDurableQueue); allRoles.addAll(deleteDurableQueue); allRoles.addAll(createNonDurableQueue); @@ -49,7 +49,7 @@ public class SecurityFormatter { allRoles.addAll(consume); allRoles.addAll(manage); - Set roles = new HashSet(allRoles.size()); + Set roles = new HashSet<>(allRoles.size()); for (String role : allRoles) { roles.add(new Role(role, send.contains(role), consume.contains(role), createDurableQueue.contains(role), deleteDurableQueue.contains(role), createNonDurableQueue.contains(role), deleteNonDurableQueue.contains(role), manageRoles.contains(role))); } @@ -57,7 +57,7 @@ public class SecurityFormatter { } private static List toList(final String commaSeparatedString) { - List list = new ArrayList(); + List list = new ArrayList<>(); if (commaSeparatedString == null || commaSeparatedString.trim().length() == 0) { return list; } diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/SoftValueHashMap.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/SoftValueHashMap.java index 19ea7dd9b8..4cfbfa407f 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/SoftValueHashMap.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/SoftValueHashMap.java @@ -36,9 +36,9 @@ public class SoftValueHashMap implemen // The soft references that are already good. // too bad there's no way to override the queue method on ReferenceQueue, so I wouldn't need this - private final ReferenceQueue refQueue = new ReferenceQueue(); + private final ReferenceQueue refQueue = new ReferenceQueue<>(); - private final Map mapDelegate = new HashMap(); + private final Map mapDelegate = new HashMap<>(); private final AtomicLong usedCounter = new AtomicLong(0); @@ -156,7 +156,7 @@ public class SoftValueHashMap implemen private void checkCacheSize() { if (maxElements > 0 && mapDelegate.size() > maxElements) { - TreeSet usedReferences = new TreeSet(new ComparatorAgregated()); + TreeSet usedReferences = new TreeSet<>(new ComparatorAgregated()); for (AggregatedSoftReference ref : mapDelegate.values()) { V v = ref.get(); @@ -260,7 +260,7 @@ public class SoftValueHashMap implemen @Override public Collection values() { processQueue(); - ArrayList list = new ArrayList(); + ArrayList list = new ArrayList<>(); for (AggregatedSoftReference refs : mapDelegate.values()) { V value = refs.get(); @@ -278,11 +278,11 @@ public class SoftValueHashMap implemen @Override public Set> entrySet() { processQueue(); - HashSet> set = new HashSet>(); + HashSet> set = new HashSet<>(); for (Map.Entry pair : mapDelegate.entrySet()) { V value = pair.getValue().get(); if (value != null) { - set.add(new EntryElement(pair.getKey(), value)); + set.add(new EntryElement<>(pair.getKey(), value)); } } return set; diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/VersionLoader.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/VersionLoader.java index ace62c86eb..a0efdb5e5c 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/VersionLoader.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/VersionLoader.java @@ -118,7 +118,7 @@ public final class VersionLoader { int microVersion = Integer.valueOf(versionProps.getProperty("activemq.version.microVersion")); int[] incrementingVersions = parseCompatibleVersionList(versionProps.getProperty("activemq.version.incrementingVersion")); int[] compatibleVersionArray = parseCompatibleVersionList(versionProps.getProperty("activemq.version.compatibleVersionList")); - List definedVersions = new ArrayList(incrementingVersions.length); + List definedVersions = new ArrayList<>(incrementingVersions.length); for (int incrementingVersion : incrementingVersions) { definedVersions.add(new VersionImpl(versionName, majorVersion, minorVersion, microVersion, incrementingVersion, compatibleVersionArray)); } diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/XMLUtil.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/XMLUtil.java index d8b9e6a418..5634207132 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/XMLUtil.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/XMLUtil.java @@ -413,7 +413,7 @@ public final class XMLUtil { } private static List filter(final NodeList nl, final short[] typesToFilter) { - List nodes = new ArrayList(); + List nodes = new ArrayList<>(); outer: for (int i = 0; i < nl.getLength(); i++) { diff --git a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/json/JSONArray.java b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/json/JSONArray.java index 0cbaf72ad4..b70bd214c6 100644 --- a/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/json/JSONArray.java +++ b/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/json/JSONArray.java @@ -87,7 +87,7 @@ public class JSONArray { * Construct an empty JSONArray. */ public JSONArray() { - myArrayList = new ArrayList(); + myArrayList = new ArrayList<>(); } /** @@ -161,7 +161,7 @@ public class JSONArray { * @param collection A Collection. */ public JSONArray(final Collection collection) { - myArrayList = collection == null ? new ArrayList() : new ArrayList(collection); + myArrayList = collection == null ? new ArrayList<>() : new ArrayList<>(collection); } /** @@ -169,7 +169,7 @@ public class JSONArray { * The collection should have Java Beans. */ public JSONArray(final Collection collection, final boolean includeSuperClass) { - myArrayList = collection == null ? new ArrayList() : new ArrayList(collection.size()); + myArrayList = collection == null ? new ArrayList<>() : new ArrayList<>(collection.size()); if (collection != null) { Iterator iter = collection.iterator(); while (iter.hasNext()) { diff --git a/artemis-core-client/src/test/java/org/apache/activemq/artemis/util/CompressionUtilTest.java b/artemis-core-client/src/test/java/org/apache/activemq/artemis/util/CompressionUtilTest.java index aaeb57801e..f5d4c423ba 100644 --- a/artemis-core-client/src/test/java/org/apache/activemq/artemis/util/CompressionUtilTest.java +++ b/artemis-core-client/src/test/java/org/apache/activemq/artemis/util/CompressionUtilTest.java @@ -43,7 +43,7 @@ public class CompressionUtilTest extends Assert { AtomicLong counter = new AtomicLong(0); DeflaterReader reader = new DeflaterReader(inputStream, counter); - ArrayList zipHolder = new ArrayList(); + ArrayList zipHolder = new ArrayList<>(); int b = reader.read(); while (b != -1) { @@ -79,7 +79,7 @@ public class CompressionUtilTest extends Assert { DeflaterReader reader = new DeflaterReader(inputStream, counter); byte[] buffer = new byte[7]; - ArrayList zipHolder = new ArrayList(); + ArrayList zipHolder = new ArrayList<>(); int n = reader.read(buffer); while (n != -1) { @@ -122,7 +122,7 @@ public class CompressionUtilTest extends Assert { ByteArrayInputStream byteInput = new ByteArrayInputStream(zipBytes); InflaterReader inflater = new InflaterReader(byteInput); - ArrayList holder = new ArrayList(); + ArrayList holder = new ArrayList<>(); int read = inflater.read(); while (read != -1) { diff --git a/artemis-core-client/src/test/java/org/apache/activemq/artemis/util/ConcurrentHashSetTest.java b/artemis-core-client/src/test/java/org/apache/activemq/artemis/util/ConcurrentHashSetTest.java index 8a2e40b4ee..6c97afdd0c 100644 --- a/artemis-core-client/src/test/java/org/apache/activemq/artemis/util/ConcurrentHashSetTest.java +++ b/artemis-core-client/src/test/java/org/apache/activemq/artemis/util/ConcurrentHashSetTest.java @@ -117,7 +117,7 @@ public class ConcurrentHashSetTest extends Assert { @Before public void setUp() throws Exception { - set = new ConcurrentHashSet(); + set = new ConcurrentHashSet<>(); element = RandomUtil.randomString(); } diff --git a/artemis-core-client/src/test/java/org/apache/activemq/artemis/util/TimeAndCounterIDGeneratorTest.java b/artemis-core-client/src/test/java/org/apache/activemq/artemis/util/TimeAndCounterIDGeneratorTest.java index 923a9f3de1..671261e5cc 100644 --- a/artemis-core-client/src/test/java/org/apache/activemq/artemis/util/TimeAndCounterIDGeneratorTest.java +++ b/artemis-core-client/src/test/java/org/apache/activemq/artemis/util/TimeAndCounterIDGeneratorTest.java @@ -73,7 +73,7 @@ public class TimeAndCounterIDGeneratorTest extends Assert { @Test public void testCalculationOnMultiThread() throws Throwable { - final ConcurrentHashSet hashSet = new ConcurrentHashSet(); + final ConcurrentHashSet hashSet = new ConcurrentHashSet<>(); final TimeAndCounterIDGenerator seq = new TimeAndCounterIDGenerator(); diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQConnection.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQConnection.java index 60de2d7818..19e5b677dd 100644 --- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQConnection.java +++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQConnection.java @@ -79,11 +79,11 @@ public class ActiveMQConnection extends ActiveMQConnectionForContextImpl impleme private final int connectionType; - private final Set sessions = new ConcurrentHashSet(); + private final Set sessions = new ConcurrentHashSet<>(); - private final Set tempQueues = new ConcurrentHashSet(); + private final Set tempQueues = new ConcurrentHashSet<>(); - private final Set knownDestinations = new ConcurrentHashSet(); + private final Set knownDestinations = new ConcurrentHashSet<>(); private volatile boolean hasNoLocal; @@ -327,7 +327,7 @@ public class ActiveMQConnection extends ActiveMQConnectionForContextImpl impleme sessionFactory.close(); try { - for (ActiveMQSession session : new HashSet(sessions)) { + for (ActiveMQSession session : new HashSet<>(sessions)) { session.close(); } @@ -689,7 +689,7 @@ public class ActiveMQConnection extends ActiveMQConnectionForContextImpl impleme private final WeakReference connectionRef; JMSFailureListener(final ActiveMQConnection connection) { - connectionRef = new WeakReference(connection); + connectionRef = new WeakReference<>(connection); } @Override @@ -742,7 +742,7 @@ public class ActiveMQConnection extends ActiveMQConnectionForContextImpl impleme private final WeakReference connectionRef; FailoverEventListenerImpl(final ActiveMQConnection connection) { - connectionRef = new WeakReference(connection); + connectionRef = new WeakReference<>(connection); } @Override diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQConnectionMetaData.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQConnectionMetaData.java index 628281b652..8a1491516e 100644 --- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQConnectionMetaData.java +++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQConnectionMetaData.java @@ -86,7 +86,7 @@ public class ActiveMQConnectionMetaData implements ConnectionMetaData { @Override public Enumeration getJMSXPropertyNames() throws JMSException { - Vector v = new Vector(); + Vector v = new Vector<>(); v.add("JMSXGroupID"); v.add("JMSXGroupSeq"); v.add("JMSXDeliveryCount"); diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQDestination.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQDestination.java index f803ff630d..e77a48b930 100644 --- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQDestination.java +++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQDestination.java @@ -202,7 +202,7 @@ public class ActiveMQDestination implements Destination, Serializable, Reference throw new JMSRuntimeException("Invalid message queue name: " + queueName); } - Pair pair = new Pair(parts[0].toString(), parts[1].toString()); + Pair pair = new Pair<>(parts[0].toString(), parts[1].toString()); return pair; } diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQJMSProducer.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQJMSProducer.java index cd86e8619d..6e37a86214 100644 --- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQJMSProducer.java +++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQJMSProducer.java @@ -553,7 +553,7 @@ public final class ActiveMQJMSProducer implements JMSProducer { public Set getPropertyNames() { try { Set simplePropNames = properties.getPropertyNames(); - Set propNames = new HashSet(simplePropNames.size()); + Set propNames = new HashSet<>(simplePropNames.size()); for (SimpleString str : simplePropNames) { propNames.add(str.toString()); diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMapMessage.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMapMessage.java index b3112a7bb5..d067593b1c 100644 --- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMapMessage.java +++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMapMessage.java @@ -314,7 +314,7 @@ public final class ActiveMQMapMessage extends ActiveMQMessage implements MapMess @Override public Enumeration getMapNames() throws JMSException { Set simplePropNames = map.getPropertyNames(); - Set propNames = new HashSet(simplePropNames.size()); + Set propNames = new HashSet<>(simplePropNames.size()); for (SimpleString str : simplePropNames) { propNames.add(str.toString()); diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessage.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessage.java index 6dfdf7c526..528a8a3e49 100644 --- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessage.java +++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessage.java @@ -57,7 +57,7 @@ public class ActiveMQMessage implements javax.jms.Message { public static final byte TYPE = org.apache.activemq.artemis.api.core.Message.DEFAULT_TYPE; public static Map coreMaptoJMSMap(final Map coreMessage) { - Map jmsMessage = new HashMap(); + Map jmsMessage = new HashMap<>(); String deliveryMode = (Boolean) coreMessage.get("durable") ? "PERSISTENT" : "NON_PERSISTENT"; byte priority = (Byte) coreMessage.get("priority"); @@ -95,7 +95,7 @@ public class ActiveMQMessage implements javax.jms.Message { // Static -------------------------------------------------------- - private static final HashSet reservedIdentifiers = new HashSet(); + private static final HashSet reservedIdentifiers = new HashSet<>(); static { ActiveMQMessage.reservedIdentifiers.add("NULL"); diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQSession.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQSession.java index 758cb9029d..e2a1fca17f 100644 --- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQSession.java +++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQSession.java @@ -90,7 +90,7 @@ public class ActiveMQSession implements QueueSession, TopicSession { private boolean recoverCalled; - private final Set consumers = new HashSet(); + private final Set consumers = new HashSet<>(); // Constructors -------------------------------------------------- @@ -240,7 +240,7 @@ public class ActiveMQSession implements QueueSession, TopicSession { connection.getThreadAwareContext().assertNotMessageListenerThread(); synchronized (connection) { try { - for (ActiveMQMessageConsumer cons : new HashSet(consumers)) { + for (ActiveMQMessageConsumer cons : new HashSet<>(consumers)) { cons.close(); } diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/SelectorTranslator.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/SelectorTranslator.java index d227f89a5d..5dcd7c3dbc 100644 --- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/SelectorTranslator.java +++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/SelectorTranslator.java @@ -60,7 +60,7 @@ public class SelectorTranslator { int matchPos = 0; - List positions = new ArrayList(); + List positions = new ArrayList<>(); boolean replaceInQuotes = match.charAt(0) == quote; diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ThreadAwareContext.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ThreadAwareContext.java index 10624ceb94..602704d026 100644 --- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ThreadAwareContext.java +++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ThreadAwareContext.java @@ -39,7 +39,7 @@ public class ThreadAwareContext { * Use a set because JMSContext can create more than one JMSConsumer * to receive asynchronously from different destinations. */ - private Set messageListenerThreads = new ConcurrentHashSet(); + private Set messageListenerThreads = new ConcurrentHashSet<>(); /** * Sets current thread to the context diff --git a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jndi/ReadOnlyContext.java b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jndi/ReadOnlyContext.java index e94377d584..97d02a6a18 100644 --- a/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jndi/ReadOnlyContext.java +++ b/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jndi/ReadOnlyContext.java @@ -74,17 +74,17 @@ public class ReadOnlyContext implements Context, Serializable { private String nameInNamespace = ""; public ReadOnlyContext() { - environment = new Hashtable(); - bindings = new HashMap(); - treeBindings = new HashMap(); + environment = new Hashtable<>(); + bindings = new HashMap<>(); + treeBindings = new HashMap<>(); } public ReadOnlyContext(Hashtable env) { if (env == null) { - this.environment = new Hashtable(); + this.environment = new Hashtable<>(); } else { - this.environment = new Hashtable(env); + this.environment = new Hashtable<>(env); } this.bindings = Collections.EMPTY_MAP; this.treeBindings = Collections.EMPTY_MAP; @@ -92,13 +92,13 @@ public class ReadOnlyContext implements Context, Serializable { public ReadOnlyContext(Hashtable environment, Map bindings) { if (environment == null) { - this.environment = new Hashtable(); + this.environment = new Hashtable<>(); } else { - this.environment = new Hashtable(environment); + this.environment = new Hashtable<>(environment); } - this.bindings = new HashMap(); - treeBindings = new HashMap(); + this.bindings = new HashMap<>(); + treeBindings = new HashMap<>(); if (bindings != null) { for (Map.Entry binding : bindings.entrySet()) { try { @@ -120,7 +120,7 @@ public class ReadOnlyContext implements Context, Serializable { protected ReadOnlyContext(ReadOnlyContext clone, Hashtable env) { this.bindings = clone.bindings; this.treeBindings = clone.treeBindings; - this.environment = new Hashtable(env); + this.environment = new Hashtable<>(env); } protected ReadOnlyContext(ReadOnlyContext clone, Hashtable env, String nameInNamespace) { @@ -155,7 +155,7 @@ public class ReadOnlyContext implements Context, Serializable { assert name != null && name.length() > 0; assert !frozen; - Map newBindings = new HashMap(); + Map newBindings = new HashMap<>(); int pos = name.indexOf('/'); if (pos == -1) { if (treeBindings.put(name, value) != null) { diff --git a/artemis-jms-client/src/test/java/org/apache/activemq/artemis/uri/ConnectionFactoryURITest.java b/artemis-jms-client/src/test/java/org/apache/activemq/artemis/uri/ConnectionFactoryURITest.java index 4e88e700cb..9f0fd18604 100644 --- a/artemis-jms-client/src/test/java/org/apache/activemq/artemis/uri/ConnectionFactoryURITest.java +++ b/artemis-jms-client/src/test/java/org/apache/activemq/artemis/uri/ConnectionFactoryURITest.java @@ -57,7 +57,7 @@ public class ConnectionFactoryURITest { private static final String[] V6IPs = {"fe80::baf6:b1ff:fe12:daf7%eth0", "2620:db8:1:2::1%em1"}; - private static Set ignoreList = new HashSet(); + private static Set ignoreList = new HashSet<>(); static { ignoreList.add("protocolManagerFactoryStr"); diff --git a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/bridge/impl/JMSBridgeImpl.java b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/bridge/impl/JMSBridgeImpl.java index 6e190eb7fb..5cbde39d21 100644 --- a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/bridge/impl/JMSBridgeImpl.java +++ b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/bridge/impl/JMSBridgeImpl.java @@ -185,7 +185,7 @@ public final class JMSBridgeImpl implements JMSBridge { * Constructor for MBean */ public JMSBridgeImpl() { - messages = new LinkedList(); + messages = new LinkedList<>(); executor = createExecutor(); } @@ -1563,7 +1563,7 @@ public final class JMSBridgeImpl implements JMSBridge { String propName = en.nextElement(); if (oldProps == null) { - oldProps = new HashMap(); + oldProps = new HashMap<>(); } oldProps.put(propName, msg.getObjectProperty(propName)); diff --git a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/management/impl/JMSQueueControlImpl.java b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/management/impl/JMSQueueControlImpl.java index b64a14f669..d279f8e016 100644 --- a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/management/impl/JMSQueueControlImpl.java +++ b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/management/impl/JMSQueueControlImpl.java @@ -220,7 +220,7 @@ public class JMSQueueControlImpl extends StandardMBean implements JMSQueueContro @Override public Map[]> listDeliveringMessages() throws Exception { try { - Map[]> returnMap = new HashMap[]>(); + Map[]> returnMap = new HashMap<>(); // the workingMap from the queue-control Map[]> workingMap = coreQueueControl.listDeliveringMessages(); diff --git a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/management/impl/JMSServerControlImpl.java b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/management/impl/JMSServerControlImpl.java index 5c0aea8fc3..8cb54f7bd2 100644 --- a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/management/impl/JMSServerControlImpl.java +++ b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/management/impl/JMSServerControlImpl.java @@ -162,7 +162,7 @@ public class JMSServerControlImpl extends AbstractControl implements JMSServerCo server.createConnectionFactory(name, ha, JMSFactoryType.valueOf(cfType), connectorNames[0], JMSServerControlImpl.convert(bindings)); } else { - List connectorList = new ArrayList(connectorNames.length); + List connectorList = new ArrayList<>(connectorNames.length); for (String str : connectorNames) { connectorList.add(str); @@ -262,7 +262,7 @@ public class JMSServerControlImpl extends AbstractControl implements JMSServerCo configuration.setDiscoveryGroupName(connectorNames[0]); } else { - ArrayList connectorNamesList = new ArrayList(); + ArrayList connectorNamesList = new ArrayList<>(); for (String nameC : connectorNames) { connectorNamesList.add(nameC); } @@ -593,7 +593,7 @@ public class JMSServerControlImpl extends AbstractControl implements JMSServerCo Set sessions = server.getActiveMQServer().getSessions(); - Map jmsSessions = new HashMap(); + Map jmsSessions = new HashMap<>(); // First separate the real jms sessions, after all we are only interested in those here on the *jms* server controller for (ServerSession session : sessions) { @@ -745,7 +745,7 @@ public class JMSServerControlImpl extends AbstractControl implements JMSServerCo @Override public String[] listTargetDestinations(String sessionID) throws Exception { String[] addresses = server.getActiveMQServer().getActiveMQServerControl().listTargetAddresses(sessionID); - Map allDests = new HashMap(); + Map allDests = new HashMap<>(); Object[] queueControls = server.getActiveMQServer().getManagementService().getResources(JMSQueueControl.class); for (Object queueControl2 : queueControls) { @@ -759,7 +759,7 @@ public class JMSServerControlImpl extends AbstractControl implements JMSServerCo allDests.put(topicControl.getAddress(), topicControl); } - List destinations = new ArrayList(); + List destinations = new ArrayList<>(); for (String addresse : addresses) { DestinationControl control = allDests.get(addresse); if (control != null) { diff --git a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/management/impl/JMSTopicControlImpl.java b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/management/impl/JMSTopicControlImpl.java index e7711aee6e..e226e7a8da 100644 --- a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/management/impl/JMSTopicControlImpl.java +++ b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/management/impl/JMSTopicControlImpl.java @@ -260,7 +260,7 @@ public class JMSTopicControlImpl extends StandardMBean implements TopicControl { private Object[] listSubscribersInfos(final DurabilityType durability) { List queues = getQueues(durability); - List subInfos = new ArrayList(queues.size()); + List subInfos = new ArrayList<>(queues.size()); for (QueueControl queue : queues) { String clientID = null; @@ -342,7 +342,7 @@ public class JMSTopicControlImpl extends StandardMBean implements TopicControl { private List getQueues(final DurabilityType durability) { try { - List matchingQueues = new ArrayList(); + List matchingQueues = new ArrayList<>(); String[] queues = addressControl.getQueueNames(); for (String queue : queues) { QueueControl coreQueueControl = (QueueControl) managementService.getResource(ResourceNames.CORE_QUEUE + queue); diff --git a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/persistence/config/PersistedBindings.java b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/persistence/config/PersistedBindings.java index bdf999b2f5..53d0fb7ca2 100644 --- a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/persistence/config/PersistedBindings.java +++ b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/persistence/config/PersistedBindings.java @@ -36,7 +36,7 @@ public class PersistedBindings implements EncodingSupport { private String name; - private ArrayList bindings = new ArrayList(); + private ArrayList bindings = new ArrayList<>(); // Static -------------------------------------------------------- @@ -61,7 +61,7 @@ public class PersistedBindings implements EncodingSupport { type = PersistedType.getType(buffer.readByte()); name = buffer.readSimpleString().toString(); int bindingArraySize = buffer.readInt(); - bindings = new ArrayList(bindingArraySize); + bindings = new ArrayList<>(bindingArraySize); for (int i = 0; i < bindingArraySize; i++) { bindings.add(buffer.readSimpleString().toString()); diff --git a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/persistence/impl/journal/JMSJournalStorageManagerImpl.java b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/persistence/impl/journal/JMSJournalStorageManagerImpl.java index dc9314913d..55bc82102a 100644 --- a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/persistence/impl/journal/JMSJournalStorageManagerImpl.java +++ b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/persistence/impl/journal/JMSJournalStorageManagerImpl.java @@ -62,11 +62,11 @@ public final class JMSJournalStorageManagerImpl implements JMSStorageManager { private volatile boolean started; - private final Map mapFactories = new ConcurrentHashMap(); + private final Map mapFactories = new ConcurrentHashMap<>(); - private final Map, PersistedDestination> destinations = new ConcurrentHashMap, PersistedDestination>(); + private final Map, PersistedDestination> destinations = new ConcurrentHashMap<>(); - private final Map, PersistedBindings> mapBindings = new ConcurrentHashMap, PersistedBindings>(); + private final Map, PersistedBindings> mapBindings = new ConcurrentHashMap<>(); private final Configuration config; @@ -101,7 +101,7 @@ public final class JMSJournalStorageManagerImpl implements JMSStorageManager { // Public -------------------------------------------------------- @Override public List recoverConnectionFactories() { - List cfs = new ArrayList(mapFactories.values()); + List cfs = new ArrayList<>(mapFactories.values()); return cfs; } @@ -124,7 +124,7 @@ public final class JMSJournalStorageManagerImpl implements JMSStorageManager { @Override public List recoverDestinations() { - List destinations = new ArrayList(this.destinations.values()); + List destinations = new ArrayList<>(this.destinations.values()); return destinations; } @@ -134,18 +134,18 @@ public final class JMSJournalStorageManagerImpl implements JMSStorageManager { long id = idGenerator.generateID(); destination.setId(id); jmsJournal.appendAddRecord(id, DESTINATION_RECORD, destination, true); - destinations.put(new Pair(destination.getType(), destination.getName()), destination); + destinations.put(new Pair<>(destination.getType(), destination.getName()), destination); } @Override public List recoverPersistedBindings() throws Exception { - ArrayList list = new ArrayList(mapBindings.values()); + ArrayList list = new ArrayList<>(mapBindings.values()); return list; } @Override public void addBindings(PersistedType type, String name, String... address) throws Exception { - Pair key = new Pair(type, name); + Pair key = new Pair<>(type, name); long tx = idGenerator.generateID(); @@ -174,7 +174,7 @@ public final class JMSJournalStorageManagerImpl implements JMSStorageManager { @Override public void deleteBindings(PersistedType type, String name, String address) throws Exception { - Pair key = new Pair(type, name); + Pair key = new Pair<>(type, name); long tx = idGenerator.generateID(); @@ -202,7 +202,7 @@ public final class JMSJournalStorageManagerImpl implements JMSStorageManager { @Override public void deleteBindings(PersistedType type, String name) throws Exception { - Pair key = new Pair(type, name); + Pair key = new Pair<>(type, name); PersistedBindings currentBindings = mapBindings.remove(key); @@ -213,7 +213,7 @@ public final class JMSJournalStorageManagerImpl implements JMSStorageManager { @Override public void deleteDestination(final PersistedType type, final String name) throws Exception { - PersistedDestination destination = destinations.remove(new Pair(type, name)); + PersistedDestination destination = destinations.remove(new Pair<>(type, name)); if (destination != null) { jmsJournal.appendDeleteRecord(destination.getId(), false); } @@ -243,9 +243,9 @@ public final class JMSJournalStorageManagerImpl implements JMSStorageManager { public void load() throws Exception { mapFactories.clear(); - List data = new ArrayList(); + List data = new ArrayList<>(); - ArrayList list = new ArrayList(); + ArrayList list = new ArrayList<>(); jmsJournal.load(data, list, null); @@ -266,13 +266,13 @@ public final class JMSJournalStorageManagerImpl implements JMSStorageManager { PersistedDestination destination = new PersistedDestination(); destination.decode(buffer); destination.setId(id); - destinations.put(new Pair(destination.getType(), destination.getName()), destination); + destinations.put(new Pair<>(destination.getType(), destination.getName()), destination); } else if (rec == BINDING_RECORD) { PersistedBindings bindings = new PersistedBindings(); bindings.decode(buffer); bindings.setId(id); - Pair key = new Pair(bindings.getType(), bindings.getName()); + Pair key = new Pair<>(bindings.getType(), bindings.getName()); mapBindings.put(key, bindings); } else { diff --git a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/config/impl/ConnectionFactoryConfigurationImpl.java b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/config/impl/ConnectionFactoryConfigurationImpl.java index 187d6c4673..74fcdf47c0 100644 --- a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/config/impl/ConnectionFactoryConfigurationImpl.java +++ b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/config/impl/ConnectionFactoryConfigurationImpl.java @@ -540,7 +540,7 @@ public class ConnectionFactoryConfigurationImpl implements ConnectionFactoryConf int nConnectors = buffer.readInt(); if (nConnectors > 0) { - connectorNames = new ArrayList(nConnectors); + connectorNames = new ArrayList<>(nConnectors); for (int i = 0; i < nConnectors; i++) { SimpleString str = buffer.readSimpleString(); diff --git a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/config/impl/JMSConfigurationImpl.java b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/config/impl/JMSConfigurationImpl.java index eb058c6c8d..406fb3b6f8 100644 --- a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/config/impl/JMSConfigurationImpl.java +++ b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/config/impl/JMSConfigurationImpl.java @@ -27,11 +27,11 @@ import org.apache.activemq.artemis.jms.server.config.TopicConfiguration; public class JMSConfigurationImpl implements JMSConfiguration { - private List connectionFactoryConfigurations = new ArrayList(); + private List connectionFactoryConfigurations = new ArrayList<>(); - private List queueConfigurations = new ArrayList(); + private List queueConfigurations = new ArrayList<>(); - private List topicConfigurations = new ArrayList(); + private List topicConfigurations = new ArrayList<>(); private String domain = ActiveMQDefaultConfiguration.getDefaultJmxDomain(); diff --git a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/config/impl/TransportConfigurationEncodingSupport.java b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/config/impl/TransportConfigurationEncodingSupport.java index 858c68bbcc..8fe0739c95 100644 --- a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/config/impl/TransportConfigurationEncodingSupport.java +++ b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/config/impl/TransportConfigurationEncodingSupport.java @@ -32,7 +32,7 @@ public class TransportConfigurationEncodingSupport { public static List> decodeConfigs(ActiveMQBuffer buffer) { int size = buffer.readInt(); - List> configs = new ArrayList>(size); + List> configs = new ArrayList<>(size); for (int i = 0; i < size; i++) { TransportConfiguration live = decode(buffer); @@ -41,7 +41,7 @@ public class TransportConfigurationEncodingSupport { if (hasBackup) { backup = decode(buffer); } - configs.add(new Pair(live, backup)); + configs.add(new Pair<>(live, backup)); } return configs; @@ -51,7 +51,7 @@ public class TransportConfigurationEncodingSupport { String name = BufferHelper.readNullableSimpleStringAsString(buffer); String factoryClassName = buffer.readSimpleString().toString(); int paramSize = buffer.readInt(); - Map params = new HashMap(); + Map params = new HashMap<>(); for (int i = 0; i < paramSize; i++) { String key = buffer.readSimpleString().toString(); String value = buffer.readSimpleString().toString(); diff --git a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/impl/JMSServerManagerImpl.java b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/impl/JMSServerManagerImpl.java index 50c279ce6c..94d7487374 100644 --- a/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/impl/JMSServerManagerImpl.java +++ b/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/impl/JMSServerManagerImpl.java @@ -104,20 +104,20 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback private BindingRegistry registry; - private final Map queues = new HashMap(); + private final Map queues = new HashMap<>(); - private final Map topics = new HashMap(); + private final Map topics = new HashMap<>(); - private final Map connectionFactories = new HashMap(); + private final Map connectionFactories = new HashMap<>(); - private final Map> queueBindings = new HashMap>(); + private final Map> queueBindings = new HashMap<>(); - private final Map> topicBindings = new HashMap>(); + private final Map> topicBindings = new HashMap<>(); - private final Map> connectionFactoryBindings = new HashMap>(); + private final Map> connectionFactoryBindings = new HashMap<>(); // We keep things cached if objects are created while the JMS is not active - private final List cachedCommands = new ArrayList(); + private final List cachedCommands = new ArrayList<>(); private final ActiveMQServer server; @@ -133,7 +133,7 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback private JMSStorageManager storage; - private final Map> unRecoveredBindings = new HashMap>(); + private final Map> unRecoveredBindings = new HashMap<>(); public JMSServerManagerImpl(final ActiveMQServer server) throws Exception { this.server = server; @@ -224,7 +224,7 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback unbindBindings(connectionFactoryBindings); - for (String connectionFactory : new HashSet(connectionFactories.keySet())) { + for (String connectionFactory : new HashSet<>(connectionFactories.keySet())) { shutdownConnectionFactory(connectionFactory); } @@ -290,7 +290,7 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback } if (bindingsList == null) { - bindingsList = new ArrayList(); + bindingsList = new ArrayList<>(); mapBindings.put(name, bindingsList); } @@ -336,7 +336,7 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback } if (bindingsList == null) { - bindingsList = new ArrayList(); + bindingsList = new ArrayList<>(); mapBindings.put(record.getName(), bindingsList); } @@ -494,7 +494,7 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback String[] usedBindings = null; if (bindings != null) { - ArrayList bindingsToAdd = new ArrayList(); + ArrayList bindingsToAdd = new ArrayList<>(); for (String bindingsItem : bindings) { if (bindToBindings(bindingsItem, destination)) { @@ -546,7 +546,7 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback throw new IllegalArgumentException("Queue does not exist"); } - ArrayList bindingsToAdd = new ArrayList(); + ArrayList bindingsToAdd = new ArrayList<>(); if (bindings != null) { for (String bindingsItem : bindings) { @@ -989,7 +989,7 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback ActiveMQConnectionFactory cf = internalCreateCF(cfConfig); - ArrayList bindingsToAdd = new ArrayList(); + ArrayList bindingsToAdd = new ArrayList<>(); for (String bindingsItem : bindings) { if (bindToBindings(bindingsItem, cf)) { @@ -1302,7 +1302,7 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback return ""; } - ArrayList> xidsSortedByCreationTime = new ArrayList>(xids.entrySet()); + ArrayList> xidsSortedByCreationTime = new ArrayList<>(xids.entrySet()); Collections.sort(xidsSortedByCreationTime, new Comparator>() { @Override public int compare(final Entry entry1, final Entry entry2) { @@ -1332,7 +1332,7 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback return "

*** Prepared Transaction Details ***

No entry.

"; } - ArrayList> xidsSortedByCreationTime = new ArrayList>(xids.entrySet()); + ArrayList> xidsSortedByCreationTime = new ArrayList<>(xids.entrySet()); Collections.sort(xidsSortedByCreationTime, new Comparator>() { @Override public int compare(final Entry entry1, final Entry entry2) { @@ -1411,7 +1411,7 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback private void addToBindings(Map> map, String name, String... bindings) { List list = map.get(name); if (list == null) { - list = new ArrayList(); + list = new ArrayList<>(); map.put(name, list); } for (String bindingsItem : bindings) { diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/aio/AIOSequentialFileFactory.java b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/aio/AIOSequentialFileFactory.java index 92d1b3b4a1..58f7248659 100644 --- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/aio/AIOSequentialFileFactory.java +++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/aio/AIOSequentialFileFactory.java @@ -363,7 +363,7 @@ public final class AIOSequentialFileFactory extends AbstractSequentialFileFactor private volatile long bufferReuseLastTime = System.currentTimeMillis(); - private final ConcurrentLinkedQueue reuseBuffersQueue = new ConcurrentLinkedQueue(); + private final ConcurrentLinkedQueue reuseBuffersQueue = new ConcurrentLinkedQueue<>(); private boolean stopped = false; diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/buffer/TimedBuffer.java b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/buffer/TimedBuffer.java index 20761a571f..23e0981478 100644 --- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/buffer/TimedBuffer.java +++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/buffer/TimedBuffer.java @@ -111,7 +111,7 @@ public class TimedBuffer { bufferLimit = 0; - callbacks = new ArrayList(); + callbacks = new ArrayList<>(); this.timeout = timeout; } @@ -294,7 +294,7 @@ public class TimedBuffer { pendingSync = false; // swap the instance as the previous callback list is being used asynchronously - callbacks = new LinkedList(); + callbacks = new LinkedList<>(); buffer.clear(); diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/nio/NIOSequentialFileFactory.java b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/nio/NIOSequentialFileFactory.java index d949f0b74c..67c30384fb 100644 --- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/nio/NIOSequentialFileFactory.java +++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/nio/NIOSequentialFileFactory.java @@ -87,7 +87,7 @@ public class NIOSequentialFileFactory extends AbstractSequentialFileFactory { // the main portion is outside of the VM heap // and the JDK will not have any reference about it to take GC into account // so we force a GC and try again. - WeakReference obj = new WeakReference(new Object()); + WeakReference obj = new WeakReference<>(new Object()); try { long timeout = System.currentTimeMillis() + 5000; while (System.currentTimeMillis() > timeout && obj.get() != null) { diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/PreparedTransactionInfo.java b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/PreparedTransactionInfo.java index 3d82a23cde..82abc4facd 100644 --- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/PreparedTransactionInfo.java +++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/PreparedTransactionInfo.java @@ -25,9 +25,9 @@ public class PreparedTransactionInfo { public final byte[] extraData; - public final List records = new ArrayList(); + public final List records = new ArrayList<>(); - public final List recordsToDelete = new ArrayList(); + public final List recordsToDelete = new ArrayList<>(); public PreparedTransactionInfo(final long id, final byte[] extraData) { this.id = id; diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/AbstractJournalUpdateTask.java b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/AbstractJournalUpdateTask.java index 6e9bc698fd..a8ffebcaa8 100644 --- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/AbstractJournalUpdateTask.java +++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/AbstractJournalUpdateTask.java @@ -55,9 +55,9 @@ public abstract class AbstractJournalUpdateTask implements JournalReaderCallback private ActiveMQBuffer writingChannel; - private final Set recordsSnapshot = new ConcurrentHashSet(); + private final Set recordsSnapshot = new ConcurrentHashSet<>(); - protected final List newDataFiles = new ArrayList(); + protected final List newDataFiles = new ArrayList<>(); // Static -------------------------------------------------------- diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/FileWrapperJournal.java b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/FileWrapperJournal.java index ba3807bcd6..cf09fd7902 100644 --- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/FileWrapperJournal.java +++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/FileWrapperJournal.java @@ -52,7 +52,7 @@ public final class FileWrapperJournal extends JournalBase { private final ReentrantLock lockAppend = new ReentrantLock(); - private final ConcurrentMap transactions = new ConcurrentHashMap(); + private final ConcurrentMap transactions = new ConcurrentHashMap<>(); private final JournalImpl journal; protected volatile JournalFile currentFile; diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalCompactor.java b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalCompactor.java index 3637f56093..1acbcaaf3e 100644 --- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalCompactor.java +++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalCompactor.java @@ -48,18 +48,18 @@ public class JournalCompactor extends AbstractJournalUpdateTask implements Journ private static final short COMPACT_SPLIT_LINE = 2; // Snapshot of transactions that were pending when the compactor started - private final Map pendingTransactions = new ConcurrentHashMap(); + private final Map pendingTransactions = new ConcurrentHashMap<>(); - private final Map newRecords = new HashMap(); + private final Map newRecords = new HashMap<>(); - private final Map newTransactions = new HashMap(); + private final Map newTransactions = new HashMap<>(); /** * Commands that happened during compacting * We can't process any counts during compacting, as we won't know in what files the records are taking place, so * we cache those updates. As soon as we are done we take the right account. */ - private final LinkedList pendingCommands = new LinkedList(); + private final LinkedList pendingCommands = new LinkedList<>(); public static SequentialFile readControlFile(final SequentialFileFactory fileFactory, final List dataFiles, @@ -70,7 +70,7 @@ public class JournalCompactor extends AbstractJournalUpdateTask implements Journ if (controlFile.exists()) { JournalFile file = new JournalFileImpl(controlFile, 0, JournalImpl.FORMAT_VERSION); - final ArrayList records = new ArrayList(); + final ArrayList records = new ArrayList<>(); JournalImpl.readJournalFile(fileFactory, file, new JournalReaderCallbackAbstract() { @Override @@ -101,7 +101,7 @@ public class JournalCompactor extends AbstractJournalUpdateTask implements Journ for (int i = 0; i < numberRenames; i++) { String from = input.readUTF(); String to = input.readUTF(); - renameFile.add(new Pair(from, to)); + renameFile.add(new Pair<>(from, to)); } } diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalFileImpl.java b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalFileImpl.java index 4c766b7692..01d8000071 100644 --- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalFileImpl.java +++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalFileImpl.java @@ -43,7 +43,7 @@ public class JournalFileImpl implements JournalFile { private final int version; - private final Map negCounts = new ConcurrentHashMap(); + private final Map negCounts = new ConcurrentHashMap<>(); public JournalFileImpl(final SequentialFile file, final long fileID, final int version) { this.file = file; diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalFilesRepository.java b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalFilesRepository.java index 159690d4a0..e1d69ab767 100644 --- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalFilesRepository.java +++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalFilesRepository.java @@ -61,11 +61,11 @@ public class JournalFilesRepository { private final JournalImpl journal; - private final BlockingDeque dataFiles = new LinkedBlockingDeque(); + private final BlockingDeque dataFiles = new LinkedBlockingDeque<>(); - private final ConcurrentLinkedQueue freeFiles = new ConcurrentLinkedQueue(); + private final ConcurrentLinkedQueue freeFiles = new ConcurrentLinkedQueue<>(); - private final BlockingQueue openedFiles = new LinkedBlockingQueue(); + private final BlockingQueue openedFiles = new LinkedBlockingQueue<>(); private final AtomicLong nextFileID = new AtomicLong(0); diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalImpl.java b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalImpl.java index f8aa784a40..4b729929c3 100644 --- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalImpl.java +++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalImpl.java @@ -174,10 +174,10 @@ public class JournalImpl extends JournalBase implements TestableJournal, Journal private final JournalFilesRepository filesRepository; // Compacting may replace this structure - private final ConcurrentMap records = new ConcurrentHashMap(); + private final ConcurrentMap records = new ConcurrentHashMap<>(); // Compacting may replace this structure - private final ConcurrentMap transactions = new ConcurrentHashMap(); + private final ConcurrentMap transactions = new ConcurrentHashMap<>(); // This will be set only while the JournalCompactor is being executed private volatile JournalCompactor compactor; @@ -188,7 +188,7 @@ public class JournalImpl extends JournalBase implements TestableJournal, Journal private ExecutorService compactorExecutor = null; - private ConcurrentHashSet latches = new ConcurrentHashSet(); + private ConcurrentHashSet latches = new ConcurrentHashSet<>(); // Lock used during the append of records // This lock doesn't represent a global lock. @@ -348,7 +348,7 @@ public class JournalImpl extends JournalBase implements TestableJournal, Journal public List orderFiles() throws Exception { List fileNames = fileFactory.listFiles(filesRepository.getFileExtension()); - List orderedFiles = new ArrayList(fileNames.size()); + List orderedFiles = new ArrayList<>(fileNames.size()); for (String fileName : fileNames) { SequentialFile file = fileFactory.createSequentialFile(fileName); @@ -1168,9 +1168,9 @@ public class JournalImpl extends JournalBase implements TestableJournal, Journal final List preparedTransactions, final TransactionFailureCallback failureCallback, final boolean fixBadTX) throws Exception { - final Set recordsToDelete = new HashSet(); + final Set recordsToDelete = new HashSet<>(); // ArrayList was taking too long to delete elements on checkDeleteSize - final List records = new LinkedList(); + final List records = new LinkedList<>(); final int DELETE_FLUSH = 20000; @@ -1296,7 +1296,7 @@ public class JournalImpl extends JournalBase implements TestableJournal, Journal compactorLock.writeLock().lock(); try { - ArrayList dataFilesToProcess = new ArrayList(filesRepository.getDataFilesCount()); + ArrayList dataFilesToProcess = new ArrayList<>(filesRepository.getDataFilesCount()); boolean previousReclaimValue = isAutoReclaim(); @@ -1527,7 +1527,7 @@ public class JournalImpl extends JournalBase implements TestableJournal, Journal transactions.clear(); currentFile = null; - final Map loadTransactions = new LinkedHashMap(); + final Map loadTransactions = new LinkedHashMap<>(); final List orderedFiles = orderFiles(); @@ -2194,7 +2194,7 @@ public class JournalImpl extends JournalBase implements TestableJournal, Journal cleanupList = null; } else { - cleanupList = new ArrayList>(); + cleanupList = new ArrayList<>(); cleanupList.add(cleanupRename); } return AbstractJournalUpdateTask.writeControlFile(fileFactory, files, newFiles, cleanupList); @@ -2545,9 +2545,9 @@ public class JournalImpl extends JournalBase implements TestableJournal, Journal * @throws Exception */ private void checkControlFile() throws Exception { - ArrayList dataFiles = new ArrayList(); - ArrayList newFiles = new ArrayList(); - ArrayList> renames = new ArrayList>(); + ArrayList dataFiles = new ArrayList<>(); + ArrayList newFiles = new ArrayList<>(); + ArrayList> renames = new ArrayList<>(); SequentialFile controlFile = JournalCompactor.readControlFile(fileFactory, dataFiles, newFiles, renames); if (controlFile != null) { @@ -2629,9 +2629,9 @@ public class JournalImpl extends JournalBase implements TestableJournal, Journal public final long transactionID; - public final List recordInfos = new ArrayList(); + public final List recordInfos = new ArrayList<>(); - public final List recordsToDelete = new ArrayList(); + public final List recordsToDelete = new ArrayList<>(); public boolean prepared; @@ -2726,7 +2726,7 @@ public class JournalImpl extends JournalBase implements TestableJournal, Journal public synchronized Map createFilesForBackupSync(long[] fileIds) throws Exception { synchronizationLock(); try { - Map map = new HashMap(); + Map map = new HashMap<>(); long maxID = -1; for (long id : fileIds) { maxID = Math.max(maxID, id); diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalRecord.java b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalRecord.java index a7d4169d4d..c8c0bdaf18 100644 --- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalRecord.java +++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalRecord.java @@ -47,10 +47,10 @@ public class JournalRecord { void addUpdateFile(final JournalFile updateFile, final int size) { if (updateFiles == null) { - updateFiles = new ArrayList>(); + updateFiles = new ArrayList<>(); } - updateFiles.add(new Pair(updateFile, size)); + updateFiles.add(new Pair<>(updateFile, size)); updateFile.incPosCount(); diff --git a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalTransaction.java b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalTransaction.java index 8a29d600e7..a01efede45 100644 --- a/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalTransaction.java +++ b/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/JournalTransaction.java @@ -103,7 +103,7 @@ public class JournalTransaction { public void merge(final JournalTransaction other) { if (other.pos != null) { if (pos == null) { - pos = new ArrayList(); + pos = new ArrayList<>(); } pos.addAll(other.pos); @@ -111,7 +111,7 @@ public class JournalTransaction { if (other.neg != null) { if (neg == null) { - neg = new ArrayList(); + neg = new ArrayList<>(); } neg.addAll(other.neg); @@ -119,7 +119,7 @@ public class JournalTransaction { if (other.pendingFiles != null) { if (pendingFiles == null) { - pendingFiles = new HashSet(); + pendingFiles = new HashSet<>(); } pendingFiles.addAll(other.pendingFiles); @@ -169,7 +169,7 @@ public class JournalTransaction { public TransactionCallback getCallback(final JournalFile file) throws Exception { if (callbackList == null) { - callbackList = new HashMap(); + callbackList = new HashMap<>(); } currentCallback = callbackList.get(file); @@ -194,7 +194,7 @@ public class JournalTransaction { addFile(file); if (pos == null) { - pos = new ArrayList(); + pos = new ArrayList<>(); } pos.add(new JournalUpdate(file, id, size)); @@ -206,7 +206,7 @@ public class JournalTransaction { addFile(file); if (neg == null) { - neg = new ArrayList(); + neg = new ArrayList<>(); } neg.add(new JournalUpdate(file, id, 0)); @@ -349,7 +349,7 @@ public class JournalTransaction { private void addFile(final JournalFile file) { if (pendingFiles == null) { - pendingFiles = new HashSet(); + pendingFiles = new HashSet<>(); } if (!pendingFiles.contains(file)) { diff --git a/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisAbstractPlugin.java b/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisAbstractPlugin.java index 0747ea8f2d..d4c8abd4f5 100644 --- a/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisAbstractPlugin.java +++ b/artemis-maven-plugin/src/main/java/org/apache/activemq/artemis/maven/ArtemisAbstractPlugin.java @@ -112,7 +112,7 @@ public abstract class ArtemisAbstractPlugin extends AbstractMojo { } protected List explodeDependencies(Artifact artifact) throws DependencyCollectionException { - final List dependencies = new LinkedList(); + final List dependencies = new LinkedList<>(); CollectRequest exploreDependenciesRequest = new CollectRequest(new Dependency(artifact, "compile"), remoteRepos); CollectResult result = repositorySystem.collectDependencies(repoSession, exploreDependenciesRequest); diff --git a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/proton/converter/jms/ServerJMSMapMessage.java b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/proton/converter/jms/ServerJMSMapMessage.java index 52f4f6aa7b..2083b848c0 100644 --- a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/proton/converter/jms/ServerJMSMapMessage.java +++ b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/proton/converter/jms/ServerJMSMapMessage.java @@ -249,7 +249,7 @@ public final class ServerJMSMapMessage extends ServerJMSMessage implements MapMe @Override public Enumeration getMapNames() throws JMSException { Set simplePropNames = map.getPropertyNames(); - Set propNames = new HashSet(simplePropNames.size()); + Set propNames = new HashSet<>(simplePropNames.size()); for (SimpleString str : simplePropNames) { propNames.add(str.toString()); diff --git a/artemis-protocols/artemis-hqclient-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/hornetq/util/HQPropertiesConverter.java b/artemis-protocols/artemis-hqclient-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/hornetq/util/HQPropertiesConverter.java index 9240e55624..ee7116219d 100644 --- a/artemis-protocols/artemis-hqclient-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/hornetq/util/HQPropertiesConverter.java +++ b/artemis-protocols/artemis-hqclient-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/hornetq/util/HQPropertiesConverter.java @@ -33,7 +33,7 @@ public class HQPropertiesConverter { private static Map amqHqDictionary; static { - Map d = new HashMap(); + Map d = new HashMap<>(); // Add entries for outgoing messages d.put(new SimpleString("_HQ_ACTUAL_EXPIRY"), new SimpleString("_AMQ_ACTUAL_EXPIRY")); diff --git a/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTConnection.java b/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTConnection.java index c11bd869c6..87849abf4c 100644 --- a/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTConnection.java +++ b/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTConnection.java @@ -90,7 +90,7 @@ public class MQTTConnection implements RemotingConnection { @Override public List removeCloseListeners() { synchronized (closeListeners) { - List deletedCloseListeners = new ArrayList(closeListeners); + List deletedCloseListeners = new ArrayList<>(closeListeners); closeListeners.clear(); return deletedCloseListeners; } @@ -109,7 +109,7 @@ public class MQTTConnection implements RemotingConnection { @Override public List removeFailureListeners() { synchronized (failureListeners) { - List deletedFailureListeners = new ArrayList(failureListeners); + List deletedFailureListeners = new ArrayList<>(failureListeners); failureListeners.clear(); return deletedFailureListeners; } diff --git a/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTConnectionManager.java b/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTConnectionManager.java index fb10717909..9d60513681 100644 --- a/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTConnectionManager.java +++ b/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTConnectionManager.java @@ -38,7 +38,7 @@ public class MQTTConnectionManager { private MQTTSession session; //TODO Read in a list of existing client IDs from stored Sessions. - public static Set CONNECTED_CLIENTS = new ConcurrentHashSet(); + public static Set CONNECTED_CLIENTS = new ConcurrentHashSet<>(); private MQTTLogger log = MQTTLogger.LOGGER; diff --git a/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTSessionState.java b/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTSessionState.java index 6fd575229b..9bc307454f 100644 --- a/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTSessionState.java +++ b/artemis-protocols/artemis-mqtt-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/mqtt/MQTTSessionState.java @@ -80,13 +80,13 @@ public class MQTTSessionState { void addOutbandMessageRef(int mqttId, String address, long serverMessageId, int qos) { synchronized (outboundLock) { - outboundMessageReferenceStore.put(mqttId, new Pair(address, serverMessageId)); + outboundMessageReferenceStore.put(mqttId, new Pair<>(address, serverMessageId)); if (qos == 2) { if (reverseOutboundReferenceStore.containsKey(address)) { reverseOutboundReferenceStore.get(address).put(serverMessageId, mqttId); } else { - ConcurrentHashMap serverToMqttId = new ConcurrentHashMap(); + ConcurrentHashMap serverToMqttId = new ConcurrentHashMap<>(); serverToMqttId.put(serverMessageId, mqttId); reverseOutboundReferenceStore.put(address, serverToMqttId); } diff --git a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java index 0de59907cf..0bc87ee54c 100644 --- a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java +++ b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireConnection.java @@ -108,9 +108,9 @@ public class OpenWireConnection implements RemotingConnection, CommandVisitor, S private final long creationTime; - private final List failureListeners = new CopyOnWriteArrayList(); + private final List failureListeners = new CopyOnWriteArrayList<>(); - private final List closeListeners = new CopyOnWriteArrayList(); + private final List closeListeners = new CopyOnWriteArrayList<>(); private boolean destroyed = false; @@ -132,20 +132,20 @@ public class OpenWireConnection implements RemotingConnection, CommandVisitor, S private final ReentrantReadWriteLock serviceLock = new ReentrantReadWriteLock(); - protected final List dispatchQueue = new LinkedList(); + protected final List dispatchQueue = new LinkedList<>(); private boolean inServiceException; private final AtomicBoolean asyncException = new AtomicBoolean(false); - private final Map consumerExchanges = new HashMap(); - private final Map producerExchanges = new HashMap(); + private final Map consumerExchanges = new HashMap<>(); + private final Map producerExchanges = new HashMap<>(); private ConnectionState state; - private final Set tempQueues = new ConcurrentHashSet(); + private final Set tempQueues = new ConcurrentHashSet<>(); - private Map txMap = new ConcurrentHashMap(); + private Map txMap = new ConcurrentHashMap<>(); private volatile AMQSession advisorySession; @@ -341,7 +341,7 @@ public class OpenWireConnection implements RemotingConnection, CommandVisitor, S @Override public List removeCloseListeners() { - List ret = new ArrayList(closeListeners); + List ret = new ArrayList<>(closeListeners); closeListeners.clear(); @@ -364,7 +364,7 @@ public class OpenWireConnection implements RemotingConnection, CommandVisitor, S @Override public List removeFailureListeners() { - List ret = new ArrayList(failureListeners); + List ret = new ArrayList<>(failureListeners); failureListeners.clear(); @@ -464,7 +464,7 @@ public class OpenWireConnection implements RemotingConnection, CommandVisitor, S } private void callFailureListeners(final ActiveMQException me) { - final List listenersClone = new ArrayList(failureListeners); + final List listenersClone = new ArrayList<>(failureListeners); for (final FailureListener listener : listenersClone) { try { @@ -480,7 +480,7 @@ public class OpenWireConnection implements RemotingConnection, CommandVisitor, S } private void callClosingListeners() { - final List listenersClone = new ArrayList(closeListeners); + final List listenersClone = new ArrayList<>(closeListeners); for (final CloseListener listener : listenersClone) { try { diff --git a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireProtocolManager.java b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireProtocolManager.java index 0ef7669681..f916c8f34e 100644 --- a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireProtocolManager.java +++ b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/OpenWireProtocolManager.java @@ -119,19 +119,19 @@ public class OpenWireProtocolManager implements ProtocolManager, No // from broker protected final Map brokerConnectionStates = Collections.synchronizedMap(new HashMap()); - private final CopyOnWriteArrayList connections = new CopyOnWriteArrayList(); + private final CopyOnWriteArrayList connections = new CopyOnWriteArrayList<>(); - protected final ConcurrentMap connectionInfos = new ConcurrentHashMap(); + protected final ConcurrentMap connectionInfos = new ConcurrentHashMap<>(); - private final Map clientIdSet = new HashMap(); + private final Map clientIdSet = new HashMap<>(); private String brokerName; - private Map sessions = new ConcurrentHashMap(); + private Map sessions = new ConcurrentHashMap<>(); - private Map transactions = new ConcurrentHashMap(); + private Map transactions = new ConcurrentHashMap<>(); - private Map sessionIdMap = new ConcurrentHashMap(); + private Map sessionIdMap = new ConcurrentHashMap<>(); private final ScheduledExecutorService scheduledPool; @@ -649,7 +649,7 @@ public class OpenWireProtocolManager implements ProtocolManager, No } public TransactionId[] recoverTransactions(Set sIds) { - List recovered = new ArrayList(); + List recovered = new ArrayList<>(); if (sIds != null) { for (SessionId sid : sIds) { AMQSession s = this.sessions.get(sid); diff --git a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQConsumer.java b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQConsumer.java index 40d253e5dd..7da1f3e71f 100644 --- a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQConsumer.java +++ b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQConsumer.java @@ -54,7 +54,7 @@ public class AMQConsumer implements BrowserListener { private final int prefetchSize; private AtomicInteger windowAvailable; - private final java.util.Queue deliveringRefs = new ConcurrentLinkedQueue(); + private final java.util.Queue deliveringRefs = new ConcurrentLinkedQueue<>(); private long messagePullSequence = 0; private MessagePullHandler messagePullHandler; diff --git a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQServerSession.java b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQServerSession.java index 08cb1ee2dc..c414319347 100644 --- a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQServerSession.java +++ b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQServerSession.java @@ -154,7 +154,7 @@ public class AMQServerSession extends ServerSessionImpl { if (oper != null) { List ackRefs = oper.getReferencesToAcknowledge(); - Map> toAcks = new HashMap>(); + Map> toAcks = new HashMap<>(); for (MessageReference ref : ackRefs) { Long consumerId = ref.getConsumerId(); @@ -162,7 +162,7 @@ public class AMQServerSession extends ServerSessionImpl { if (acked.contains(ref.getMessage().getMessageID())) { List ackList = toAcks.get(consumerId); if (ackList == null) { - ackList = new ArrayList(); + ackList = new ArrayList<>(); toAcks.put(consumerId, ackList); } ackList.add(ref); @@ -329,7 +329,7 @@ public class AMQServerSession extends ServerSessionImpl { Pair value = targetAddressInfos.get(msg.getAddress()); if (value == null) { - targetAddressInfos.put(msg.getAddress(), new Pair(msg.getUserID(), new AtomicLong(1))); + targetAddressInfos.put(msg.getAddress(), new Pair<>(msg.getUserID(), new AtomicLong(1))); } else { value.setA(msg.getUserID()); diff --git a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQSession.java b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQSession.java index 1d285e00f9..076567663d 100644 --- a/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQSession.java +++ b/artemis-protocols/artemis-openwire-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/openwire/amq/AMQSession.java @@ -399,7 +399,7 @@ public class AMQSession implements SessionCallback { } else { Iterator iter = consumers.values().iterator(); - Set acked = new HashSet(); + Set acked = new HashSet<>(); while (iter.hasNext()) { AMQConsumer consumer = iter.next(); consumer.rollbackTx(acked); diff --git a/artemis-protocols/artemis-proton-plug/src/main/java/org/proton/plug/context/AbstractProtonSessionContext.java b/artemis-protocols/artemis-proton-plug/src/main/java/org/proton/plug/context/AbstractProtonSessionContext.java index 00d1c67f5b..abb3115243 100644 --- a/artemis-protocols/artemis-proton-plug/src/main/java/org/proton/plug/context/AbstractProtonSessionContext.java +++ b/artemis-protocols/artemis-proton-plug/src/main/java/org/proton/plug/context/AbstractProtonSessionContext.java @@ -45,9 +45,9 @@ public abstract class AbstractProtonSessionContext extends ProtonInitializable i private long currentTag = 0; - protected Map receivers = new HashMap(); + protected Map receivers = new HashMap<>(); - protected Map senders = new HashMap(); + protected Map senders = new HashMap<>(); protected boolean closed = false; diff --git a/artemis-protocols/artemis-proton-plug/src/main/java/org/proton/plug/context/server/ProtonServerSessionContext.java b/artemis-protocols/artemis-proton-plug/src/main/java/org/proton/plug/context/server/ProtonServerSessionContext.java index adfacae4e0..46178a9ba1 100644 --- a/artemis-protocols/artemis-proton-plug/src/main/java/org/proton/plug/context/server/ProtonServerSessionContext.java +++ b/artemis-protocols/artemis-proton-plug/src/main/java/org/proton/plug/context/server/ProtonServerSessionContext.java @@ -40,7 +40,7 @@ public class ProtonServerSessionContext extends AbstractProtonSessionContext { super(sessionSPI, connection, session); } - protected Map serverSenders = new HashMap(); + protected Map serverSenders = new HashMap<>(); /** * The consumer object from the broker or the key used to store the sender diff --git a/artemis-protocols/artemis-proton-plug/src/test/java/org/proton/plug/test/AbstractJMSTest.java b/artemis-protocols/artemis-proton-plug/src/test/java/org/proton/plug/test/AbstractJMSTest.java index 90fff621d9..156b3ce68b 100644 --- a/artemis-protocols/artemis-proton-plug/src/test/java/org/proton/plug/test/AbstractJMSTest.java +++ b/artemis-protocols/artemis-proton-plug/src/test/java/org/proton/plug/test/AbstractJMSTest.java @@ -47,7 +47,7 @@ public class AbstractJMSTest { public static void forceGC() { System.out.println("#test forceGC"); - WeakReference dumbReference = new WeakReference(new Object()); + WeakReference dumbReference = new WeakReference<>(new Object()); // A loop that will wait GC, using the minimalserver time as possible while (dumbReference.get() != null) { System.gc(); diff --git a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/ActiveMQStompException.java b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/ActiveMQStompException.java index 8688750432..a6a7c507d0 100644 --- a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/ActiveMQStompException.java +++ b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/ActiveMQStompException.java @@ -29,7 +29,7 @@ public class ActiveMQStompException extends Exception { private static final long serialVersionUID = -274452327574950068L; private int code = NONE; - private final List
headers = new ArrayList
(10); + private final List
headers = new ArrayList<>(10); private String body; private VersionedStompFrameHandler handler; private boolean disconnect; diff --git a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java index 08bc2e91f4..2701b5f57d 100644 --- a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java +++ b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompConnection.java @@ -71,9 +71,9 @@ public final class StompConnection implements RemotingConnection { private final Acceptor acceptorUsed; - private final List failureListeners = new CopyOnWriteArrayList(); + private final List failureListeners = new CopyOnWriteArrayList<>(); - private final List closeListeners = new CopyOnWriteArrayList(); + private final List closeListeners = new CopyOnWriteArrayList<>(); private final Object failLock = new Object(); @@ -177,7 +177,7 @@ public final class StompConnection implements RemotingConnection { @Override public List removeCloseListeners() { - List ret = new ArrayList(closeListeners); + List ret = new ArrayList<>(closeListeners); closeListeners.clear(); @@ -186,7 +186,7 @@ public final class StompConnection implements RemotingConnection { @Override public List removeFailureListeners() { - List ret = new ArrayList(failureListeners); + List ret = new ArrayList<>(failureListeners); failureListeners.clear(); @@ -374,7 +374,7 @@ public final class StompConnection implements RemotingConnection { } private void callFailureListeners(final ActiveMQException me) { - final List listenersClone = new ArrayList(failureListeners); + final List listenersClone = new ArrayList<>(failureListeners); for (final FailureListener listener : listenersClone) { try { @@ -390,7 +390,7 @@ public final class StompConnection implements RemotingConnection { } private void callClosingListeners() { - final List listenersClone = new ArrayList(closeListeners); + final List listenersClone = new ArrayList<>(closeListeners); for (final CloseListener listener : listenersClone) { try { @@ -417,7 +417,7 @@ public final class StompConnection implements RemotingConnection { } else { StringTokenizer tokenizer = new StringTokenizer(acceptVersion, ","); - Set requestVersions = new HashSet(tokenizer.countTokens()); + Set requestVersions = new HashSet<>(tokenizer.countTokens()); while (tokenizer.hasMoreTokens()) { requestVersions.add(tokenizer.nextToken()); } diff --git a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompDecoder.java b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompDecoder.java index 2e493b412b..c1a30933b2 100644 --- a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompDecoder.java +++ b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompDecoder.java @@ -562,7 +562,7 @@ public class StompDecoder { command = null; - headers = new HashMap(); + headers = new HashMap<>(); this.headerBytesCopyStart = -1; diff --git a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompFrame.java b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompFrame.java index 0834e96863..4e184db149 100644 --- a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompFrame.java +++ b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompFrame.java @@ -53,7 +53,7 @@ public class StompFrame { public StompFrame(String command, boolean disconnect) { this.command = command; - this.headers = new LinkedHashMap(); + this.headers = new LinkedHashMap<>(); this.disconnect = disconnect; } diff --git a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompProtocolManager.java b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompProtocolManager.java index 7d069c2d5c..951bb898fc 100644 --- a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompProtocolManager.java +++ b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompProtocolManager.java @@ -73,12 +73,12 @@ class StompProtocolManager implements ProtocolManager, No private final Executor executor; - private final Map transactedSessions = new HashMap(); + private final Map transactedSessions = new HashMap<>(); // key => connection ID, value => Stomp session - private final Map sessions = new HashMap(); + private final Map sessions = new HashMap<>(); - private final Set destinations = new ConcurrentHashSet(); + private final Set destinations = new ConcurrentHashSet<>(); private final List incomingInterceptors; private final List outgoingInterceptors; diff --git a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompSession.java b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompSession.java index 2b1eaa68cc..85eebe035c 100644 --- a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompSession.java +++ b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompSession.java @@ -57,10 +57,10 @@ public class StompSession implements SessionCallback { private final OperationContext sessionContext; - private final Map subscriptions = new ConcurrentHashMap(); + private final Map subscriptions = new ConcurrentHashMap<>(); // key = message ID, value = consumer ID - private final Map> messagesToAck = new ConcurrentHashMap>(); + private final Map> messagesToAck = new ConcurrentHashMap<>(); private volatile boolean noLocal = false; @@ -145,7 +145,7 @@ public class StompSession implements SessionCallback { } } else { - messagesToAck.put(newServerMessage.getMessageID(), new Pair(consumer.getID(), length)); + messagesToAck.put(newServerMessage.getMessageID(), new Pair<>(consumer.getID(), length)); // Must send AFTER adding to messagesToAck - or could get acked from client BEFORE it's been added! manager.send(connection, frame); } diff --git a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompUtils.java b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompUtils.java index d8468b175f..00acb445d1 100644 --- a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompUtils.java +++ b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompUtils.java @@ -37,7 +37,7 @@ public class StompUtils { // Static -------------------------------------------------------- public static void copyStandardHeadersFromFrameToMessage(StompFrame frame, ServerMessageImpl msg) throws Exception { - Map headers = new HashMap(frame.getHeadersMap()); + Map headers = new HashMap<>(frame.getHeadersMap()); String priority = headers.remove(Stomp.Headers.Send.PRIORITY); if (priority != null) { diff --git a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v11/StompFrameV11.java b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v11/StompFrameV11.java index e14d3a6051..31c713270b 100644 --- a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v11/StompFrameV11.java +++ b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/v11/StompFrameV11.java @@ -26,7 +26,7 @@ import org.apache.activemq.artemis.core.protocol.stomp.StompFrame; public class StompFrameV11 extends StompFrame { //stomp 1.1 talks about repetitive headers. - protected final List
allHeaders = new ArrayList
(); + protected final List
allHeaders = new ArrayList<>(); public StompFrameV11(String command, Map headers, byte[] content) { super(command, headers, content); diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAConnectionMetaData.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAConnectionMetaData.java index 9a222892c7..32b4d0d8c0 100644 --- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAConnectionMetaData.java +++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAConnectionMetaData.java @@ -145,7 +145,7 @@ public class ActiveMQRAConnectionMetaData implements ConnectionMetaData { */ @Override public Enumeration getJMSXPropertyNames() { - Vector v = new Vector(); + Vector v = new Vector<>(); v.add("JMSXGroupID"); v.add("JMSXGroupSeq"); v.add("JMSXDeliveryCount"); diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAManagedConnection.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAManagedConnection.java index 800972c863..3cd1515593 100644 --- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAManagedConnection.java +++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAManagedConnection.java @@ -479,7 +479,7 @@ public final class ActiveMQRAManagedConnection implements ManagedConnection, Exc if (xaResource == null) { ClientSessionInternal csi = (ClientSessionInternal) xaSession.getXAResource(); ActiveMQRAXAResource activeMQRAXAResource = new ActiveMQRAXAResource(this, xaSession.getXAResource()); - Map xaResourceProperties = new HashMap(); + Map xaResourceProperties = new HashMap<>(); xaResourceProperties.put(ActiveMQXAResourceWrapper.ACTIVEMQ_JNDI_NAME, ra.getJndiName()); xaResourceProperties.put(ActiveMQXAResourceWrapper.ACTIVEMQ_NODE_ID, csi.getNodeId()); xaResourceProperties.put(ActiveMQXAResourceWrapper.ACTIVEMQ_PRODUCT_NAME, ActiveMQResourceAdapter.PRODUCT_NAME); diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAManagedConnectionFactory.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAManagedConnectionFactory.java index e2e7fc06b4..73b443f100 100644 --- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAManagedConnectionFactory.java +++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRAManagedConnectionFactory.java @@ -164,7 +164,7 @@ public final class ActiveMQRAManagedConnectionFactory implements ManagedConnecti if (recoveryConnectionFactory == null) { recoveryConnectionFactory = ra.createRecoveryActiveMQConnectionFactory(mcfProperties); - Map recoveryConfProps = new HashMap(); + Map recoveryConfProps = new HashMap<>(); recoveryConfProps.put(XARecoveryConfig.JNDI_NAME_PROPERTY_KEY, ra.getJndiName()); resourceRecovery = ra.getRecoveryManager().register(recoveryConnectionFactory, null, null, recoveryConfProps); } diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRASession.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRASession.java index 2ea9626d11..05006e441c 100644 --- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRASession.java +++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRASession.java @@ -105,8 +105,8 @@ public final class ActiveMQRASession implements QueueSession, TopicSession, XAQu this.mc = mc; this.cri = cri; sf = null; - consumers = new HashSet(); - producers = new HashSet(); + consumers = new HashSet<>(); + producers = new HashSet<>(); } /** diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRASessionFactoryImpl.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRASessionFactoryImpl.java index 655ad25172..832871a9bf 100644 --- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRASessionFactoryImpl.java +++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRASessionFactoryImpl.java @@ -108,17 +108,17 @@ public final class ActiveMQRASessionFactoryImpl extends ActiveMQConnectionForCon /** * The sessions */ - private final Set sessions = new HashSet(); + private final Set sessions = new HashSet<>(); /** * The temporary queues */ - private final Set tempQueues = new HashSet(); + private final Set tempQueues = new HashSet<>(); /** * The temporary topics */ - private final Set tempTopics = new HashSet(); + private final Set tempTopics = new HashSet<>(); /** * Constructor diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRaUtils.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRaUtils.java index cd438978ce..6103bc8d0d 100644 --- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRaUtils.java +++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQRaUtils.java @@ -170,7 +170,7 @@ public final class ActiveMQRaUtils { * @return hash-table with configuration option pairs */ public static Hashtable parseHashtableConfig(final String config) { - Hashtable hashtable = new Hashtable(); + Hashtable hashtable = new Hashtable<>(); String[] topElements = config.split(";"); @@ -188,12 +188,12 @@ public final class ActiveMQRaUtils { } public static List> parseConfig(final String config) { - List> result = new ArrayList>(); + List> result = new ArrayList<>(); String[] topElements = config.split(","); for (String topElement : topElements) { - HashMap map = new HashMap(); + HashMap map = new HashMap<>(); result.add(map); String[] elements = topElement.split(";"); @@ -213,7 +213,7 @@ public final class ActiveMQRaUtils { } public static List parseConnectorConnectorConfig(String config) { - List res = new ArrayList(); + List res = new ArrayList<>(); String[] elements = config.split(","); diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQResourceAdapter.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQResourceAdapter.java index f1d6d03966..f9781c1956 100644 --- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQResourceAdapter.java +++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/ActiveMQResourceAdapter.java @@ -120,7 +120,7 @@ public class ActiveMQResourceAdapter implements ResourceAdapter, Serializable { private boolean useAutoRecovery = true; - private final List managedConnectionFactories = new ArrayList(); + private final List managedConnectionFactories = new ArrayList<>(); private String entries; @@ -129,7 +129,7 @@ public class ActiveMQResourceAdapter implements ResourceAdapter, Serializable { * configured the exact same way. Using the same connection factory instance also makes connection load-balancing * behave as expected for outbound connections. */ - private final Map> knownConnectionFactories = new HashMap>(); + private final Map> knownConnectionFactories = new HashMap<>(); /** * Constructor @@ -141,7 +141,7 @@ public class ActiveMQResourceAdapter implements ResourceAdapter, Serializable { raProperties = new ActiveMQRAProperties(); configured = new AtomicBoolean(false); - activations = new ConcurrentHashMap(); + activations = new ConcurrentHashMap<>(); recoveryManager = new RecoveryManager(); } @@ -215,7 +215,7 @@ public class ActiveMQResourceAdapter implements ResourceAdapter, Serializable { return null; } else { - List xaresources = new ArrayList(); + List xaresources = new ArrayList<>(); for (ActivationSpec spec : specs) { ActiveMQActivation activation = activations.get(spec); if (activation != null) { @@ -1573,7 +1573,7 @@ public class ActiveMQResourceAdapter implements ResourceAdapter, Serializable { defaultActiveMQConnectionFactory = createActiveMQConnectionFactory(raProperties); recoveryActiveMQConnectionFactory = createRecoveryActiveMQConnectionFactory(raProperties); - Map recoveryConfProps = new HashMap(); + Map recoveryConfProps = new HashMap<>(); recoveryConfProps.put(XARecoveryConfig.JNDI_NAME_PROPERTY_KEY, getJndiName()); recoveryManager.register(recoveryActiveMQConnectionFactory, raProperties.getUserName(), raProperties.getPassword(), recoveryConfProps); } @@ -1842,7 +1842,7 @@ public class ActiveMQResourceAdapter implements ResourceAdapter, Serializable { public Map overrideConnectionParameters(final Map connectionParams, final Map overrideConnectionParams) { - Map map = new HashMap(); + Map map = new HashMap<>(); if (connectionParams != null) { map.putAll(connectionParams); } diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQActivation.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQActivation.java index af5fec206d..79b9cb91b2 100644 --- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQActivation.java +++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQActivation.java @@ -111,13 +111,13 @@ public class ActiveMQActivation { */ private SimpleString topicTemporaryQueue; - private final List handlers = new ArrayList(); + private final List handlers = new ArrayList<>(); private ActiveMQConnectionFactory factory; private List nodes = Collections.synchronizedList(new ArrayList()); - private Map removedNodes = new ConcurrentHashMap(); + private Map removedNodes = new ConcurrentHashMap<>(); private boolean lastReceived = false; @@ -272,7 +272,7 @@ public class ActiveMQActivation { * @return the list of XAResources for this activation endpoint */ public List getXAResources() { - List xaresources = new ArrayList(); + List xaresources = new ArrayList<>(); for (ActiveMQMessageHandler handler : handlers) { XAResource xares = handler.getXAResource(); if (xares != null) { @@ -345,7 +345,7 @@ public class ActiveMQActivation { handler.start(); } - Map recoveryConfProps = new HashMap(); + Map recoveryConfProps = new HashMap<>(); recoveryConfProps.put(XARecoveryConfig.JNDI_NAME_PROPERTY_KEY, ra.getJndiName()); resourceRecovery = ra.getRecoveryManager().register(factory, spec.getUser(), spec.getPassword(), recoveryConfProps); if (spec.isRebalanceConnections()) { diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQActivationSpec.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQActivationSpec.java index feb195f02c..c1ca63d1ce 100644 --- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQActivationSpec.java +++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQActivationSpec.java @@ -691,8 +691,8 @@ public class ActiveMQActivationSpec extends ConnectionFactoryProperties implemen ActiveMQRALogger.LOGGER.trace("validate()"); } - List errorMessages = new ArrayList(); - List propsNotSet = new ArrayList(); + List errorMessages = new ArrayList<>(); + List propsNotSet = new ArrayList<>(); try { if (destination == null || destination.trim().equals("")) { diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQMessageHandler.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQMessageHandler.java index 835363476d..a180fc7819 100644 --- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQMessageHandler.java +++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/inflow/ActiveMQMessageHandler.java @@ -177,7 +177,7 @@ public class ActiveMQMessageHandler implements MessageHandler, FailoverEventList useLocalTx = !activation.isDeliveryTransacted() && activation.getActivationSpec().isUseLocalTx(); transacted = activation.isDeliveryTransacted(); if (activation.isDeliveryTransacted() && !activation.getActivationSpec().isUseLocalTx()) { - Map xaResourceProperties = new HashMap(); + Map xaResourceProperties = new HashMap<>(); xaResourceProperties.put(ActiveMQXAResourceWrapper.ACTIVEMQ_JNDI_NAME, ((ActiveMQResourceAdapter) spec.getResourceAdapter()).getJndiName()); xaResourceProperties.put(ActiveMQXAResourceWrapper.ACTIVEMQ_NODE_ID, ((ClientSessionFactoryInternal) cf).getLiveNodeId()); xaResourceProperties.put(ActiveMQXAResourceWrapper.ACTIVEMQ_PRODUCT_NAME, ActiveMQResourceAdapter.PRODUCT_NAME); diff --git a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/recovery/RecoveryManager.java b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/recovery/RecoveryManager.java index 13023c8de6..2eb42ba33b 100644 --- a/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/recovery/RecoveryManager.java +++ b/artemis-ra/src/main/java/org/apache/activemq/artemis/ra/recovery/RecoveryManager.java @@ -33,7 +33,7 @@ public final class RecoveryManager { private static final String RESOURCE_RECOVERY_CLASS_NAMES = "org.jboss.as.messaging.jms.AS7RecoveryRegistry;" + "org.jboss.as.integration.activemq.recovery.AS5RecoveryRegistry"; - private final Set resources = new ConcurrentHashSet(); + private final Set resources = new ConcurrentHashSet<>(); public void start(final boolean useAutoRecovery) { if (useAutoRecovery) { diff --git a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/MessageServiceManager.java b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/MessageServiceManager.java index 1bef82c51d..014853d2f5 100644 --- a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/MessageServiceManager.java +++ b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/MessageServiceManager.java @@ -136,7 +136,7 @@ public class MessageServiceManager { defaultSettings.setDuplicatesAllowed(configuration.isDupsOk()); defaultSettings.setDurableSend(configuration.isDefaultDurableSend()); - HashMap transportConfig = new HashMap(); + HashMap transportConfig = new HashMap<>(); transportConfig.put(TransportConstants.SERVER_ID_PROP_NAME, configuration.getInVmId()); ServerLocator consumerLocator = new ServerLocatorImpl(false, new TransportConfiguration(InVMConnectorFactory.class.getName(), transportConfig)); diff --git a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/queue/ConsumersResource.java b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/queue/ConsumersResource.java index 278461c84f..84dae831de 100644 --- a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/queue/ConsumersResource.java +++ b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/queue/ConsumersResource.java @@ -40,7 +40,7 @@ import org.apache.activemq.artemis.rest.util.TimeoutTask; public class ConsumersResource implements TimeoutTask.Callback { - protected ConcurrentMap queueConsumers = new ConcurrentHashMap(); + protected ConcurrentMap queueConsumers = new ConcurrentHashMap<>(); protected ClientSessionFactory sessionFactory; protected String destination; protected final String startup = Long.toString(System.currentTimeMillis()); diff --git a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/queue/PostMessage.java b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/queue/PostMessage.java index c99cdf15fb..6931695412 100644 --- a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/queue/PostMessage.java +++ b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/queue/PostMessage.java @@ -206,7 +206,7 @@ public class PostMessage { } public void init() throws Exception { - pool = new ArrayBlockingQueue(poolSize); + pool = new ArrayBlockingQueue<>(poolSize); for (int i = 0; i < poolSize; i++) { addPooled(); } diff --git a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/queue/QueueDestinationsResource.java b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/queue/QueueDestinationsResource.java index 3f17af076d..7f7ce09c92 100644 --- a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/queue/QueueDestinationsResource.java +++ b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/queue/QueueDestinationsResource.java @@ -45,7 +45,7 @@ import org.w3c.dom.Document; @Path(Constants.PATH_FOR_QUEUES) public class QueueDestinationsResource { - private Map queues = new ConcurrentHashMap(); + private Map queues = new ConcurrentHashMap<>(); private QueueServiceManager manager; public QueueDestinationsResource(QueueServiceManager manager) { diff --git a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/queue/QueueServiceManager.java b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/queue/QueueServiceManager.java index 1e643afe79..159cca4438 100644 --- a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/queue/QueueServiceManager.java +++ b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/queue/QueueServiceManager.java @@ -27,7 +27,7 @@ import org.apache.activemq.artemis.rest.queue.push.FilePushStore; public class QueueServiceManager extends DestinationServiceManager { protected PushStore pushStore; - protected List queues = new ArrayList(); + protected List queues = new ArrayList<>(); protected QueueDestinationsResource destination; public List getQueues() { diff --git a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/queue/push/FilePushStore.java b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/queue/push/FilePushStore.java index 70e0d64456..54d2b50955 100644 --- a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/queue/push/FilePushStore.java +++ b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/queue/push/FilePushStore.java @@ -31,7 +31,7 @@ import org.apache.activemq.artemis.rest.topic.PushTopicRegistration; public class FilePushStore implements PushStore { - protected Map map = new HashMap(); + protected Map map = new HashMap<>(); protected File dir; protected JAXBContext ctx; @@ -58,13 +58,13 @@ public class FilePushStore implements PushStore { } public synchronized List getRegistrations() { - List list = new ArrayList(map.values()); + List list = new ArrayList<>(map.values()); return list; } @Override public synchronized List getByDestination(String destination) { - List list = new ArrayList(); + List list = new ArrayList<>(); for (PushRegistration reg : map.values()) { if (reg.getDestination().equals(destination)) { list.add(reg); @@ -108,7 +108,7 @@ public class FilePushStore implements PushStore { @Override public synchronized void removeAll() throws Exception { - ArrayList copy = new ArrayList(map.values()); + ArrayList copy = new ArrayList<>(map.values()); for (PushRegistration reg : copy) remove(reg); this.dir.delete(); diff --git a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/queue/push/PushConsumer.java b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/queue/push/PushConsumer.java index 906ff78d69..ef47f0ae93 100644 --- a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/queue/push/PushConsumer.java +++ b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/queue/push/PushConsumer.java @@ -81,8 +81,8 @@ public class PushConsumer { strategy.setRegistration(registration); strategy.start(); - sessions = new ArrayList(); - consumers = new ArrayList(); + sessions = new ArrayList<>(); + consumers = new ArrayList<>(); for (int i = 0; i < registration.getSessionCount(); i++) { ClientSession session = factory.createSession(false, false, 0); diff --git a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/queue/push/PushConsumerResource.java b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/queue/push/PushConsumerResource.java index d1a3f16f79..76dcf5e7a5 100644 --- a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/queue/push/PushConsumerResource.java +++ b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/queue/push/PushConsumerResource.java @@ -38,7 +38,7 @@ import org.apache.activemq.artemis.rest.ActiveMQRestLogger; public class PushConsumerResource { - protected Map consumers = new ConcurrentHashMap(); + protected Map consumers = new ConcurrentHashMap<>(); protected ClientSessionFactory sessionFactory; protected String destination; protected final String startup = Long.toString(System.currentTimeMillis()); diff --git a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/queue/push/xml/PushRegistration.java b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/queue/push/xml/PushRegistration.java index af3a12900c..b934f7bd78 100644 --- a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/queue/push/xml/PushRegistration.java +++ b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/queue/push/xml/PushRegistration.java @@ -38,7 +38,7 @@ public class PushRegistration implements Serializable { private boolean durable; private XmlLink target; private Authentication authenticationMechanism; - private List headers = new ArrayList(); + private List headers = new ArrayList<>(); private String destination; private Object loadedFrom; private String selector; diff --git a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/topic/FileTopicPushStore.java b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/topic/FileTopicPushStore.java index 417b65d02c..57cadd919e 100644 --- a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/topic/FileTopicPushStore.java +++ b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/topic/FileTopicPushStore.java @@ -30,7 +30,7 @@ public class FileTopicPushStore extends FilePushStore implements TopicPushStore @Override public synchronized List getByTopic(String topic) { - List list = new ArrayList(); + List list = new ArrayList<>(); for (PushRegistration reg : map.values()) { PushTopicRegistration topicReg = (PushTopicRegistration) reg; if (topicReg.getTopic().equals(topic)) { diff --git a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/topic/PushSubscriptionsResource.java b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/topic/PushSubscriptionsResource.java index de4a16a90d..c01459bcf0 100644 --- a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/topic/PushSubscriptionsResource.java +++ b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/topic/PushSubscriptionsResource.java @@ -40,7 +40,7 @@ import java.util.concurrent.atomic.AtomicLong; public class PushSubscriptionsResource { - protected Map consumers = new ConcurrentHashMap(); + protected Map consumers = new ConcurrentHashMap<>(); protected ClientSessionFactory sessionFactory; protected String destination; protected final String startup = Long.toString(System.currentTimeMillis()); diff --git a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/topic/SubscriptionsResource.java b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/topic/SubscriptionsResource.java index 140599dd3d..2fcbdd5285 100644 --- a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/topic/SubscriptionsResource.java +++ b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/topic/SubscriptionsResource.java @@ -46,7 +46,7 @@ import org.apache.activemq.artemis.rest.util.TimeoutTask; public class SubscriptionsResource implements TimeoutTask.Callback { - protected ConcurrentMap queueConsumers = new ConcurrentHashMap(); + protected ConcurrentMap queueConsumers = new ConcurrentHashMap<>(); protected ClientSessionFactory sessionFactory; protected String destination; protected final String startup = Long.toString(System.currentTimeMillis()); diff --git a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/topic/TopicDestinationsResource.java b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/topic/TopicDestinationsResource.java index e084b03e35..8c72e490e4 100644 --- a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/topic/TopicDestinationsResource.java +++ b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/topic/TopicDestinationsResource.java @@ -46,7 +46,7 @@ import org.w3c.dom.Document; @Path("/topics") public class TopicDestinationsResource { - private Map topics = new ConcurrentHashMap(); + private Map topics = new ConcurrentHashMap<>(); private TopicServiceManager manager; public TopicDestinationsResource(TopicServiceManager manager) { diff --git a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/topic/TopicServiceManager.java b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/topic/TopicServiceManager.java index b782d5c16b..cd2020f607 100644 --- a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/topic/TopicServiceManager.java +++ b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/topic/TopicServiceManager.java @@ -26,7 +26,7 @@ import java.util.List; public class TopicServiceManager extends DestinationServiceManager { protected TopicPushStore pushStore; - protected List topics = new ArrayList(); + protected List topics = new ArrayList<>(); protected TopicDestinationsResource destination; public TopicPushStore getPushStore() { diff --git a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/util/TimeoutTask.java b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/util/TimeoutTask.java index ae5f5dea1b..ba87669fe8 100644 --- a/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/util/TimeoutTask.java +++ b/artemis-rest/src/main/java/org/apache/activemq/artemis/rest/util/TimeoutTask.java @@ -30,9 +30,9 @@ public class TimeoutTask implements Runnable { protected boolean running = true; protected int interval = 10; protected final Lock callbacksLock = new ReentrantLock(); - protected Map callbacks = new HashMap(); + protected Map callbacks = new HashMap<>(); protected final Lock pendingCallbacksLock = new ReentrantLock(); - protected Map pendingCallbacks = new HashMap(); + protected Map pendingCallbacks = new HashMap<>(); protected Thread thread; public TimeoutTask(int interval) { @@ -107,7 +107,7 @@ public class TimeoutTask implements Runnable { // First, test all known callbacks for timeouts. // If the timeout is true, then move it to a separate map. - Map expiredCallbacks = new HashMap(); + Map expiredCallbacks = new HashMap<>(); int liveConsumers = 0; int deadConsumers = 0; @@ -115,7 +115,7 @@ public class TimeoutTask implements Runnable { callbacksLock.lock(); try { long startTime = System.currentTimeMillis(); - List tokens = new ArrayList(callbacks.size()); + List tokens = new ArrayList<>(callbacks.size()); for (String token : callbacks.keySet()) { tokens.add(token); } @@ -154,7 +154,7 @@ public class TimeoutTask implements Runnable { // Finally, freely shutdown all expired consumers. if (expiredCallbacks.size() > 0) { long startTime = System.currentTimeMillis(); - List tokens = new ArrayList(expiredCallbacks.size()); + List tokens = new ArrayList<>(expiredCallbacks.size()); for (String token : expiredCallbacks.keySet()) { tokens.add(token); } diff --git a/artemis-rest/src/test/java/org/apache/activemq/artemis/rest/test/RawAckTest.java b/artemis-rest/src/test/java/org/apache/activemq/artemis/rest/test/RawAckTest.java index a67a0ebee7..9a4140de81 100644 --- a/artemis-rest/src/test/java/org/apache/activemq/artemis/rest/test/RawAckTest.java +++ b/artemis-rest/src/test/java/org/apache/activemq/artemis/rest/test/RawAckTest.java @@ -58,7 +58,7 @@ public class RawAckTest { activeMQServer = ActiveMQServers.newActiveMQServer(configuration); activeMQServer.start(); - HashMap transportConfig = new HashMap(); + HashMap transportConfig = new HashMap<>(); serverLocator = new ServerLocatorImpl(false, new TransportConfiguration(InVMConnectorFactory.class.getName(), transportConfig)); sessionFactory = serverLocator.createSessionFactory(); diff --git a/artemis-selector/src/main/java/org/apache/activemq/artemis/selector/filter/ComparisonExpression.java b/artemis-selector/src/main/java/org/apache/activemq/artemis/selector/filter/ComparisonExpression.java index 2ed90b2e2a..7ed8a08b08 100755 --- a/artemis-selector/src/main/java/org/apache/activemq/artemis/selector/filter/ComparisonExpression.java +++ b/artemis-selector/src/main/java/org/apache/activemq/artemis/selector/filter/ComparisonExpression.java @@ -28,10 +28,10 @@ import java.util.regex.Pattern; */ public abstract class ComparisonExpression extends BinaryExpression implements BooleanExpression { - public static final ThreadLocal CONVERT_STRING_EXPRESSIONS = new ThreadLocal(); + public static final ThreadLocal CONVERT_STRING_EXPRESSIONS = new ThreadLocal<>(); boolean convertStringExpressions = false; - private static final Set REGEXP_CONTROL_CHARS = new HashSet(); + private static final Set REGEXP_CONTROL_CHARS = new HashSet<>(); /** * @param left diff --git a/artemis-selector/src/main/java/org/apache/activemq/artemis/selector/filter/UnaryExpression.java b/artemis-selector/src/main/java/org/apache/activemq/artemis/selector/filter/UnaryExpression.java index 0c1e66f3a7..999e51d686 100755 --- a/artemis-selector/src/main/java/org/apache/activemq/artemis/selector/filter/UnaryExpression.java +++ b/artemis-selector/src/main/java/org/apache/activemq/artemis/selector/filter/UnaryExpression.java @@ -70,7 +70,7 @@ public abstract class UnaryExpression implements Expression { t = elements; } else { - t = new HashSet(elements); + t = new HashSet<>(elements); } final Collection inList = t; diff --git a/artemis-selector/src/test/java/org/apache/activemq/artemis/selector/SelectorTest.java b/artemis-selector/src/test/java/org/apache/activemq/artemis/selector/SelectorTest.java index 55c306c427..bfb67a7e91 100755 --- a/artemis-selector/src/test/java/org/apache/activemq/artemis/selector/SelectorTest.java +++ b/artemis-selector/src/test/java/org/apache/activemq/artemis/selector/SelectorTest.java @@ -32,7 +32,7 @@ public class SelectorTest { class MockMessage implements Filterable { - HashMap properties = new HashMap(); + HashMap properties = new HashMap<>(); private String text; private Object destination; private String messageId; diff --git a/artemis-server-osgi/src/main/java/org/apache/activemq/artemis/osgi/OsgiBroker.java b/artemis-server-osgi/src/main/java/org/apache/activemq/artemis/osgi/OsgiBroker.java index 55f7c4154e..f2a30f32de 100644 --- a/artemis-server-osgi/src/main/java/org/apache/activemq/artemis/osgi/OsgiBroker.java +++ b/artemis-server-osgi/src/main/java/org/apache/activemq/artemis/osgi/OsgiBroker.java @@ -136,7 +136,7 @@ public class OsgiBroker { private String[] getRequiredProtocols(Set acceptors) { - ArrayList protocols = new ArrayList(); + ArrayList protocols = new ArrayList<>(); for (TransportConfiguration acceptor : acceptors) { String protoName = acceptor.getName().toUpperCase(); if (!"ARTEMIS".equals(protoName)) { @@ -161,7 +161,7 @@ public class OsgiBroker { * we get more. */ public ArrayList getComponentsByStartOrder(Map components) { - ArrayList activeMQComponents = new ArrayList(); + ArrayList activeMQComponents = new ArrayList<>(); ActiveMQComponent jmsComponent = components.get("jms"); if (jmsComponent != null) { activeMQComponents.add(jmsComponent); diff --git a/artemis-server-osgi/src/main/java/org/apache/activemq/artemis/osgi/ProtocolTracker.java b/artemis-server-osgi/src/main/java/org/apache/activemq/artemis/osgi/ProtocolTracker.java index 36430b141e..661024b8f9 100644 --- a/artemis-server-osgi/src/main/java/org/apache/activemq/artemis/osgi/ProtocolTracker.java +++ b/artemis-server-osgi/src/main/java/org/apache/activemq/artemis/osgi/ProtocolTracker.java @@ -48,7 +48,7 @@ public class ProtocolTracker implements ServiceTrackerCustomizer(); + this.protocols = new HashMap<>(); for (String requiredProtocol : requiredProtocols) { this.protocols.put(requiredProtocol, false); } @@ -118,7 +118,7 @@ public class ProtocolTracker implements ServiceTrackerCustomizer getMissing() { - List missing = new ArrayList(); + List missing = new ArrayList<>(); for (String protocol : protocols.keySet()) { Boolean present = protocols.get(protocol); if (!present) { diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImpl.java index 2f74afa4ce..fad446f352 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/ConfigurationImpl.java @@ -101,25 +101,25 @@ public class ConfigurationImpl implements Configuration, Serializable { private boolean persistIDCache = ActiveMQDefaultConfiguration.isDefaultPersistIdCache(); - private List incomingInterceptorClassNames = new ArrayList(); + private List incomingInterceptorClassNames = new ArrayList<>(); - private List outgoingInterceptorClassNames = new ArrayList(); + private List outgoingInterceptorClassNames = new ArrayList<>(); - protected Map connectorConfigs = new HashMap(); + protected Map connectorConfigs = new HashMap<>(); - private Set acceptorConfigs = new HashSet(); + private Set acceptorConfigs = new HashSet<>(); - protected List bridgeConfigurations = new ArrayList(); + protected List bridgeConfigurations = new ArrayList<>(); - protected List divertConfigurations = new ArrayList(); + protected List divertConfigurations = new ArrayList<>(); - protected List clusterConfigurations = new ArrayList(); + protected List clusterConfigurations = new ArrayList<>(); - private List queueConfigurations = new ArrayList(); + private List queueConfigurations = new ArrayList<>(); - protected transient List broadcastGroupConfigurations = new ArrayList(); + protected transient List broadcastGroupConfigurations = new ArrayList<>(); - protected transient Map discoveryGroupConfigurations = new LinkedHashMap(); + protected transient Map discoveryGroupConfigurations = new LinkedHashMap<>(); // Paging related attributes ------------------------------------------------------------ @@ -204,15 +204,15 @@ public class ConfigurationImpl implements Configuration, Serializable { protected GroupingHandlerConfiguration groupingHandlerConfiguration; - private Map addressesSettings = new HashMap(); + private Map addressesSettings = new HashMap<>(); - private Map resourceLimitSettings = new HashMap(); + private Map resourceLimitSettings = new HashMap<>(); - private Map> securitySettings = new HashMap>(); + private Map> securitySettings = new HashMap<>(); - private List securitySettingPlugins = new ArrayList(); + private List securitySettingPlugins = new ArrayList<>(); - protected List connectorServiceConfigurations = new ArrayList(); + protected List connectorServiceConfigurations = new ArrayList<>(); private boolean maskPassword = ActiveMQDefaultConfiguration.isDefaultMaskPassword(); diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/SecurityConfiguration.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/SecurityConfiguration.java index d647802d46..3325d5de55 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/SecurityConfiguration.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/config/impl/SecurityConfiguration.java @@ -34,14 +34,14 @@ public class SecurityConfiguration extends Configuration { /** * the current valid users */ - protected final Map users = new HashMap(); + protected final Map users = new HashMap<>(); protected String defaultUser = null; /** * the roles for the users */ - protected final Map> roles = new HashMap>(); + protected final Map> roles = new HashMap<>(); public SecurityConfiguration() { } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/deployers/impl/FileConfigurationParser.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/deployers/impl/FileConfigurationParser.java index 3459bf5aef..be1d6dd00e 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/deployers/impl/FileConfigurationParser.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/deployers/impl/FileConfigurationParser.java @@ -277,7 +277,7 @@ public final class FileConfigurationParser extends XMLConfigurationUtil { NodeList interceptorNodes = e.getElementsByTagName("remoting-interceptors"); - ArrayList incomingInterceptorList = new ArrayList(); + ArrayList incomingInterceptorList = new ArrayList<>(); if (interceptorNodes.getLength() > 0) { NodeList interceptors = interceptorNodes.item(0).getChildNodes(); @@ -309,7 +309,7 @@ public final class FileConfigurationParser extends XMLConfigurationUtil { NodeList outgoingInterceptorNodes = e.getElementsByTagName("remoting-outgoing-interceptors"); - ArrayList outgoingInterceptorList = new ArrayList(); + ArrayList outgoingInterceptorList = new ArrayList<>(); if (outgoingInterceptorNodes.getLength() > 0) { NodeList interceptors = outgoingInterceptorNodes.item(0).getChildNodes(); @@ -504,7 +504,7 @@ public final class FileConfigurationParser extends XMLConfigurationUtil { NodeList connectorServiceConfigs = e.getElementsByTagName("connector-service"); - ArrayList configs = new ArrayList(); + ArrayList configs = new ArrayList<>(); for (int i = 0; i < connectorServiceConfigs.getLength(); i++) { Element node = (Element) connectorServiceConfigs.item(i); @@ -594,18 +594,18 @@ public final class FileConfigurationParser extends XMLConfigurationUtil { protected Pair> parseSecurityRoles(final Node node) { final String match = node.getAttributes().getNamedItem("match").getNodeValue(); - HashSet securityRoles = new HashSet(); + HashSet securityRoles = new HashSet<>(); Pair> securityMatch = new Pair>(match, securityRoles); - ArrayList send = new ArrayList(); - ArrayList consume = new ArrayList(); - ArrayList createDurableQueue = new ArrayList(); - ArrayList deleteDurableQueue = new ArrayList(); - ArrayList createNonDurableQueue = new ArrayList(); - ArrayList deleteNonDurableQueue = new ArrayList(); - ArrayList manageRoles = new ArrayList(); - ArrayList allRoles = new ArrayList(); + ArrayList send = new ArrayList<>(); + ArrayList consume = new ArrayList<>(); + ArrayList createDurableQueue = new ArrayList<>(); + ArrayList deleteDurableQueue = new ArrayList<>(); + ArrayList createNonDurableQueue = new ArrayList<>(); + ArrayList deleteNonDurableQueue = new ArrayList<>(); + ArrayList manageRoles = new ArrayList<>(); + ArrayList allRoles = new ArrayList<>(); NodeList children = node.getChildNodes(); for (int i = 0; i < children.getLength(); i++) { Node child = children.item(i); @@ -681,7 +681,7 @@ public final class FileConfigurationParser extends XMLConfigurationUtil { } }); - return new Pair>(securitySettingPlugin, settings); + return new Pair<>(securitySettingPlugin, settings); } /** @@ -695,7 +695,7 @@ public final class FileConfigurationParser extends XMLConfigurationUtil { AddressSettings addressSettings = new AddressSettings(); - Pair setting = new Pair(match, addressSettings); + Pair setting = new Pair<>(match, addressSettings); for (int i = 0; i < children.getLength(); i++) { final Node child = children.item(i); @@ -1099,7 +1099,7 @@ public final class FileConfigurationParser extends XMLConfigurationUtil { private void parseBroadcastGroupConfiguration(final Element e, final Configuration mainConfig) { String name = e.getAttribute("name"); - List connectorNames = new ArrayList(); + List connectorNames = new ArrayList<>(); NodeList children = e.getChildNodes(); @@ -1240,7 +1240,7 @@ public final class FileConfigurationParser extends XMLConfigurationUtil { String discoveryGroupName = null; - List staticConnectorNames = new ArrayList(); + List staticConnectorNames = new ArrayList<>(); boolean allowDirectConnectionsOnly = false; @@ -1342,7 +1342,7 @@ public final class FileConfigurationParser extends XMLConfigurationUtil { String filterString = null; - List staticConnectorNames = new ArrayList(); + List staticConnectorNames = new ArrayList<>(); String discoveryGroupName = null; @@ -1423,7 +1423,7 @@ public final class FileConfigurationParser extends XMLConfigurationUtil { String clazz = getString(e, "factory-class", null, Validators.NOT_NULL_OR_EMPTY); - Map params = new HashMap(); + Map params = new HashMap<>(); NodeList paramsNodes = e.getElementsByTagName("param"); diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java index 753aa2443b..5382621caf 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/ActiveMQServerControlImpl.java @@ -827,7 +827,7 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active DateFormat dateFormat = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.MEDIUM); Map xids = resourceManager.getPreparedTransactionsWithCreationTime(); - ArrayList> xidsSortedByCreationTime = new ArrayList>(xids.entrySet()); + ArrayList> xidsSortedByCreationTime = new ArrayList<>(xids.entrySet()); Collections.sort(xidsSortedByCreationTime, new Comparator>() { @Override public int compare(final Entry entry1, final Entry entry2) { @@ -860,7 +860,7 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active return ""; } - ArrayList> xidsSortedByCreationTime = new ArrayList>(xids.entrySet()); + ArrayList> xidsSortedByCreationTime = new ArrayList<>(xids.entrySet()); Collections.sort(xidsSortedByCreationTime, new Comparator>() { @Override public int compare(final Entry entry1, final Entry entry2) { @@ -894,7 +894,7 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active return "

*** Prepared Transaction Details ***

No entry.

"; } - ArrayList> xidsSortedByCreationTime = new ArrayList>(xids.entrySet()); + ArrayList> xidsSortedByCreationTime = new ArrayList<>(xids.entrySet()); Collections.sort(xidsSortedByCreationTime, new Comparator>() { @Override public int compare(final Entry entry1, final Entry entry2) { @@ -1078,7 +1078,7 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active clearIO(); try { Set connections = remotingService.getConnections(); - List remoteConnections = new ArrayList(); + List remoteConnections = new ArrayList<>(); for (RemotingConnection connection : connections) { String remoteAddress = connection.getRemoteAddress(); if (remoteAddress.contains(ipAddress)) { @@ -1375,7 +1375,7 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active checkStarted(); AddressSettings addressSettings = server.getAddressSettingsRepository().getMatch(address); - Map settings = new HashMap(); + Map settings = new HashMap<>(); if (addressSettings.getDeadLetterAddress() != null) { settings.put("DLA", addressSettings.getDeadLetterAddress()); } @@ -1844,7 +1844,7 @@ public class ActiveMQServerControlImpl extends AbstractControl implements Active } private static List toList(final String commaSeparatedString) { - List list = new ArrayList(); + List list = new ArrayList<>(); if (commaSeparatedString == null || commaSeparatedString.trim().length() == 0) { return list; } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/AddressControlImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/AddressControlImpl.java index 2eb02d665f..bf01fbb27e 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/AddressControlImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/AddressControlImpl.java @@ -80,7 +80,7 @@ public class AddressControlImpl extends AbstractControl implements AddressContro clearIO(); try { Bindings bindings = postOffice.getBindingsForAddress(address); - List queueNames = new ArrayList(); + List queueNames = new ArrayList<>(); for (Binding binding : bindings.getBindings()) { if (binding instanceof QueueBinding) { queueNames.add(binding.getUniqueName().toString()); @@ -180,7 +180,7 @@ public class AddressControlImpl extends AbstractControl implements AddressContro long totalMsgs = 0; try { Bindings bindings = postOffice.getBindingsForAddress(address); - List queueNames = new ArrayList(); + List queueNames = new ArrayList<>(); for (Binding binding : bindings.getBindings()) { if (binding instanceof QueueBinding) { totalMsgs += ((QueueBinding) binding).getQueue().getMessageCount(); diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/MBeanInfoHelper.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/MBeanInfoHelper.java index c507458539..72a439a202 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/MBeanInfoHelper.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/MBeanInfoHelper.java @@ -39,7 +39,7 @@ public class MBeanInfoHelper { // Public -------------------------------------------------------- public static MBeanOperationInfo[] getMBeanOperationsInfo(final Class mbeanInterface) { - List operations = new ArrayList(); + List operations = new ArrayList<>(); for (Method method : mbeanInterface.getMethods()) { if (!MBeanInfoHelper.isGetterMethod(method) && !MBeanInfoHelper.isSetterMethod(method) && diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/QueueControlImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/QueueControlImpl.java index 3c0dab7bdc..b61409ecff 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/QueueControlImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/management/impl/QueueControlImpl.java @@ -357,7 +357,7 @@ public class QueueControlImpl extends AbstractControl implements QueueControl { try { Map> msgs = queue.getDeliveringMessages(); - Map[]> msgRet = new HashMap[]>(); + Map[]> msgRet = new HashMap<>(); for (Map.Entry> entry : msgs.entrySet()) { msgRet.put(entry.getKey(), convertMessagesToMaps(entry.getValue())); @@ -390,7 +390,7 @@ public class QueueControlImpl extends AbstractControl implements QueueControl { clearIO(); try { Filter filter = FilterImpl.createFilter(filterStr); - List> messages = new ArrayList>(); + List> messages = new ArrayList<>(); queue.flushExecutor(); LinkedListIterator iterator = queue.totalIterator(); try { @@ -433,7 +433,7 @@ public class QueueControlImpl extends AbstractControl implements QueueControl { clearIO(); try { - List> messages = new ArrayList>(); + List> messages = new ArrayList<>(); queue.flushExecutor(); LinkedListIterator iterator = queue.totalIterator(); try { diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/messagecounter/MessageCounter.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/messagecounter/MessageCounter.java index f3ea99883b..1d912797bf 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/messagecounter/MessageCounter.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/messagecounter/MessageCounter.java @@ -98,7 +98,7 @@ public class MessageCounter { resetCounter(); // initialize message history - dayCounters = new ArrayList(); + dayCounters = new ArrayList<>(); setHistoryLimit(daycountmax); } @@ -261,7 +261,7 @@ public class MessageCounter { public List getHistory() { updateHistory(0); - return new ArrayList(dayCounters); + return new ArrayList<>(dayCounters); } /** diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/messagecounter/impl/MessageCounterManagerImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/messagecounter/impl/MessageCounterManagerImpl.java index ff268c9198..1183ce5a0b 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/messagecounter/impl/MessageCounterManagerImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/messagecounter/impl/MessageCounterManagerImpl.java @@ -53,7 +53,7 @@ public class MessageCounterManagerImpl implements MessageCounterManager { private final ScheduledExecutorService scheduledThreadPool; public MessageCounterManagerImpl(final ScheduledExecutorService scheduledThreadPool) { - messageCounters = new HashMap(); + messageCounters = new HashMap<>(); this.scheduledThreadPool = scheduledThreadPool; } @@ -134,7 +134,7 @@ public class MessageCounterManagerImpl implements MessageCounterManager { public Set getMessageCounters() { synchronized (messageCounters) { - return new HashSet(messageCounters.values()); + return new HashSet<>(messageCounters.values()); } } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/PagedReferenceImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/PagedReferenceImpl.java index f132723657..05b88d6a20 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/PagedReferenceImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/PagedReferenceImpl.java @@ -64,7 +64,7 @@ public class PagedReferenceImpl implements PagedReference { if (returnMessage == null) { // reference is gone, we will reconstruct it returnMessage = subscription.queryMessage(position); - message = new WeakReference(returnMessage); + message = new WeakReference<>(returnMessage); } return returnMessage; } @@ -85,7 +85,7 @@ public class PagedReferenceImpl implements PagedReference { else { this.messageEstimate = message.getMessage().getMemoryEstimate(); } - this.message = new WeakReference(message); + this.message = new WeakReference<>(message); this.subscription = subscription; } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/LivePageCacheImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/LivePageCacheImpl.java index e319667b32..fd88e7a09a 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/LivePageCacheImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/LivePageCacheImpl.java @@ -29,7 +29,7 @@ import org.apache.activemq.artemis.core.server.LargeServerMessage; */ public class LivePageCacheImpl implements LivePageCache { - private final List messages = new LinkedList(); + private final List messages = new LinkedList<>(); private final Page page; diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageCursorProviderImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageCursorProviderImpl.java index bd8dda5dcb..f9d2bb5af1 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageCursorProviderImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageCursorProviderImpl.java @@ -70,7 +70,7 @@ public class PageCursorProviderImpl implements PageCursorProvider { private final SoftValueHashMap softCache; - private final ConcurrentMap activeCursors = new ConcurrentHashMap(); + private final ConcurrentMap activeCursors = new ConcurrentHashMap<>(); // Static -------------------------------------------------------- @@ -83,7 +83,7 @@ public class PageCursorProviderImpl implements PageCursorProvider { this.pagingStore = pagingStore; this.storageManager = storageManager; this.executor = executor; - this.softCache = new SoftValueHashMap(maxCacheSize); + this.softCache = new SoftValueHashMap<>(maxCacheSize); } // Public -------------------------------------------------------- @@ -340,7 +340,7 @@ public class PageCursorProviderImpl implements PageCursorProvider { @Override public void cleanup() { - ArrayList depagedPages = new ArrayList(); + ArrayList depagedPages = new ArrayList<>(); while (true) { if (pagingStore.lock(100)) { @@ -507,7 +507,7 @@ public class PageCursorProviderImpl implements PageCursorProvider { * @return */ private synchronized ArrayList cloneSubscriptions() { - ArrayList cursorList = new ArrayList(activeCursors.values()); + ArrayList cursorList = new ArrayList<>(activeCursors.values()); return cursorList; } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageSubscriptionCounterImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageSubscriptionCounterImpl.java index c879564a97..c7b8c5c7d4 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageSubscriptionCounterImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageSubscriptionCounterImpl.java @@ -62,13 +62,13 @@ public class PageSubscriptionCounterImpl implements PageSubscriptionCounter { private final AtomicLong pendingValue = new AtomicLong(0); - private final LinkedList incrementRecords = new LinkedList(); + private final LinkedList incrementRecords = new LinkedList<>(); // We are storing pending counters for non transactional writes on page // we will recount a page case we still see pending records // as soon as we close a page we remove these records replacing by a regular page increment record // A Map per pageID, each page will have a set of IDs, with the increment on each one - private final Map> pendingCounters = new HashMap>(); + private final Map> pendingCounters = new HashMap<>(); private LinkedList> loadList; @@ -115,7 +115,7 @@ public class PageSubscriptionCounterImpl implements PageSubscriptionCounter { // not syncing this to disk may cause the page files to be out of sync on pages. // we can't afford the case where a page file is written without a record here long id = storage.storePendingCounter(this.subscriptionID, page.getPageId(), increment); - pendingInfo = new Pair(id, new AtomicInteger(1)); + pendingInfo = new Pair<>(id, new AtomicInteger(1)); pendingCounters.put((long) page.getPageId(), pendingInfo); } else { @@ -257,10 +257,10 @@ public class PageSubscriptionCounterImpl implements PageSubscriptionCounter { @Override public void loadInc(long id, int add) { if (loadList == null) { - loadList = new LinkedList>(); + loadList = new LinkedList<>(); } - loadList.add(new Pair(id, add)); + loadList.add(new Pair<>(id, add)); } @Override @@ -308,7 +308,7 @@ public class PageSubscriptionCounterImpl implements PageSubscriptionCounter { return; } valueReplace = value.get(); - deleteList = new ArrayList(incrementRecords); + deleteList = new ArrayList<>(incrementRecords); incrementRecords.clear(); } @@ -365,7 +365,7 @@ public class PageSubscriptionCounterImpl implements PageSubscriptionCounter { private static class CounterOperations extends TransactionOperationAbstract implements TransactionOperation { - LinkedList operations = new LinkedList(); + LinkedList operations = new LinkedList<>(); @Override public void afterCommit(Transaction tx) { diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageSubscriptionImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageSubscriptionImpl.java index 08bcdfcce1..b800c4bdd2 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageSubscriptionImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/cursor/impl/PageSubscriptionImpl.java @@ -86,7 +86,7 @@ final class PageSubscriptionImpl implements PageSubscription { private List recoveredACK; - private final SortedMap consumedPages = new TreeMap(); + private final SortedMap consumedPages = new TreeMap<>(); private final PageSubscriptionCounter counter; @@ -244,7 +244,7 @@ final class PageSubscriptionImpl implements PageSubscription { boolean persist = false; - final ArrayList completedPages = new ArrayList(); + final ArrayList completedPages = new ArrayList<>(); // First get the completed pages using a lock synchronized (consumedPages) { @@ -538,7 +538,7 @@ final class PageSubscriptionImpl implements PageSubscription { @Override public void reloadACK(final PagePosition position) { if (recoveredACK == null) { - recoveredACK = new LinkedList(); + recoveredACK = new LinkedList<>(); } recoveredACK.add(position); @@ -867,7 +867,7 @@ final class PageSubscriptionImpl implements PageSubscription { private WeakReference cache; - private final Set removedReferences = new ConcurrentHashSet(); + private final Set removedReferences = new ConcurrentHashSet<>(); // The page was live at the time of the creation private final boolean wasLive; @@ -909,7 +909,7 @@ final class PageSubscriptionImpl implements PageSubscription { this.numberOfMessages = numberOfMessages; if (cache != null) { wasLive = cache.isLive(); - this.cache = new WeakReference(cache); + this.cache = new WeakReference<>(cache); } else { wasLive = false; @@ -1011,7 +1011,7 @@ final class PageSubscriptionImpl implements PageSubscription { PageCache localcache = this.cache.get(); if (localcache == null) { localcache = cursorProvider.getPageCache(pageId); - this.cache = new WeakReference(localcache); + this.cache = new WeakReference<>(localcache); } return localcache.getNumberOfMessages(); @@ -1025,13 +1025,13 @@ final class PageSubscriptionImpl implements PageSubscription { private static final class PageCursorTX extends TransactionOperationAbstract { - private final Map> pendingPositions = new HashMap>(); + private final Map> pendingPositions = new HashMap<>(); private void addPositionConfirmation(final PageSubscriptionImpl cursor, final PagePosition position) { List list = pendingPositions.get(cursor); if (list == null) { - list = new LinkedList(); + list = new LinkedList<>(); pendingPositions.put(cursor, list); } @@ -1073,7 +1073,7 @@ final class PageSubscriptionImpl implements PageSubscription { private volatile PagedReference lastRedelivery = null; // We only store the position for redeliveries. They will be read from the SoftCache again during delivery. - private final java.util.Queue redeliveries = new LinkedList(); + private final java.util.Queue redeliveries = new LinkedList<>(); /** * next element taken on hasNext test. diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/Page.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/Page.java index dca0091622..b2373c92ad 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/Page.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/Page.java @@ -106,7 +106,7 @@ public final class Page implements Comparable { throw ActiveMQMessageBundle.BUNDLE.invalidPageIO(); } - ArrayList messages = new ArrayList(); + ArrayList messages = new ArrayList<>(); size.set((int) file.size()); // Using direct buffer, as described on https://jira.jboss.org/browse/HORNETQ-467 @@ -359,7 +359,7 @@ public final class Page implements Comparable { private synchronized Set getOrCreatePendingCounters() { if (pendingCounters == null) { - pendingCounters = new ConcurrentHashSet(); + pendingCounters = new ConcurrentHashSet<>(); } return pendingCounters; diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PageSyncTimer.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PageSyncTimer.java index 614f201402..a595721f9e 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PageSyncTimer.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PageSyncTimer.java @@ -49,7 +49,7 @@ final class PageSyncTimer { } }; - private final List syncOperations = new LinkedList(); + private final List syncOperations = new LinkedList<>(); // Static -------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PageTransactionInfoImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PageTransactionInfoImpl.java index 85c4489598..55569b2517 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PageTransactionInfoImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PageTransactionInfoImpl.java @@ -304,7 +304,7 @@ public final class PageTransactionInfoImpl implements PageTransactionInfo { private static class UpdatePageTXOperation extends TransactionOperationAbstract { - private final HashMap countsToUpdate = new HashMap(); + private final HashMap countsToUpdate = new HashMap<>(); private boolean stored = false; diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingManagerImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingManagerImpl.java index ce43c348dc..09dd1f69dc 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingManagerImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingManagerImpl.java @@ -44,7 +44,7 @@ public final class PagingManagerImpl implements PagingManager { */ private final ReentrantReadWriteLock syncLock = new ReentrantReadWriteLock(); - private final ConcurrentMap stores = new ConcurrentHashMap(); + private final ConcurrentMap stores = new ConcurrentHashMap<>(); private final HierarchicalRepository addressSettingsRepository; @@ -52,7 +52,7 @@ public final class PagingManagerImpl implements PagingManager { private volatile boolean cleanupEnabled = true; - private final ConcurrentMap transactions = new ConcurrentHashMap(); + private final ConcurrentMap transactions = new ConcurrentHashMap<>(); // Static // -------------------------------------------------------------------------------------------------------------------------- diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingStoreFactoryNIO.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingStoreFactoryNIO.java index b6a14f3b35..0b0d21019e 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingStoreFactoryNIO.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingStoreFactoryNIO.java @@ -136,7 +136,7 @@ public class PagingStoreFactoryNIO implements PagingStoreFactory { return Collections.emptyList(); } else { - ArrayList storesReturn = new ArrayList(files.length); + ArrayList storesReturn = new ArrayList<>(files.length); for (File file : files) { diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingStoreImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingStoreImpl.java index f224fd1d90..1463b3cdba 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingStoreImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/paging/impl/PagingStoreImpl.java @@ -622,7 +622,7 @@ public class PagingStoreImpl implements PagingStore { } - private final Queue onMemoryFreedRunnables = new ConcurrentLinkedQueue(); + private final Queue onMemoryFreedRunnables = new ConcurrentLinkedQueue<>(); private class MemoryFreedRunnablesExecutor implements Runnable { @@ -929,7 +929,7 @@ public class PagingStoreImpl implements PagingStore { private final PageTransactionInfo pageTransaction; private final StorageManager storageManager; private final PagingManager pagingManager; - private final Set usedStores = new HashSet(); + private final Set usedStores = new HashSet<>(); private boolean stored = false; @@ -1069,7 +1069,7 @@ public class PagingStoreImpl implements PagingStore { @Override public Collection getCurrentIds() throws Exception { - List ids = new ArrayList(); + List ids = new ArrayList<>(); if (fileFactory != null) { for (String fileName : fileFactory.listFiles("page")) { ids.add(getPageIdFromFileName(fileName)); diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/DescribeJournal.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/DescribeJournal.java index 14bee9114f..6d96143058 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/DescribeJournal.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/DescribeJournal.java @@ -134,7 +134,7 @@ public final class DescribeJournal { final PrintStream out = System.out; - final Map counters = new HashMap(); + final Map counters = new HashMap<>(); out.println("Journal path: " + path); @@ -249,17 +249,17 @@ public final class DescribeJournal { out.println("### Surviving Records Summary ###"); - List records = new LinkedList(); - List preparedTransactions = new LinkedList(); + List records = new LinkedList<>(); + List preparedTransactions = new LinkedList<>(); journal.start(); final StringBuffer bufferFailingTransactions = new StringBuffer(); int messageCount = 0; - Map messageRefCounts = new HashMap(); + Map messageRefCounts = new HashMap<>(); int preparedMessageCount = 0; - Map preparedMessageRefCount = new HashMap(); + Map preparedMessageRefCount = new HashMap<>(); journal.load(records, preparedTransactions, new TransactionFailureCallback() { @Override diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/JournalStorageManager.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/JournalStorageManager.java index 45a544dc34..c1f644ffae 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/JournalStorageManager.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/JournalStorageManager.java @@ -206,11 +206,11 @@ public class JournalStorageManager implements StorageManager { private final Configuration config; // Persisted core configuration - private final Map mapPersistedRoles = new ConcurrentHashMap(); + private final Map mapPersistedRoles = new ConcurrentHashMap<>(); - private final Map mapPersistedAddressSettings = new ConcurrentHashMap(); + private final Map mapPersistedAddressSettings = new ConcurrentHashMap<>(); - private final Set largeMessagesToDelete = new HashSet(); + private final Set largeMessagesToDelete = new HashSet<>(); public JournalStorageManager(final Configuration config, final ExecutorFactory executorFactory) { this(config, executorFactory, null); @@ -489,7 +489,7 @@ public class JournalStorageManager implements StorageManager { * @throws Exception */ private Map> getPageInformationForSync(PagingManager pagingManager) throws Exception { - Map> info = new HashMap>(); + Map> info = new HashMap<>(); for (SimpleString storeName : pagingManager.getStoreNames()) { PagingStore store = pagingManager.getPageStore(storeName); info.put(storeName, store.getCurrentIds()); @@ -528,18 +528,18 @@ public class JournalStorageManager implements StorageManager { */ private Map> recoverPendingLargeMessages() throws Exception { - Map> largeMessages = new HashMap>(); + Map> largeMessages = new HashMap<>(); // only send durable messages... // listFiles append a "." to anything... List filenames = largeMessagesFactory.listFiles("msg"); - List idList = new ArrayList(); + List idList = new ArrayList<>(); for (String filename : filenames) { Long id = getLargeMessageIdFromFilename(filename); if (!largeMessagesToDelete.contains(id)) { idList.add(id); SequentialFile seqFile = largeMessagesFactory.createSequentialFile(filename); long size = seqFile.size(); - largeMessages.put(id, new Pair(filename, size)); + largeMessages.put(id, new Pair<>(filename, size)); } } @@ -1201,13 +1201,13 @@ public class JournalStorageManager implements StorageManager { @Override public List recoverAddressSettings() throws Exception { - ArrayList list = new ArrayList(mapPersistedAddressSettings.values()); + ArrayList list = new ArrayList<>(mapPersistedAddressSettings.values()); return list; } @Override public List recoverPersistedRoles() throws Exception { - ArrayList list = new ArrayList(mapPersistedRoles.values()); + ArrayList list = new ArrayList<>(mapPersistedRoles.values()); return list; } @@ -1286,21 +1286,21 @@ public class JournalStorageManager implements StorageManager { final Set> pendingLargeMessages, List pendingNonTXPageCounter, final JournalLoader journalLoader) throws Exception { - List records = new ArrayList(); + List records = new ArrayList<>(); - List preparedTransactions = new ArrayList(); + List preparedTransactions = new ArrayList<>(); - Map messages = new HashMap(); + Map messages = new HashMap<>(); readLock(); try { JournalLoadInformation info = messageJournal.load(records, preparedTransactions, new LargeMessageTXFailureCallback(messages)); - ArrayList largeMessages = new ArrayList(); + ArrayList largeMessages = new ArrayList<>(); - Map> queueMap = new HashMap>(); + Map> queueMap = new HashMap<>(); - Map pageSubscriptions = new HashMap(); + Map pageSubscriptions = new HashMap<>(); final int totalSize = records.size(); @@ -1327,7 +1327,7 @@ public class JournalStorageManager implements StorageManager { if (pendingLargeMessages != null) { // it could be null on tests, and we don't need anything on that case - pendingLargeMessages.add(new Pair(record.id, pending.largeMessageID)); + pendingLargeMessages.add(new Pair<>(record.id, pending.largeMessageID)); } break; } @@ -1359,7 +1359,7 @@ public class JournalStorageManager implements StorageManager { Map queueMessages = queueMap.get(encoding.queueID); if (queueMessages == null) { - queueMessages = new LinkedHashMap(); + queueMessages = new LinkedHashMap<>(); queueMap.put(encoding.queueID, queueMessages); } @@ -1478,12 +1478,12 @@ public class JournalStorageManager implements StorageManager { List> ids = duplicateIDMap.get(encoding.address); if (ids == null) { - ids = new ArrayList>(); + ids = new ArrayList<>(); duplicateIDMap.put(encoding.address, ids); } - ids.add(new Pair(encoding.duplID, record.id)); + ids.add(new Pair<>(encoding.duplID, record.id)); break; } @@ -1805,9 +1805,9 @@ public class JournalStorageManager implements StorageManager { @Override public JournalLoadInformation loadBindingJournal(final List queueBindingInfos, final List groupingInfos) throws Exception { - List records = new ArrayList(); + List records = new ArrayList<>(); - List preparedTransactions = new ArrayList(); + List preparedTransactions = new ArrayList<>(); JournalLoadInformation bindingsInfo = bindingsJournal.load(records, preparedTransactions, null); @@ -2173,9 +2173,9 @@ public class JournalStorageManager implements StorageManager { Transaction tx = new TransactionImpl(preparedTransaction.id, xid, this); - List referencesToAck = new ArrayList(); + List referencesToAck = new ArrayList<>(); - Map messages = new HashMap(); + Map messages = new HashMap<>(); // Use same method as load message journal to prune out acks, so they don't get added. // Then have reacknowledge(tx) methods on queue, which needs to add the page size @@ -2329,7 +2329,7 @@ public class JournalStorageManager implements StorageManager { switch (b) { case ADD_LARGE_MESSAGE_PENDING: { long messageID = buff.readLong(); - if (!pendingLargeMessages.remove(new Pair(recordDeleted.id, messageID))) { + if (!pendingLargeMessages.remove(new Pair<>(recordDeleted.id, messageID))) { ActiveMQServerLogger.LOGGER.largeMessageNotFound(recordDeleted.id); } installLargeMessageConfirmationOnTX(tx, recordDeleted.id); @@ -3372,7 +3372,7 @@ public class JournalStorageManager implements StorageManager { final class TXLargeMessageConfirmationOperation extends TransactionOperationAbstract { - public List confirmedMessages = new LinkedList(); + public List confirmedMessages = new LinkedList<>(); @Override public void afterRollback(Transaction tx) { diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/OperationContextImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/OperationContextImpl.java index caa71b8843..a34a0ad510 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/OperationContextImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/persistence/impl/journal/OperationContextImpl.java @@ -43,7 +43,7 @@ import org.apache.activemq.artemis.utils.ExecutorFactory; */ public class OperationContextImpl implements OperationContext { - private static final ThreadLocal threadLocalContext = new ThreadLocal(); + private static final ThreadLocal threadLocalContext = new ThreadLocal<>(); public static void clearContext() { OperationContextImpl.threadLocalContext.set(null); @@ -136,7 +136,7 @@ public class OperationContextImpl implements OperationContext { synchronized (this) { if (tasks == null) { - tasks = new LinkedList(); + tasks = new LinkedList<>(); minimalReplicated = replicationLineUp.intValue(); minimalStore = storeLineUp.intValue(); minimalPage = pageLineUp.intValue(); diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/AddressImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/AddressImpl.java index 357decd552..d569a8cc62 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/AddressImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/AddressImpl.java @@ -33,7 +33,7 @@ public class AddressImpl implements Address { private final boolean containsWildCard; - private final List
linkedAddresses = new ArrayList
(); + private final List
linkedAddresses = new ArrayList<>(); public AddressImpl(final SimpleString address) { this.address = address; diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/BindingsImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/BindingsImpl.java index 995e0417ea..4bf80c3135 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/BindingsImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/BindingsImpl.java @@ -51,13 +51,13 @@ public final class BindingsImpl implements Bindings { private static boolean isTrace = ActiveMQServerLogger.LOGGER.isTraceEnabled(); - private final ConcurrentMap> routingNameBindingMap = new ConcurrentHashMap>(); + private final ConcurrentMap> routingNameBindingMap = new ConcurrentHashMap<>(); - private final Map routingNamePositions = new ConcurrentHashMap(); + private final Map routingNamePositions = new ConcurrentHashMap<>(); - private final Map bindingsMap = new ConcurrentHashMap(); + private final Map bindingsMap = new ConcurrentHashMap<>(); - private final List exclusiveBindings = new CopyOnWriteArrayList(); + private final List exclusiveBindings = new CopyOnWriteArrayList<>(); private volatile MessageLoadBalancingType messageLoadBalancingType = MessageLoadBalancingType.OFF; @@ -104,7 +104,7 @@ public final class BindingsImpl implements Bindings { List bindings = routingNameBindingMap.get(routingName); if (bindings == null) { - bindings = new CopyOnWriteArrayList(); + bindings = new CopyOnWriteArrayList<>(); List oldBindings = routingNameBindingMap.putIfAbsent(routingName, bindings); diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/DuplicateIDCacheImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/DuplicateIDCacheImpl.java index 9d97deeeda..0ce63663e5 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/DuplicateIDCacheImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/DuplicateIDCacheImpl.java @@ -38,7 +38,7 @@ import org.apache.activemq.artemis.core.transaction.TransactionOperationAbstract public class DuplicateIDCacheImpl implements DuplicateIDCache { // ByteHolder, position - private final Map cache = new ConcurrentHashMap(); + private final Map cache = new ConcurrentHashMap<>(); private final SimpleString address; @@ -62,7 +62,7 @@ public class DuplicateIDCacheImpl implements DuplicateIDCache { cacheSize = size; - ids = new ArrayList>(size); + ids = new ArrayList<>(size); this.storageManager = storageManager; @@ -79,7 +79,7 @@ public class DuplicateIDCacheImpl implements DuplicateIDCache { if (count < cacheSize) { ByteArrayHolder bah = new ByteArrayHolder(id.getA()); - Pair pair = new Pair(bah, id.getB()); + Pair pair = new Pair<>(bah, id.getB()); cache.put(bah, ids.size()); @@ -205,7 +205,7 @@ public class DuplicateIDCacheImpl implements DuplicateIDCache { holder.pos = pos; } else { - id = new Pair(holder, recordID >= 0 ? recordID : null); + id = new Pair<>(holder, recordID >= 0 ? recordID : null); ids.add(id); diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java index 6fcca35a84..da22bb9e0c 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/PostOfficeImpl.java @@ -116,13 +116,13 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding private final int reaperPriority; - private final ConcurrentMap duplicateIDCaches = new ConcurrentHashMap(); + private final ConcurrentMap duplicateIDCaches = new ConcurrentHashMap<>(); private final int idCacheSize; private final boolean persistIDCache; - private final Map queueInfos = new HashMap(); + private final Map queueInfos = new HashMap<>(); private final Object notificationLock = new Object(); @@ -311,7 +311,7 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding List filterStrings = info.getFilterStrings(); if (filterStrings == null) { - filterStrings = new ArrayList(); + filterStrings = new ArrayList<>(); info.setFilterStrings(filterStrings); } @@ -743,7 +743,7 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding queue.reload(reference); } else { - List refs = new ArrayList(1); + List refs = new ArrayList<>(1); refs.add(reference); @@ -773,7 +773,7 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding boolean routed = bindings.redistribute(copyRedistribute, originatingQueue, context); if (routed) { - return new Pair(context, copyRedistribute); + return new Pair<>(context, copyRedistribute); } } @@ -912,7 +912,7 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding // However if the client resends the message after receiving, it needs to be removed if ((name.startsWith(MessageImpl.HDR_ROUTE_TO_IDS) && !name.equals(MessageImpl.HDR_ROUTE_TO_IDS)) || (name.startsWith(MessageImpl.HDR_ROUTE_TO_ACK_IDS) && !name.equals(MessageImpl.HDR_ROUTE_TO_ACK_IDS))) { if (valuesToRemove == null) { - valuesToRemove = new LinkedList(); + valuesToRemove = new LinkedList<>(); } valuesToRemove.add(name); } @@ -945,7 +945,7 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding private static class PageDelivery extends TransactionOperationAbstract { - private final Set queues = new HashSet(); + private final Set queues = new HashSet<>(); public void addQueues(List queueList) { queues.addAll(queueList); @@ -972,7 +972,7 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding public void processRoute(final ServerMessage message, final RoutingContext context, final boolean direct) throws Exception { - final List refs = new ArrayList(); + final List refs = new ArrayList<>(); Transaction tx = context.getTransaction(); @@ -1124,7 +1124,7 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding List durableQueues = entry.getValue().getDurableQueues(); List nonDurableQueues = entry.getValue().getNonDurableQueues(); - final List queues = new ArrayList(durableQueues.size() + nonDurableQueues.size()); + final List queues = new ArrayList<>(durableQueues.size() + nonDurableQueues.size()); queues.addAll(durableQueues); queues.addAll(nonDurableQueues); @@ -1292,7 +1292,7 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding Map nameMap = addressManager.getBindings(); - List queues = new ArrayList(); + List queues = new ArrayList<>(); for (Binding binding : nameMap.values()) { if (binding.getType() == BindingType.LOCAL_QUEUE) { diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/SimpleAddressManager.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/SimpleAddressManager.java index 77c36f0ff8..8bfe00d2d8 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/SimpleAddressManager.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/SimpleAddressManager.java @@ -42,14 +42,14 @@ public class SimpleAddressManager implements AddressManager { /** * HashMap */ - private final ConcurrentMap mappings = new ConcurrentHashMap(); + private final ConcurrentMap mappings = new ConcurrentHashMap<>(); /** * HashMap */ - private final ConcurrentMap nameMap = new ConcurrentHashMap(); + private final ConcurrentMap nameMap = new ConcurrentHashMap<>(); - private final ConcurrentHashSet pendingDeletes = new ConcurrentHashSet(); + private final ConcurrentHashSet pendingDeletes = new ConcurrentHashSet<>(); private final BindingsFactory bindingsFactory; diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/WildcardAddressManager.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/WildcardAddressManager.java index 7020e5d099..7609355318 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/WildcardAddressManager.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/postoffice/impl/WildcardAddressManager.java @@ -47,9 +47,9 @@ public class WildcardAddressManager extends SimpleAddressManager { * These are all the addresses, we use this so we can link back from the actual address to its linked wilcard addresses * or vice versa */ - private final Map addresses = new ConcurrentHashMap(); + private final Map addresses = new ConcurrentHashMap<>(); - private final Map wildCardAddresses = new ConcurrentHashMap(); + private final Map wildCardAddresses = new ConcurrentHashMap<>(); public WildcardAddressManager(final BindingsFactory bindingsFactory) { super(bindingsFactory); diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/CoreProtocolManager.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/CoreProtocolManager.java index 270f7dcdc3..9c5b748ed6 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/CoreProtocolManager.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/CoreProtocolManager.java @@ -144,7 +144,7 @@ public class CoreProtocolManager implements ProtocolManager { return entry; } - private final Map sessionHandlers = new ConcurrentHashMap(); + private final Map sessionHandlers = new ConcurrentHashMap<>(); ServerSessionPacketHandler getSessionHandler(final String sessionName) { return sessionHandlers.get(sessionName); @@ -315,7 +315,7 @@ public class CoreProtocolManager implements ProtocolManager { @Override public void run() { String nodeId = server.getNodeID().toString(); - Pair emptyConfig = new Pair(null, null); + Pair emptyConfig = new Pair<>(null, null); if (channel0.supports(PacketImpl.CLUSTER_TOPOLOGY_V2)) { channel0.send(new ClusterTopologyChangeMessage_V2(System.currentTimeMillis(), nodeId, null, emptyConfig, true)); } @@ -331,9 +331,9 @@ public class CoreProtocolManager implements ProtocolManager { private Pair getPair(TransportConfiguration conn, boolean isBackup) { if (isBackup) { - return new Pair(null, conn); + return new Pair<>(null, conn); } - return new Pair(conn, null); + return new Pair<>(conn, null); } } } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/BackupReplicationStartFailedMessage.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/BackupReplicationStartFailedMessage.java index 0499db7488..91830f8197 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/BackupReplicationStartFailedMessage.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/BackupReplicationStartFailedMessage.java @@ -41,7 +41,7 @@ public final class BackupReplicationStartFailedMessage extends PacketImpl { } static { - HashMap map = new HashMap(); + HashMap map = new HashMap<>(); for (BackupRegistrationProblem type : EnumSet.allOf(BackupRegistrationProblem.class)) { map.put(type.code, type); } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/registry/MapBindingRegistry.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/registry/MapBindingRegistry.java index 2d1be92607..bba8776f35 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/registry/MapBindingRegistry.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/registry/MapBindingRegistry.java @@ -23,7 +23,7 @@ import org.apache.activemq.artemis.spi.core.naming.BindingRegistry; public class MapBindingRegistry implements BindingRegistry { - protected ConcurrentMap registry = new ConcurrentHashMap(); + protected ConcurrentMap registry = new ConcurrentHashMap<>(); @Override public Object lookup(String name) { diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMAcceptor.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMAcceptor.java index 3c0818c429..795a711e4f 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMAcceptor.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMAcceptor.java @@ -48,7 +48,7 @@ public final class InVMAcceptor implements Acceptor { private final ConnectionLifeCycleListener listener; - private final ConcurrentMap connections = new ConcurrentHashMap(); + private final ConcurrentMap connections = new ConcurrentHashMap<>(); private volatile boolean started; diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMConnection.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMConnection.java index f498af09a7..7931f82ae0 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMConnection.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMConnection.java @@ -258,7 +258,7 @@ public class InVMConnection implements Connection { @Override public TransportConfiguration getConnectorConfig() { - Map params = new HashMap(); + Map params = new HashMap<>(); params.put(org.apache.activemq.artemis.core.remoting.impl.invm.TransportConstants.SERVER_ID_PROP_NAME, serverID); diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMConnector.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMConnector.java index 96f6667cf7..33a314746f 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMConnector.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMConnector.java @@ -41,7 +41,7 @@ public class InVMConnector extends AbstractConnector { public static final Map DEFAULT_CONFIG; static { - Map config = new HashMap(); + Map config = new HashMap<>(); config.put(TransportConstants.SERVER_ID_PROP_NAME, TransportConstants.DEFAULT_SERVER_ID); DEFAULT_CONFIG = Collections.unmodifiableMap(config); } @@ -76,7 +76,7 @@ public class InVMConnector extends AbstractConnector { private final InVMAcceptor acceptor; - private final ConcurrentMap connections = new ConcurrentHashMap(); + private final ConcurrentMap connections = new ConcurrentHashMap<>(); private volatile boolean started; diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMRegistry.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMRegistry.java index cdb0ee3932..f166a50dba 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMRegistry.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/invm/InVMRegistry.java @@ -25,7 +25,7 @@ public final class InVMRegistry { public static final InVMRegistry instance = new InVMRegistry(); - private final ConcurrentMap acceptors = new ConcurrentHashMap(); + private final ConcurrentMap acceptors = new ConcurrentHashMap<>(); public void registerAcceptor(final int id, final InVMAcceptor acceptor) { if (acceptors.putIfAbsent(id, acceptor) != null) { diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/HttpAcceptorHandler.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/HttpAcceptorHandler.java index bc5df25859..7be3bacbcc 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/HttpAcceptorHandler.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/HttpAcceptorHandler.java @@ -43,9 +43,9 @@ import io.netty.util.ReferenceCountUtil; */ public class HttpAcceptorHandler extends ChannelDuplexHandler { - private final BlockingQueue responses = new LinkedBlockingQueue(); + private final BlockingQueue responses = new LinkedBlockingQueue<>(); - private final BlockingQueue delayedResponses = new LinkedBlockingQueue(); + private final BlockingQueue delayedResponses = new LinkedBlockingQueue<>(); private final ExecutorService executor = new ThreadPoolExecutor(1, 1, 0, TimeUnit.SECONDS, delayedResponses); diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/HttpKeepAliveRunnable.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/HttpKeepAliveRunnable.java index 651e395313..419ece43df 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/HttpKeepAliveRunnable.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/HttpKeepAliveRunnable.java @@ -25,7 +25,7 @@ import java.util.concurrent.Future; */ public class HttpKeepAliveRunnable implements Runnable { - private final List handlers = new ArrayList(); + private final List handlers = new ArrayList<>(); private boolean closed = false; diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyAcceptor.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyAcceptor.java index 94cd7aa610..ef563225f1 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyAcceptor.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyAcceptor.java @@ -147,7 +147,7 @@ public class NettyAcceptor implements Acceptor { private final int nioRemotingThreads; - private final ConcurrentMap connections = new ConcurrentHashMap(); + private final ConcurrentMap connections = new ConcurrentHashMap<>(); private final Map configuration; diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/server/impl/RemotingServiceImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/server/impl/RemotingServiceImpl.java index 30f6ac4009..f56fb46e9f 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/server/impl/RemotingServiceImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/server/impl/RemotingServiceImpl.java @@ -87,9 +87,9 @@ public class RemotingServiceImpl implements RemotingService, ConnectionLifeCycle private final List outgoingInterceptors = new CopyOnWriteArrayList<>(); - private final Map acceptors = new HashMap(); + private final Map acceptors = new HashMap<>(); - private final Map connections = new ConcurrentHashMap(); + private final Map connections = new ConcurrentHashMap<>(); private final ReusableLatch connectionCountLatch = new ReusableLatch(0); @@ -318,7 +318,7 @@ public class RemotingServiceImpl implements RemotingService, ConnectionLifeCycle if (!started) return; failureCheckAndFlushThread.close(false); - HashMap connectionEntries = new HashMap(connections); + HashMap connectionEntries = new HashMap<>(connections); // Now we ensure that no connections will process any more packets after this method is // complete then send a disconnect packet @@ -366,7 +366,7 @@ public class RemotingServiceImpl implements RemotingService, ConnectionLifeCycle ActiveMQServerLogger.LOGGER.debug("Sending disconnect on live connections"); } - HashSet connectionEntries = new HashSet(connections.values()); + HashSet connectionEntries = new HashSet<>(connections.values()); // Now we ensure that no connections will process any more packets after this method is complete // then send a disconnect packet @@ -452,7 +452,7 @@ public class RemotingServiceImpl implements RemotingService, ConnectionLifeCycle @Override public synchronized Set getConnections() { - Set conns = new HashSet(connections.size()); + Set conns = new HashSet<>(connections.size()); for (ConnectionEntry entry : connections.values()) { conns.add(entry.connection); @@ -661,7 +661,7 @@ public class RemotingServiceImpl implements RemotingService, ConnectionLifeCycle try { long now = System.currentTimeMillis(); - Set idsToRemove = new HashSet(); + Set idsToRemove = new HashSet<>(); for (ConnectionEntry entry : connections.values()) { final RemotingConnection conn = entry.connection; diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/replication/ReplicationEndpoint.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/replication/ReplicationEndpoint.java index 2caaa8dd7d..63e393520f 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/replication/ReplicationEndpoint.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/replication/ReplicationEndpoint.java @@ -102,20 +102,20 @@ public final class ReplicationEndpoint implements ChannelHandler, ActiveMQCompon /** * Files reserved in each journal for synchronization of existing data from the 'live' server. */ - private final Map> filesReservedForSync = new HashMap>(); + private final Map> filesReservedForSync = new HashMap<>(); /** * Used to hold the real Journals before the backup is synchronized. This field should be * {@code null} on an up-to-date server. */ - private Map journalsHolder = new HashMap(); + private Map journalsHolder = new HashMap<>(); private StorageManager storageManager; private PagingManager pageManager; - private final ConcurrentMap> pageIndex = new ConcurrentHashMap>(); - private final ConcurrentMap largeMessages = new ConcurrentHashMap(); + private final ConcurrentMap> pageIndex = new ConcurrentHashMap<>(); + private final ConcurrentMap largeMessages = new ConcurrentHashMap<>(); // Used on tests, to simulate failures on delete pages private boolean deletePages = true; @@ -715,7 +715,7 @@ public final class ReplicationEndpoint implements ChannelHandler, ActiveMQCompon ConcurrentMap resultIndex = pageIndex.get(storeName); if (resultIndex == null) { - resultIndex = new ConcurrentHashMap(); + resultIndex = new ConcurrentHashMap<>(); ConcurrentMap mapResult = pageIndex.putIfAbsent(storeName, resultIndex); if (mapResult != null) { resultIndex = mapResult; diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/replication/ReplicationManager.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/replication/ReplicationManager.java index 4759cfa9e1..255415bdb4 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/replication/ReplicationManager.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/replication/ReplicationManager.java @@ -109,7 +109,7 @@ public final class ReplicationManager implements ActiveMQComponent { private final Object replicationLock = new Object(); - private final Queue pendingTokens = new ConcurrentLinkedQueue(); + private final Queue pendingTokens = new ConcurrentLinkedQueue<>(); private final ExecutorFactory executorFactory; @@ -302,7 +302,7 @@ public final class ReplicationManager implements ActiveMQComponent { */ public Set getActiveTokens() { - LinkedHashSet activeContexts = new LinkedHashSet(); + LinkedHashSet activeContexts = new LinkedHashSet<>(); // The same context will be replicated on the pending tokens... // as the multiple operations will be replicated on the same context @@ -577,7 +577,7 @@ public final class ReplicationManager implements ActiveMQComponent { */ public void sendLargeMessageIdListMessage(Map> largeMessages) { ArrayList idsToSend; - idsToSend = new ArrayList(largeMessages.keySet()); + idsToSend = new ArrayList<>(largeMessages.keySet()); if (enabled) sendReplicatePacket(new ReplicationStartSyncMessage(idsToSend)); diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/security/impl/SecurityStoreImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/security/impl/SecurityStoreImpl.java index 514ec8dfa3..2807b47b9d 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/security/impl/SecurityStoreImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/security/impl/SecurityStoreImpl.java @@ -55,7 +55,7 @@ public class SecurityStoreImpl implements SecurityStore, HierarchicalRepositoryC private final ActiveMQSecurityManager securityManager; - private final ConcurrentMap> cache = new ConcurrentHashMap>(); + private final ConcurrentMap> cache = new ConcurrentHashMap<>(); private final long invalidationInterval; @@ -196,7 +196,7 @@ public class SecurityStoreImpl implements SecurityStore, HierarchicalRepositoryC throw ActiveMQMessageBundle.BUNDLE.userNoPermissions(session.getUsername(), checkType, saddress); } // if we get here we're granted, add to the cache - ConcurrentHashSet set = new ConcurrentHashSet(); + ConcurrentHashSet set = new ConcurrentHashSet<>(); ConcurrentHashSet act = cache.putIfAbsent(user + "." + checkType.name(), set); if (act != null) { set = act; diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ClusterManager.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ClusterManager.java index 1a6271d386..9bb449a9a0 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ClusterManager.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ClusterManager.java @@ -135,9 +135,9 @@ public final class ClusterManager implements ActiveMQComponent { private volatile State state = State.STOPPED; // the cluster connections which links this node to other cluster nodes - private final Map clusterConnections = new HashMap(); + private final Map clusterConnections = new HashMap<>(); - private final Set clusterLocators = new ConcurrentHashSet(); + private final Set clusterLocators = new ConcurrentHashSet<>(); private final Executor executor; @@ -359,15 +359,15 @@ public final class ClusterManager implements ActiveMQComponent { } public Map getBridges() { - return new HashMap(bridges); + return new HashMap<>(bridges); } public Set getClusterConnections() { - return new HashSet(clusterConnections.values()); + return new HashSet<>(clusterConnections.values()); } public Set getBroadcastGroups() { - return new HashSet(broadcastGroups.values()); + return new HashSet<>(broadcastGroups.values()); } public ClusterConnection getClusterConnection(final String name) { @@ -682,7 +682,7 @@ public final class ClusterManager implements ActiveMQComponent { } private synchronized Collection cloneClusterConnections() { - ArrayList list = new ArrayList(clusterConnections.values()); + ArrayList list = new ArrayList<>(clusterConnections.values()); return list; } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/BridgeImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/BridgeImpl.java index 2ddcaeb99c..ac75a1c9d3 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/BridgeImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/BridgeImpl.java @@ -98,7 +98,7 @@ public class BridgeImpl implements Bridge, SessionFailureListener, SendAcknowled private final SimpleString forwardingAddress; - private final java.util.Queue refs = new ConcurrentLinkedQueue(); + private final java.util.Queue refs = new ConcurrentLinkedQueue<>(); private final Transformer transformer; @@ -228,7 +228,7 @@ public class BridgeImpl implements Bridge, SessionFailureListener, SendAcknowled @Override public List getDeliveringMessages() { synchronized (this) { - return new ArrayList(refs); + return new ArrayList<>(refs); } } @@ -270,7 +270,7 @@ public class BridgeImpl implements Bridge, SessionFailureListener, SendAcknowled private void cancelRefs() { MessageReference ref; - LinkedList list = new LinkedList(); + LinkedList list = new LinkedList<>(); while ((ref = refs.poll()) != null) { if (isTrace) { diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/BroadcastGroupImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/BroadcastGroupImpl.java index 7a5dbc467c..277b9253cc 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/BroadcastGroupImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/BroadcastGroupImpl.java @@ -50,7 +50,7 @@ public class BroadcastGroupImpl implements BroadcastGroup, Runnable { private final String name; - private final List connectors = new ArrayList(); + private final List connectors = new ArrayList<>(); private boolean started; diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/ClusterConnectionBridge.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/ClusterConnectionBridge.java index 3963b0271f..7bcc6b2b99 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/ClusterConnectionBridge.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/ClusterConnectionBridge.java @@ -156,7 +156,7 @@ public class ClusterConnectionBridge extends BridgeImpl { // TODO - we can optimise this - Set propNames = new HashSet(messageCopy.getPropertyNames()); + Set propNames = new HashSet<>(messageCopy.getPropertyNames()); byte[] queueIds = message.getBytesProperty(idsHeaderName); @@ -289,8 +289,8 @@ public class ClusterConnectionBridge extends BridgeImpl { } public static String buildSelectorFromArray(String[] list) { - List includes = new ArrayList(); - List excludes = new ArrayList(); + List includes = new ArrayList<>(); + List excludes = new ArrayList<>(); // Split the list into addresses to match and addresses to exclude. for (int i = 0; i < list.length; i++) { diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/ClusterConnectionImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/ClusterConnectionImpl.java index 12ca5e3633..9624ab9c36 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/ClusterConnectionImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/ClusterConnectionImpl.java @@ -123,9 +123,9 @@ public final class ClusterConnectionImpl implements ClusterConnection, AfterConn * however we need the guard to synchronize multiple step operations during topology updates. */ private final Object recordsGuard = new Object(); - private final Map records = new ConcurrentHashMap(); + private final Map records = new ConcurrentHashMap<>(); - private final Map disconnectedRecords = new ConcurrentHashMap(); + private final Map disconnectedRecords = new ConcurrentHashMap<>(); private final ScheduledExecutorService scheduledExecutor; @@ -147,7 +147,7 @@ public final class ClusterConnectionImpl implements ClusterConnection, AfterConn private final boolean allowDirectConnectionsOnly; - private final Set allowableConnections = new HashSet(); + private final Set allowableConnections = new HashSet<>(); private final ClusterManager manager; @@ -547,7 +547,7 @@ public final class ClusterConnectionImpl implements ClusterConnection, AfterConn @Override public Map getNodes() { synchronized (recordsGuard) { - Map nodes = new HashMap(); + Map nodes = new HashMap<>(); for (Entry entry : records.entrySet()) { RemotingConnection fwdConnection = entry.getValue().getBridge().getForwardingConnection(); if (fwdConnection != null) { @@ -828,7 +828,7 @@ public final class ClusterConnectionImpl implements ClusterConnection, AfterConn private final Queue queue; - private final Map bindings = new HashMap(); + private final Map bindings = new HashMap<>(); private volatile boolean isClosed = false; @@ -1122,7 +1122,7 @@ public final class ClusterConnectionImpl implements ClusterConnection, AfterConn private synchronized void clearBindings() throws Exception { ActiveMQServerLogger.LOGGER.debug(ClusterConnectionImpl.this + " clearing bindings"); - for (RemoteQueueBinding binding : new HashSet(bindings.values())) { + for (RemoteQueueBinding binding : new HashSet<>(bindings.values())) { removeBinding(binding.getClusterName()); } } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/RemoteQueueBindingImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/RemoteQueueBindingImpl.java index 883d36e394..6ff0733dd8 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/RemoteQueueBindingImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/RemoteQueueBindingImpl.java @@ -49,9 +49,9 @@ public class RemoteQueueBindingImpl implements RemoteQueueBinding { private final Filter queueFilter; - private final Set filters = new HashSet(); + private final Set filters = new HashSet<>(); - private final Map filterCounts = new HashMap(); + private final Map filterCounts = new HashMap<>(); private int consumerCount; diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/group/impl/LocalGroupingHandler.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/group/impl/LocalGroupingHandler.java index 09a8fc315a..eb43313bdd 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/group/impl/LocalGroupingHandler.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/group/impl/LocalGroupingHandler.java @@ -46,9 +46,9 @@ import org.apache.activemq.artemis.utils.TypedProperties; */ public final class LocalGroupingHandler extends GroupHandlingAbstract { - private final ConcurrentMap map = new ConcurrentHashMap(); + private final ConcurrentMap map = new ConcurrentHashMap<>(); - private final ConcurrentMap> groupMap = new ConcurrentHashMap>(); + private final ConcurrentMap> groupMap = new ConcurrentHashMap<>(); private final SimpleString name; @@ -65,7 +65,7 @@ public final class LocalGroupingHandler extends GroupHandlingAbstract { * when the group is waiting for them. * During a small window between the server is started and the wait wasn't called yet, this will contain bindings that were already added */ - private List expectedBindings = new LinkedList(); + private List expectedBindings = new LinkedList<>(); private final long groupTimeout; @@ -136,7 +136,7 @@ public final class LocalGroupingHandler extends GroupHandlingAbstract { addRecord = true; groupBinding = new GroupBinding(proposal.getGroupId(), proposal.getClusterName()); groupBinding.setId(storageManager.generateID()); - List newList = new ArrayList(); + List newList = new ArrayList<>(); List oldList = groupMap.putIfAbsent(groupBinding.getClusterName(), newList); if (oldList != null) { newList = oldList; @@ -196,7 +196,7 @@ public final class LocalGroupingHandler extends GroupHandlingAbstract { @Override public void addGroupBinding(final GroupBinding groupBinding) { map.put(groupBinding.getGroupId(), groupBinding); - List newList = new ArrayList(); + List newList = new ArrayList<>(); List oldList = groupMap.putIfAbsent(groupBinding.getClusterName(), newList); if (oldList != null) { newList = oldList; @@ -248,10 +248,10 @@ public final class LocalGroupingHandler extends GroupHandlingAbstract { List bindingsAlreadyAdded; if (expectedBindings == null) { bindingsAlreadyAdded = Collections.emptyList(); - expectedBindings = new LinkedList(); + expectedBindings = new LinkedList<>(); } else { - bindingsAlreadyAdded = new ArrayList(expectedBindings); + bindingsAlreadyAdded = new ArrayList<>(expectedBindings); //clear the bindings expectedBindings.clear(); } @@ -331,7 +331,7 @@ public final class LocalGroupingHandler extends GroupHandlingAbstract { if (expectedBindings == null) { // just in case the component is restarted - expectedBindings = new LinkedList(); + expectedBindings = new LinkedList<>(); } if (reaperPeriod > 0 && groupTimeout > 0) { diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/group/impl/RemoteGroupingHandler.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/group/impl/RemoteGroupingHandler.java index 57763d531a..06ddc9551e 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/group/impl/RemoteGroupingHandler.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/group/impl/RemoteGroupingHandler.java @@ -48,7 +48,7 @@ public final class RemoteGroupingHandler extends GroupHandlingAbstract { private final SimpleString name; - private final Map responses = new ConcurrentHashMap(); + private final Map responses = new ConcurrentHashMap<>(); private final Lock lock = new ReentrantLock(); @@ -58,7 +58,7 @@ public final class RemoteGroupingHandler extends GroupHandlingAbstract { private final long groupTimeout; - private final ConcurrentMap> groupMap = new ConcurrentHashMap>(); + private final ConcurrentMap> groupMap = new ConcurrentHashMap<>(); private final ConcurrentHashSet pendingNotifications = new ConcurrentHashSet(); @@ -240,7 +240,7 @@ public final class RemoteGroupingHandler extends GroupHandlingAbstract { try { lock.lock(); responses.put(response.getGroupId(), response); - List newList = new ArrayList(); + List newList = new ArrayList<>(); List oldList = groupMap.putIfAbsent(response.getChosenClusterName(), newList); if (oldList != null) { newList = oldList; diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java index 70d3bbd92a..8b3dae087b 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java @@ -230,7 +230,7 @@ public class ActiveMQServerImpl implements ActiveMQServer { */ private QueueCreator jmsQueueCreator; - private final Map sessions = new ConcurrentHashMap(); + private final Map sessions = new ConcurrentHashMap<>(); /** * This class here has the same principle of CountDownLatch but you can reuse the counters. @@ -238,7 +238,7 @@ public class ActiveMQServerImpl implements ActiveMQServer { */ private final ReusableLatch activationLatch = new ReusableLatch(0); - private final Set activateCallbacks = new ConcurrentHashSet(); + private final Set activateCallbacks = new ConcurrentHashSet<>(); private volatile GroupingHandler groupingHandler; @@ -329,11 +329,11 @@ public class ActiveMQServerImpl implements ActiveMQServer { this.securityManager = securityManager; - addressSettingsRepository = new HierarchicalObjectRepository(); + addressSettingsRepository = new HierarchicalObjectRepository<>(); addressSettingsRepository.setDefault(new AddressSettings()); - securityRepository = new HierarchicalObjectRepository>(); + securityRepository = new HierarchicalObjectRepository<>(); securityRepository.setDefault(new HashSet()); @@ -1130,7 +1130,7 @@ public class ActiveMQServerImpl implements ActiveMQServer { @Override public synchronized List getSessions(final String connectionID) { Set> sessionEntries = sessions.entrySet(); - List matchingSessions = new ArrayList(); + List matchingSessions = new ArrayList<>(); for (Entry sessionEntry : sessionEntries) { ServerSession serverSession = sessionEntry.getValue(); if (serverSession.getConnectionID().toString().equals(connectionID)) { @@ -1142,7 +1142,7 @@ public class ActiveMQServerImpl implements ActiveMQServer { @Override public synchronized Set getSessions() { - return new HashSet(sessions.values()); + return new HashSet<>(sessions.values()); } @Override @@ -1773,11 +1773,11 @@ public class ActiveMQServerImpl implements ActiveMQServer { journalLoader.handleGroupingBindings(groupingInfos); - Map>> duplicateIDMap = new HashMap>>(); + Map>> duplicateIDMap = new HashMap<>(); - HashSet> pendingLargeMessages = new HashSet>(); + HashSet> pendingLargeMessages = new HashSet<>(); - List pendingNonTXPageCounter = new LinkedList(); + List pendingNonTXPageCounter = new LinkedList<>(); journalInfo[1] = storageManager.loadMessageJournal(postOffice, pagingManager, resourceManager, queueBindingInfosMap, duplicateIDMap, pendingLargeMessages, pendingNonTXPageCounter, journalLoader); diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/AnyLiveNodeLocatorForReplication.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/AnyLiveNodeLocatorForReplication.java index 6d2923a064..859daaa18a 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/AnyLiveNodeLocatorForReplication.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/AnyLiveNodeLocatorForReplication.java @@ -40,8 +40,8 @@ public class AnyLiveNodeLocatorForReplication extends LiveNodeLocator { private final Lock lock = new ReentrantLock(); private final Condition condition = lock.newCondition(); private final ActiveMQServerImpl server; - Map> untriedConnectors = new HashMap>(); - Map> triedConnectors = new HashMap>(); + Map> untriedConnectors = new HashMap<>(); + Map> triedConnectors = new HashMap<>(); private String nodeID; @@ -83,7 +83,7 @@ public class AnyLiveNodeLocatorForReplication extends LiveNodeLocator { public void nodeUP(TopologyMember topologyMember, boolean last) { try { lock.lock(); - Pair connector = new Pair(topologyMember.getLive(), topologyMember.getBackup()); + Pair connector = new Pair<>(topologyMember.getLive(), topologyMember.getBackup()); if (server.checkLiveIsNotColocated(topologyMember.getNodeId())) { untriedConnectors.put(topologyMember.getNodeId(), connector); diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ConnectorsService.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ConnectorsService.java index 789b9b6d52..912f7213eb 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ConnectorsService.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ConnectorsService.java @@ -52,7 +52,7 @@ public final class ConnectorsService implements ActiveMQComponent { private final Configuration configuration; - private final Set connectors = new HashSet(); + private final Set connectors = new HashSet<>(); private final ServiceRegistry serviceRegistry; diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/LastValueQueue.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/LastValueQueue.java index c474a45b07..5420688e18 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/LastValueQueue.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/LastValueQueue.java @@ -44,7 +44,7 @@ import org.apache.activemq.artemis.core.settings.impl.AddressSettings; */ public class LastValueQueue extends QueueImpl { - private final Map map = new ConcurrentHashMap(); + private final Map map = new ConcurrentHashMap<>(); public LastValueQueue(final long persistenceID, final SimpleString address, diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/LegacyLDAPSecuritySettingPlugin.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/LegacyLDAPSecuritySettingPlugin.java index cc24dd5a10..21de3d7565 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/LegacyLDAPSecuritySettingPlugin.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/LegacyLDAPSecuritySettingPlugin.java @@ -202,7 +202,7 @@ public class LegacyLDAPSecuritySettingPlugin implements SecuritySettingPlugin { return; } - Hashtable env = new Hashtable(); + Hashtable env = new Hashtable<>(); env.put(Context.INITIAL_CONTEXT_FACTORY, initialContextFactory); if (connectionUsername != null && !"".equals(connectionUsername)) { env.put(Context.SECURITY_PRINCIPAL, connectionUsername); @@ -242,7 +242,7 @@ public class LegacyLDAPSecuritySettingPlugin implements SecuritySettingPlugin { searchControls.setReturningAttributes(new String[]{roleAttribute}); searchControls.setSearchScope(SearchControls.SUBTREE_SCOPE); - Map> securityRoles = new HashMap>(); + Map> securityRoles = new HashMap<>(); try { NamingEnumeration searchResults = context.search(destinationBase, filter, searchControls); int i = 0; diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/NamedLiveNodeLocatorForReplication.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/NamedLiveNodeLocatorForReplication.java index 38bbc54454..862e3a6d61 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/NamedLiveNodeLocatorForReplication.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/NamedLiveNodeLocatorForReplication.java @@ -80,7 +80,7 @@ public class NamedLiveNodeLocatorForReplication extends LiveNodeLocator { try { lock.lock(); if (backupGroupName.equals(topologyMember.getBackupGroupName()) && topologyMember.getLive() != null) { - liveConfiguration = new Pair(topologyMember.getLive(), topologyMember.getBackup()); + liveConfiguration = new Pair<>(topologyMember.getLive(), topologyMember.getBackup()); nodeID = topologyMember.getNodeId(); condition.signal(); } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/NamedLiveNodeLocatorForScaleDown.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/NamedLiveNodeLocatorForScaleDown.java index 6b6c25b286..663148a959 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/NamedLiveNodeLocatorForScaleDown.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/NamedLiveNodeLocatorForScaleDown.java @@ -86,7 +86,7 @@ public class NamedLiveNodeLocatorForScaleDown extends LiveNodeLocator { public void nodeUP(TopologyMember topologyMember, boolean last) { try { lock.lock(); - Pair connector = new Pair(topologyMember.getLive(), topologyMember.getBackup()); + Pair connector = new Pair<>(topologyMember.getLive(), topologyMember.getBackup()); if (topologyMember.getNodeId().equals(myNodeID)) { if (ActiveMQServerLogger.LOGGER.isTraceEnabled()) { diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/PostOfficeJournalLoader.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/PostOfficeJournalLoader.java index cd6908ee91..e67142e42d 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/PostOfficeJournalLoader.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/PostOfficeJournalLoader.java @@ -337,7 +337,7 @@ public class PostOfficeJournalLoader implements JournalLoader { pg.open(); List pgMessages = pg.read(storageManager); - Map countsPerQueueOnPage = new HashMap(); + Map countsPerQueueOnPage = new HashMap<>(); for (PagedMessage pgd : pgMessages) { if (pgd.getTransactionID() <= 0) { @@ -405,7 +405,7 @@ public class PostOfficeJournalLoader implements JournalLoader { private Map>>> generateMapsOnPendingCount(Map queues, List pendingNonTXPageCounter, Transaction txRecoverCounter) throws Exception { - Map>>> perAddressMap = new HashMap>>>(); + Map>>> perAddressMap = new HashMap<>(); for (PageCountPending pgCount : pendingNonTXPageCounter) { long queueID = pgCount.getQueueID(); long pageID = pgCount.getPageID(); @@ -441,7 +441,7 @@ public class PostOfficeJournalLoader implements JournalLoader { List pendingCounters = perQueueMap.get(queueID); if (pendingCounters == null) { - pendingCounters = new LinkedList(); + pendingCounters = new LinkedList<>(); perQueueMap.put(queueID, pendingCounters); } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java index bea9f6d748..5d7053e163 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java @@ -143,10 +143,10 @@ public class QueueImpl implements Queue { // Messages will first enter intermediateMessageReferences // Before they are added to messageReferences // This is to avoid locking the queue on the producer - private final ConcurrentLinkedQueue intermediateMessageReferences = new ConcurrentLinkedQueue(); + private final ConcurrentLinkedQueue intermediateMessageReferences = new ConcurrentLinkedQueue<>(); // This is where messages are stored - private final PriorityLinkedList messageReferences = new PriorityLinkedListImpl(QueueImpl.NUM_PRIORITIES); + private final PriorityLinkedList messageReferences = new PriorityLinkedListImpl<>(QueueImpl.NUM_PRIORITIES); // The quantity of pagedReferences on messageReferences priority list private final AtomicInteger pagedReferences = new AtomicInteger(0); @@ -157,7 +157,7 @@ public class QueueImpl implements Queue { // used to control if we should recalculate certain positions inside deliverAsync private volatile boolean consumersChanged = true; - private final List consumerList = new CopyOnWriteArrayList(); + private final List consumerList = new CopyOnWriteArrayList<>(); private final ScheduledDeliveryHandler scheduledDeliveryHandler; @@ -190,7 +190,7 @@ public class QueueImpl implements Queue { private Redistributor redistributor; - private final Set> futures = new ConcurrentHashSet>(); + private final Set> futures = new ConcurrentHashSet<>(); private ScheduledFuture redistributorFuture; @@ -198,9 +198,9 @@ public class QueueImpl implements Queue { // We cache the consumers here since we don't want to include the redistributor - private final Set consumerSet = new HashSet(); + private final Set consumerSet = new HashSet<>(); - private final Map groups = new HashMap(); + private final Map groups = new HashMap<>(); private volatile SimpleString expiryAddress; @@ -252,7 +252,7 @@ public class QueueImpl implements Queue { } synchronized (this) { - ArrayList groupsUsed = new ArrayList(); + ArrayList groupsUsed = new ArrayList<>(); groupsUsed.addAll(groups.keySet()); return groupsUsed; } @@ -740,7 +740,7 @@ public class QueueImpl implements Queue { for (SimpleString groupID : groups.keySet()) { if (consumer == groups.get(groupID)) { if (groupsToRemove == null) { - groupsToRemove = new LinkedList(); + groupsToRemove = new LinkedList<>(); } groupsToRemove.add(groupID); } @@ -823,7 +823,7 @@ public class QueueImpl implements Queue { @Override public synchronized Set getConsumers() { - return new HashSet(consumerSet); + return new HashSet<>(consumerSet); } @Override @@ -944,7 +944,7 @@ public class QueueImpl implements Queue { List consumerListClone = cloneConsumersList(); - Map> mapReturn = new HashMap>(); + Map> mapReturn = new HashMap<>(); for (ConsumerHolder holder : consumerListClone) { List msgs = holder.consumer.getDeliveringMessages(); @@ -2551,7 +2551,7 @@ public class QueueImpl implements Queue { List consumerListClone; synchronized (this) { - consumerListClone = new ArrayList(consumerList); + consumerListClone = new ArrayList<>(consumerList); } return consumerListClone; } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/RefsOperation.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/RefsOperation.java index e11af87809..d1171863ef 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/RefsOperation.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/RefsOperation.java @@ -35,7 +35,7 @@ public class RefsOperation extends TransactionOperationAbstract { private final StorageManager storageManager; private Queue queue; - List refsToAck = new ArrayList(); + List refsToAck = new ArrayList<>(); List pagedMessagesToPostACK = null; @@ -59,7 +59,7 @@ public class RefsOperation extends TransactionOperationAbstract { refsToAck.add(ref); if (ref.isPaged()) { if (pagedMessagesToPostACK == null) { - pagedMessagesToPostACK = new ArrayList(); + pagedMessagesToPostACK = new ArrayList<>(); } pagedMessagesToPostACK.add(ref.getMessage()); } @@ -67,7 +67,7 @@ public class RefsOperation extends TransactionOperationAbstract { @Override public void afterRollback(final Transaction tx) { - Map> queueMap = new HashMap>(); + Map> queueMap = new HashMap<>(); long timeBase = System.currentTimeMillis(); @@ -90,7 +90,7 @@ public class RefsOperation extends TransactionOperationAbstract { LinkedList toCancel = queueMap.get(ref.getQueue()); if (toCancel == null) { - toCancel = new LinkedList(); + toCancel = new LinkedList<>(); queueMap.put((QueueImpl) ref.getQueue(), toCancel); } @@ -165,14 +165,14 @@ public class RefsOperation extends TransactionOperationAbstract { @Override public synchronized List getRelatedMessageReferences() { - List listRet = new LinkedList(); + List listRet = new LinkedList<>(); listRet.addAll(listRet); return listRet; } @Override public synchronized List getListOnConsumer(long consumerID) { - List list = new LinkedList(); + List list = new LinkedList<>(); for (MessageReference ref : refsToAck) { if (ref.getConsumerId() != null && ref.getConsumerId().equals(consumerID)) { list.add(ref); diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/RoutingContextImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/RoutingContextImpl.java index 1a5bcbdf93..6bbeaf4c7a 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/RoutingContextImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/RoutingContextImpl.java @@ -30,7 +30,7 @@ import org.apache.activemq.artemis.core.transaction.Transaction; public final class RoutingContextImpl implements RoutingContext { // The pair here is Durable and NonDurable - private final Map map = new HashMap(); + private final Map map = new HashMap<>(); private Transaction transaction; @@ -119,9 +119,9 @@ public final class RoutingContextImpl implements RoutingContext { private static class ContextListing implements RouteContextList { - private final List durableQueue = new ArrayList(1); + private final List durableQueue = new ArrayList<>(1); - private final List nonDurableQueue = new ArrayList(1); + private final List nonDurableQueue = new ArrayList<>(1); private final List ackedQueues = new ArrayList<>(); diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ScaleDownHandler.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ScaleDownHandler.java index 48a56bfa5c..8f63476e27 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ScaleDownHandler.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ScaleDownHandler.java @@ -142,7 +142,7 @@ public class ScaleDownHandler { ActiveMQServerLogger.LOGGER.debug("Scaling down messages on address " + address); long messageCount = 0; - final HashMap controls = new HashMap(); + final HashMap controls = new HashMap<>(); PagingStore pageStore = pagingManager.getPageStore(address); diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ScheduledDeliveryHandlerImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ScheduledDeliveryHandlerImpl.java index 9fc5bab800..f9ee1cef9c 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ScheduledDeliveryHandlerImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ScheduledDeliveryHandlerImpl.java @@ -86,7 +86,7 @@ public class ScheduledDeliveryHandlerImpl implements ScheduledDeliveryHandler { @Override public List getScheduledReferences() { - List refs = new LinkedList(); + List refs = new LinkedList<>(); synchronized (scheduledReferences) { for (RefScheduled ref : scheduledReferences) { @@ -98,7 +98,7 @@ public class ScheduledDeliveryHandlerImpl implements ScheduledDeliveryHandler { @Override public List cancel(final Filter filter) { - List refs = new ArrayList(); + List refs = new ArrayList<>(); synchronized (scheduledReferences) { Iterator iter = scheduledReferences.iterator(); @@ -170,7 +170,7 @@ public class ScheduledDeliveryHandlerImpl implements ScheduledDeliveryHandler { @Override public void run() { - HashMap> refs = new HashMap>(); + HashMap> refs = new HashMap<>(); runnables.remove(deliveryTime); @@ -212,7 +212,7 @@ public class ScheduledDeliveryHandlerImpl implements ScheduledDeliveryHandler { LinkedList references = refs.get(reference.getQueue()); if (references == null) { - references = new LinkedList(); + references = new LinkedList<>(); refs.put(reference.getQueue(), references); } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerConsumerImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerConsumerImpl.java index e74b60eadb..243d139bed 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerConsumerImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerConsumerImpl.java @@ -117,7 +117,7 @@ public class ServerConsumerImpl implements ServerConsumer, ReadyListener { private final StorageManager storageManager; - protected final java.util.Queue deliveringRefs = new ConcurrentLinkedQueue(); + protected final java.util.Queue deliveringRefs = new ConcurrentLinkedQueue<>(); private final SessionCallback callback; @@ -260,7 +260,7 @@ public class ServerConsumerImpl implements ServerConsumer, ReadyListener { @Override public List getDeliveringMessages() { - List refs = new LinkedList(); + List refs = new LinkedList<>(); synchronized (lock) { List refsOnConsumer = session.getInTXMessagesForConsumer(this.id); if (refsOnConsumer != null) { @@ -529,7 +529,7 @@ public class ServerConsumerImpl implements ServerConsumer, ReadyListener { largeMessageDeliverer = null; } - LinkedList refs = new LinkedList(); + LinkedList refs = new LinkedList<>(); synchronized (lock) { if (!deliveringRefs.isEmpty()) { diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java index 26d9bb4231..d036fdfacd 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java @@ -114,7 +114,7 @@ public class ServerSessionImpl implements ServerSession, FailureListener { protected final RemotingConnection remotingConnection; - protected final Map consumers = new ConcurrentHashMap(); + protected final Map consumers = new ConcurrentHashMap<>(); protected Transaction tx; @@ -132,7 +132,7 @@ public class ServerSessionImpl implements ServerSession, FailureListener { protected volatile boolean started = false; - protected final Map tempQueueCleannerUppers = new HashMap(); + protected final Map tempQueueCleannerUppers = new HashMap<>(); protected final String name; @@ -158,7 +158,7 @@ public class ServerSessionImpl implements ServerSession, FailureListener { private QueueCreator queueCreator; // Session's usage should be by definition single threaded, hence it's not needed to use a concurrentHashMap here - protected final Map> targetAddressInfos = new HashMap>(); + protected final Map> targetAddressInfos = new HashMap<>(); private final long creationTime = System.currentTimeMillis(); @@ -311,7 +311,7 @@ public class ServerSessionImpl implements ServerSession, FailureListener { @Override public Set getServerConsumers() { - Set consumersClone = new HashSet(consumers.values()); + Set consumersClone = new HashSet<>(consumers.values()); return Collections.unmodifiableSet(consumersClone); } @@ -339,7 +339,7 @@ public class ServerSessionImpl implements ServerSession, FailureListener { //putting closing of consumers outside the sync block //https://issues.jboss.org/browse/HORNETQ-1141 - Set consumersClone = new HashSet(consumers.values()); + Set consumersClone = new HashSet<>(consumers.values()); for (ServerConsumer consumer : consumersClone) { try { @@ -649,7 +649,7 @@ public class ServerSessionImpl implements ServerSession, FailureListener { throw ActiveMQMessageBundle.BUNDLE.addressIsNull(); } - List names = new ArrayList(); + List names = new ArrayList<>(); // make an exception for the management address (see HORNETQ-29) if (address.equals(managementAddress)) { @@ -1159,7 +1159,7 @@ public class ServerSessionImpl implements ServerSession, FailureListener { @Override public List xaGetInDoubtXids() { - List xids = new ArrayList(); + List xids = new ArrayList<>(); xids.addAll(resourceManager.getPreparedTransactions()); xids.addAll(resourceManager.getHeuristicCommittedTransactions()); @@ -1366,7 +1366,7 @@ public class ServerSessionImpl implements ServerSession, FailureListener { @Override public void setTransferring(final boolean transferring) { - Set consumersClone = new HashSet(consumers.values()); + Set consumersClone = new HashSet<>(consumers.values()); for (ServerConsumer consumer : consumersClone) { consumer.setTransferring(transferring); @@ -1376,7 +1376,7 @@ public class ServerSessionImpl implements ServerSession, FailureListener { @Override public void addMetaData(String key, String data) { if (metaData == null) { - metaData = new HashMap(); + metaData = new HashMap<>(); } metaData.put(key, data); } @@ -1511,11 +1511,11 @@ public class ServerSessionImpl implements ServerSession, FailureListener { } private Map> cloneTargetAddresses() { - return new HashMap>(targetAddressInfos); + return new HashMap<>(targetAddressInfos); } private void setStarted(final boolean s) { - Set consumersClone = new HashSet(consumers.values()); + Set consumersClone = new HashSet<>(consumers.values()); for (ServerConsumer consumer : consumersClone) { consumer.setStarted(s); @@ -1551,7 +1551,7 @@ public class ServerSessionImpl implements ServerSession, FailureListener { final Transaction theTx) throws Exception { boolean wasStarted = started; - List toCancel = new ArrayList(); + List toCancel = new ArrayList<>(); for (ServerConsumer consumer : consumers.values()) { if (wasStarted) { @@ -1621,7 +1621,7 @@ public class ServerSessionImpl implements ServerSession, FailureListener { Pair value = targetAddressInfos.get(msg.getAddress()); if (value == null) { - targetAddressInfos.put(msg.getAddress(), new Pair(msg.getUserID(), new AtomicLong(1))); + targetAddressInfos.put(msg.getAddress(), new Pair<>(msg.getUserID(), new AtomicLong(1))); } else { value.setA(msg.getUserID()); diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImpl.java index 053f81dbd6..891e719186 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImpl.java @@ -124,7 +124,7 @@ public class ManagementServiceImpl implements ManagementService { private boolean notificationsEnabled; - private final Set listeners = new ConcurrentHashSet(); + private final Set listeners = new ConcurrentHashSet<>(); private final ObjectNameBuilder objectNameBuilder; @@ -139,7 +139,7 @@ public class ManagementServiceImpl implements ManagementService { managementAddress = configuration.getManagementAddress(); managementNotificationAddress = configuration.getManagementNotificationAddress(); - registry = new ConcurrentHashMap(); + registry = new ConcurrentHashMap<>(); broadcaster = new NotificationBroadcasterSupport(); notificationsEnabled = true; objectNameBuilder = ObjectNameBuilder.create(configuration.getJMXDomain()); @@ -282,7 +282,7 @@ public class ManagementServiceImpl implements ManagementService { @Override public void unregisterAcceptors() { - List acceptors = new ArrayList(); + List acceptors = new ArrayList<>(); synchronized (this) { for (String resourceName : registry.keySet()) { if (resourceName.startsWith(ResourceNames.CORE_ACCEPTOR)) { @@ -431,8 +431,8 @@ public class ManagementServiceImpl implements ManagementService { @Override public synchronized Object[] getResources(final Class resourceType) { - List resources = new ArrayList(); - Collection clone = new ArrayList(registry.values()); + List resources = new ArrayList<>(); + Collection clone = new ArrayList<>(registry.values()); for (Object entry : clone) { if (resourceType.isAssignableFrom(entry.getClass())) { resources.add(entry); @@ -441,7 +441,7 @@ public class ManagementServiceImpl implements ManagementService { return resources.toArray(new Object[resources.size()]); } - private final Set registeredNames = new HashSet(); + private final Set registeredNames = new HashSet<>(); @Override public void registerInJMX(final ObjectName objectName, final Object managedResource) throws Exception { @@ -521,7 +521,7 @@ public class ManagementServiceImpl implements ManagementService { @Override public synchronized void stop() throws Exception { - Set resourceNames = new HashSet(registry.keySet()); + Set resourceNames = new HashSet<>(registry.keySet()); for (String resourceName : resourceNames) { unregisterFromRegistry(resourceName); @@ -529,7 +529,7 @@ public class ManagementServiceImpl implements ManagementService { if (jmxManagementEnabled) { if (!registeredNames.isEmpty()) { - List unexpectedResourceNames = new ArrayList(); + List unexpectedResourceNames = new ArrayList<>(); for (String name : resourceNames) { // only addresses and queues should still be registered if (!(name.startsWith(ResourceNames.CORE_ADDRESS) || name.startsWith(ResourceNames.CORE_QUEUE))) { diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/settings/impl/HierarchicalObjectRepository.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/settings/impl/HierarchicalObjectRepository.java index fa2029389b..ad375c444c 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/settings/impl/HierarchicalObjectRepository.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/settings/impl/HierarchicalObjectRepository.java @@ -49,7 +49,7 @@ public class HierarchicalObjectRepository implements HierarchicalRepository> matches = new HashMap>(); + private final Map> matches = new HashMap<>(); /** * Certain values cannot be removed after installed. @@ -58,7 +58,7 @@ public class HierarchicalObjectRepository implements HierarchicalRepository immutables = new HashSet(); + private final Set immutables = new HashSet<>(); /** * a regex comparator @@ -68,7 +68,7 @@ public class HierarchicalObjectRepository implements HierarchicalRepository cache = new ConcurrentHashMap(); + private final Map cache = new ConcurrentHashMap<>(); /** * Need a lock instead of using multiple {@link ConcurrentHashMap}s. @@ -89,7 +89,7 @@ public class HierarchicalObjectRepository implements HierarchicalRepository listeners = new ArrayList(); + private final ArrayList listeners = new ArrayList<>(); @Override public void disableListeners() { @@ -123,7 +123,7 @@ public class HierarchicalObjectRepository implements HierarchicalRepository values() { lock.readLock().lock(); try { - ArrayList values = new ArrayList(matches.size()); + ArrayList values = new ArrayList<>(matches.size()); for (Match matchValue : matches.values()) { values.add(matchValue.getValue()); @@ -152,7 +152,7 @@ public class HierarchicalObjectRepository implements HierarchicalRepository match1 = new Match(match); + Match match1 = new Match<>(match); match1.setValue(value); matches.put(match, match1); } @@ -228,9 +228,9 @@ public class HierarchicalObjectRepository implements HierarchicalRepository> sort(final Map> possibleMatches) { - List keys = new ArrayList(possibleMatches.keySet()); + List keys = new ArrayList<>(possibleMatches.keySet()); Collections.sort(keys, matchComparator); - List> matches1 = new ArrayList>(possibleMatches.size()); + List> matches1 = new ArrayList<>(possibleMatches.size()); for (String key : keys) { matches1.add(possibleMatches.get(key)); } @@ -350,7 +350,7 @@ public class HierarchicalObjectRepository implements HierarchicalRepository> getPossibleMatches(final String match) { - HashMap> possibleMatches = new HashMap>(); + HashMap> possibleMatches = new HashMap<>(); for (Entry> entry : matches.entrySet()) { Match entryMatch = entry.getValue(); diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/transaction/impl/ResourceManagerImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/transaction/impl/ResourceManagerImpl.java index e811dd0ccc..0db783f1ce 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/transaction/impl/ResourceManagerImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/transaction/impl/ResourceManagerImpl.java @@ -36,9 +36,9 @@ import org.apache.activemq.artemis.core.transaction.Transaction; public class ResourceManagerImpl implements ResourceManager { - private final ConcurrentMap transactions = new ConcurrentHashMap(); + private final ConcurrentMap transactions = new ConcurrentHashMap<>(); - private final List heuristicCompletions = new ArrayList(); + private final List heuristicCompletions = new ArrayList<>(); private final int defaultTimeoutSeconds; @@ -113,7 +113,7 @@ public class ResourceManagerImpl implements ResourceManager { @Override public List getPreparedTransactions() { - List xids = new ArrayList(); + List xids = new ArrayList<>(); for (Map.Entry entry : transactions.entrySet()) { if (entry.getValue().getState() == Transaction.State.PREPARED) { @@ -125,7 +125,7 @@ public class ResourceManagerImpl implements ResourceManager { @Override public Map getPreparedTransactionsWithCreationTime() { - Map xidsWithCreationTime = new HashMap(); + Map xidsWithCreationTime = new HashMap<>(); for (Map.Entry entry : transactions.entrySet()) { xidsWithCreationTime.put(entry.getKey(), entry.getValue().getCreateTime()); @@ -162,7 +162,7 @@ public class ResourceManagerImpl implements ResourceManager { } private List getHeuristicCompletedTransactions(final boolean isCommit) { - List xids = new ArrayList(); + List xids = new ArrayList<>(); for (HeuristicCompletionHolder holder : heuristicCompletions) { if (holder.isCommit == isCommit) { xids.add(holder.xid); @@ -183,7 +183,7 @@ public class ResourceManagerImpl implements ResourceManager { return; } - Set timedoutTransactions = new HashSet(); + Set timedoutTransactions = new HashSet<>(); long now = System.currentTimeMillis(); diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/transaction/impl/TransactionImpl.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/transaction/impl/TransactionImpl.java index c84e6f00a4..3490feee21 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/transaction/impl/TransactionImpl.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/transaction/impl/TransactionImpl.java @@ -394,10 +394,10 @@ public class TransactionImpl implements Transaction { public synchronized List getAllOperations() { if (operations != null) { - return new ArrayList(operations); + return new ArrayList<>(operations); } else { - return new ArrayList(); + return new ArrayList<>(); } } @@ -430,7 +430,7 @@ public class TransactionImpl implements Transaction { private void checkCreateOperations() { if (operations == null) { - operations = new ArrayList(); + operations = new ArrayList<>(); } } diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/CertificateLoginModule.java b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/CertificateLoginModule.java index 20d107e13f..d2fe1fe05b 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/CertificateLoginModule.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/CertificateLoginModule.java @@ -45,7 +45,7 @@ public abstract class CertificateLoginModule extends PropertiesLoader implements private X509Certificate[] certificates; private String username; private Set roles; - private Set principals = new HashSet(); + private Set principals = new HashSet<>(); /** * Overriding to allow for proper initialization. Standard JAAS. diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/GuestLoginModule.java b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/GuestLoginModule.java index 22da502ad4..a1b596417f 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/GuestLoginModule.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/GuestLoginModule.java @@ -48,7 +48,7 @@ public class GuestLoginModule implements LoginModule { private Subject subject; private boolean debug; private boolean credentialsInvalidate; - private Set principals = new HashSet(); + private Set principals = new HashSet<>(); private CallbackHandler callbackHandler; private boolean loginSucceeded; diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/InVMLoginModule.java b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/InVMLoginModule.java index d91d6395d8..b1b3b42745 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/InVMLoginModule.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/InVMLoginModule.java @@ -41,7 +41,7 @@ public class InVMLoginModule implements LoginModule { private SecurityConfiguration configuration; private Subject subject; private String user; - private Set principals = new HashSet(); + private Set principals = new HashSet<>(); private CallbackHandler callbackHandler; private boolean loginSucceeded; diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/LDAPLoginModule.java b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/LDAPLoginModule.java index 15346ac741..7afb8e41df 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/LDAPLoginModule.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/LDAPLoginModule.java @@ -79,7 +79,7 @@ public class LDAPLoginModule implements LoginModule { private CallbackHandler handler; private LDAPLoginProperty[] config; private String username; - private Set groups = new HashSet(); + private Set groups = new HashSet<>(); @Override public void initialize(Subject subject, CallbackHandler callbackHandler, Map sharedState, Map options) { @@ -191,7 +191,7 @@ public class LDAPLoginModule implements LoginModule { } // setup attributes - List list = new ArrayList(); + List list = new ArrayList<>(); if (isLoginPropertySet(USER_ROLE_NAME)) { list.add(getLDAPPropertyValue(USER_ROLE_NAME)); } @@ -313,7 +313,7 @@ public class LDAPLoginModule implements LoginModule { expandRolesBool = Boolean.valueOf(getLDAPPropertyValue(EXPAND_ROLES)).booleanValue(); if (list == null) { - list = new ArrayList(); + list = new ArrayList<>(); } if (!isLoginPropertySet(ROLE_NAME)) { return list; @@ -333,8 +333,8 @@ public class LDAPLoginModule implements LoginModule { ActiveMQServerLogger.LOGGER.debug(" base DN: " + getLDAPPropertyValue(ROLE_BASE)); ActiveMQServerLogger.LOGGER.debug(" filter: " + filter); } - HashSet haveSeenNames = new HashSet(); - Queue pendingNameExpansion = new LinkedList(); + HashSet haveSeenNames = new HashSet<>(); + Queue pendingNameExpansion = new LinkedList<>(); NamingEnumeration results = context.search(getLDAPPropertyValue(ROLE_BASE), filter, constraints); while (results.hasMore()) { SearchResult result = results.next(); @@ -443,7 +443,7 @@ public class LDAPLoginModule implements LoginModule { return values; } if (values == null) { - values = new ArrayList(); + values = new ArrayList<>(); } Attribute attr = attrs.get(attrId); if (attr == null) { @@ -459,7 +459,7 @@ public class LDAPLoginModule implements LoginModule { protected DirContext open() throws NamingException { try { - Hashtable env = new Hashtable(); + Hashtable env = new Hashtable<>(); env.put(Context.INITIAL_CONTEXT_FACTORY, getLDAPPropertyValue(INITIAL_CONTEXT_FACTORY)); if (isLoginPropertySet(CONNECTION_USERNAME)) { env.put(Context.SECURITY_PRINCIPAL, getLDAPPropertyValue(CONNECTION_USERNAME)); diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/PropertiesLoader.java b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/PropertiesLoader.java index a83ce0dbfd..ba8839a586 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/PropertiesLoader.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/PropertiesLoader.java @@ -24,7 +24,7 @@ import org.apache.activemq.artemis.core.server.ActiveMQServerLogger; public class PropertiesLoader { - static Map staticCache = new HashMap(); + static Map staticCache = new HashMap<>(); protected boolean debug; public void init(Map options) { diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/PropertiesLoginModule.java b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/PropertiesLoginModule.java index 0a75a24a14..c870b28f1f 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/PropertiesLoginModule.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/PropertiesLoginModule.java @@ -45,7 +45,7 @@ public class PropertiesLoginModule extends PropertiesLoader implements LoginModu private Properties users; private Properties roles; private String user; - private final Set principals = new HashSet(); + private final Set principals = new HashSet<>(); private boolean loginSucceeded; @Override diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/TextFileCertificateLoginModule.java b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/TextFileCertificateLoginModule.java index b1e4ba7bf6..8bfac9b058 100644 --- a/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/TextFileCertificateLoginModule.java +++ b/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/TextFileCertificateLoginModule.java @@ -84,7 +84,7 @@ public class TextFileCertificateLoginModule extends CertificateLoginModule { */ @Override protected Set getUserRoles(String username) throws LoginException { - Set userRoles = new HashSet(); + Set userRoles = new HashSet<>(); for (Enumeration enumeration = roles.keys(); enumeration.hasMoreElements(); ) { String groupName = (String) enumeration.nextElement(); String[] userList = (roles.getProperty(groupName) + "").split(","); diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/FileConfigurationParserTest.java b/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/FileConfigurationParserTest.java index e2d2f83860..99a45efa23 100644 --- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/FileConfigurationParserTest.java +++ b/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/FileConfigurationParserTest.java @@ -106,7 +106,7 @@ public class FileConfigurationParserTest extends ActiveMQTestBase { //if we change key, it should be able to decode correctly codec = new DefaultSensitiveStringCodec(); - Map prop = new HashMap(); + Map prop = new HashMap<>(); prop.put("key", "newkey"); codec.init(prop); diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/list/PriorityLinkedListTest.java b/artemis-server/src/test/java/org/apache/activemq/artemis/core/list/PriorityLinkedListTest.java index 7dcf7a0a37..d464410eef 100644 --- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/list/PriorityLinkedListTest.java +++ b/artemis-server/src/test/java/org/apache/activemq/artemis/core/list/PriorityLinkedListTest.java @@ -79,7 +79,7 @@ public final class PriorityLinkedListTest extends Assert { private PriorityLinkedListImpl list; protected PriorityLinkedListImpl getList() { - return new PriorityLinkedListImpl(10); + return new PriorityLinkedListImpl<>(10); } @Before diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/security/jaas/CertificateLoginModuleTest.java b/artemis-server/src/test/java/org/apache/activemq/artemis/core/security/jaas/CertificateLoginModuleTest.java index 24069ddbfa..44889732c2 100644 --- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/security/jaas/CertificateLoginModuleTest.java +++ b/artemis-server/src/test/java/org/apache/activemq/artemis/core/security/jaas/CertificateLoginModuleTest.java @@ -37,7 +37,7 @@ import org.junit.Test; public class CertificateLoginModuleTest extends Assert { private static final String USER_NAME = "testUser"; - private static final List ROLE_NAMES = new Vector(); + private static final List ROLE_NAMES = new Vector<>(); private StubCertificateLoginModule loginModule; @@ -56,7 +56,7 @@ public class CertificateLoginModuleTest extends Assert { } private void loginWithCredentials(String userName, Set rolesNames) throws LoginException { - loginModule = new StubCertificateLoginModule(userName, new HashSet(rolesNames)); + loginModule = new StubCertificateLoginModule(userName, new HashSet<>(rolesNames)); JaasCallbackHandler callbackHandler = new JaasCallbackHandler(null, null, null); loginModule.initialize(subject, callbackHandler, null, new HashMap()); @@ -113,7 +113,7 @@ public class CertificateLoginModuleTest extends Assert { @Test public void testLoginSuccess() throws IOException { try { - loginWithCredentials(USER_NAME, new HashSet(ROLE_NAMES)); + loginWithCredentials(USER_NAME, new HashSet<>(ROLE_NAMES)); } catch (Exception e) { fail("Unable to login: " + e.getMessage()); @@ -141,7 +141,7 @@ public class CertificateLoginModuleTest extends Assert { @Test public void testLogOut() throws IOException { try { - loginWithCredentials(USER_NAME, new HashSet(ROLE_NAMES)); + loginWithCredentials(USER_NAME, new HashSet<>(ROLE_NAMES)); } catch (Exception e) { fail("Unable to login: " + e.getMessage()); diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/security/jaas/PropertiesLoginModuleRaceConditionTest.java b/artemis-server/src/test/java/org/apache/activemq/artemis/core/security/jaas/PropertiesLoginModuleRaceConditionTest.java index 13907f8d79..8b24306bee 100644 --- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/security/jaas/PropertiesLoginModuleRaceConditionTest.java +++ b/artemis-server/src/test/java/org/apache/activemq/artemis/core/security/jaas/PropertiesLoginModuleRaceConditionTest.java @@ -93,7 +93,7 @@ public class PropertiesLoginModuleRaceConditionTest { Subject subject = new Subject(); PropertiesLoginModule module = new PropertiesLoginModule(); - module.initialize(subject, callback, new HashMap(), options); + module.initialize(subject, callback, new HashMap<>(), options); module.login(); module.commit(); } @@ -111,14 +111,14 @@ public class PropertiesLoginModuleRaceConditionTest { createUsers(); createGroups(); - options = new HashMap(); + options = new HashMap<>(); options.put("reload", "true"); // Used to simplify reproduction of the // race condition options.put("org.apache.activemq.jaas.properties.user", USERS_FILE); options.put("org.apache.activemq.jaas.properties.role", ROLES_FILE); options.put("baseDir", temp.getRoot().getAbsolutePath()); - errors = new ArrayBlockingQueue(processorCount()); + errors = new ArrayBlockingQueue<>(processorCount()); pool = Executors.newFixedThreadPool(processorCount()); callback = new JaasCallbackHandler(USERNAME, PASSWORD, null); } diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/group/impl/ClusteredResetMockTest.java b/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/group/impl/ClusteredResetMockTest.java index c309db0cac..3ccb311eef 100644 --- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/group/impl/ClusteredResetMockTest.java +++ b/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/group/impl/ClusteredResetMockTest.java @@ -102,7 +102,7 @@ public class ClusteredResetMockTest extends ActiveMQTestBase { assertTrue(latchSends.await(10, TimeUnit.SECONDS)); - HashSet codesAsked = new HashSet(); + HashSet codesAsked = new HashSet<>(); for (Notification notification : fake.pendingNotifications) { codesAsked.add(notification.getProperties().getSimpleStringProperty(ManagementHelper.HDR_PROPOSAL_GROUP_ID)); @@ -172,7 +172,7 @@ public class ClusteredResetMockTest extends ActiveMQTestBase { class FakeManagement implements ManagementService { - public ConcurrentHashSet pendingNotifications = new ConcurrentHashSet(); + public ConcurrentHashSet pendingNotifications = new ConcurrentHashSet<>(); final ReusableLatch latch; diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/impl/ScheduledDeliveryHandlerTest.java b/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/impl/ScheduledDeliveryHandlerTest.java index c6af9a7772..562fbd1263 100644 --- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/impl/ScheduledDeliveryHandlerTest.java +++ b/artemis-server/src/test/java/org/apache/activemq/artemis/core/server/impl/ScheduledDeliveryHandlerTest.java @@ -259,7 +259,7 @@ public class ScheduledDeliveryHandlerTest extends Assert { private void debugList(boolean fail, ScheduledDeliveryHandlerImpl handler, long numberOfExpectedMessages) { List refs = handler.getScheduledReferences(); - HashSet messages = new HashSet(); + HashSet messages = new HashSet<>(); long lastTime = -1; diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/core/settings/RepositoryTest.java b/artemis-server/src/test/java/org/apache/activemq/artemis/core/settings/RepositoryTest.java index c738f049db..06acedec5a 100644 --- a/artemis-server/src/test/java/org/apache/activemq/artemis/core/settings/RepositoryTest.java +++ b/artemis-server/src/test/java/org/apache/activemq/artemis/core/settings/RepositoryTest.java @@ -71,11 +71,11 @@ public class RepositoryTest extends ActiveMQTestBase { @Test public void testSingletwo() { securityRepository.addMatch("queues.another.aq.*", new HashSet()); - HashSet roles = new HashSet(2); + HashSet roles = new HashSet<>(2); roles.add(new Role("test1", true, true, true, true, true, true, true)); roles.add(new Role("test2", true, true, true, true, true, true, true)); securityRepository.addMatch("queues.aq", roles); - HashSet roles2 = new HashSet(2); + HashSet roles2 = new HashSet<>(2); roles2.add(new Role("test1", true, true, true, true, true, true, true)); roles2.add(new Role("test2", true, true, true, true, true, true, true)); roles2.add(new Role("test3", true, true, true, true, true, true, true)); @@ -88,7 +88,7 @@ public class RepositoryTest extends ActiveMQTestBase { @Test public void testWithoutWildcard() { securityRepository.addMatch("queues.1.*", new HashSet()); - HashSet roles = new HashSet(2); + HashSet roles = new HashSet<>(2); roles.add(new Role("test1", true, true, true, true, true, true, true)); roles.add(new Role("test2", true, true, true, true, true, true, true)); securityRepository.addMatch("queues.2.aq", roles); @@ -98,7 +98,7 @@ public class RepositoryTest extends ActiveMQTestBase { @Test public void testMultipleWildcards() { - HierarchicalRepository repository = new HierarchicalObjectRepository(); + HierarchicalRepository repository = new HierarchicalObjectRepository<>(); repository.addMatch("#", "#"); repository.addMatch("a", "a"); repository.addMatch("a.#", "a.#"); @@ -142,7 +142,7 @@ public class RepositoryTest extends ActiveMQTestBase { @Test public void testRepositoryMerge() { - HierarchicalRepository repository = new HierarchicalObjectRepository(); + HierarchicalRepository repository = new HierarchicalObjectRepository<>(); repository.addMatch("#", new DummyMergeable(1)); repository.addMatch("a.#", new DummyMergeable(2)); repository.addMatch("b.#", new DummyMergeable(3)); @@ -172,7 +172,7 @@ public class RepositoryTest extends ActiveMQTestBase { @Test public void testAddListener() { - HierarchicalRepository repository = new HierarchicalObjectRepository(); + HierarchicalRepository repository = new HierarchicalObjectRepository<>(); repository.addMatch("#", "1"); repository.addMatch("B", "2"); @@ -213,7 +213,7 @@ public class RepositoryTest extends ActiveMQTestBase { @Test public void testIllegalMatches() { - HierarchicalRepository repository = new HierarchicalObjectRepository(); + HierarchicalRepository repository = new HierarchicalObjectRepository<>(); try { repository.addMatch("hjhjhjhjh.#.hhh", "test"); fail("expected exception"); @@ -234,13 +234,13 @@ public class RepositoryTest extends ActiveMQTestBase { static int timesMerged = 0; - static ArrayList merged = new ArrayList(); + static ArrayList merged = new ArrayList<>(); private final Integer id; static void reset() { DummyMergeable.timesMerged = 0; - DummyMergeable.merged = new ArrayList(); + DummyMergeable.merged = new ArrayList<>(); } static boolean contains(final Integer i) { diff --git a/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java b/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java index b8cd129640..34f1ca9a5e 100644 --- a/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java +++ b/artemis-server/src/test/java/org/apache/activemq/artemis/tests/util/ActiveMQTestBase.java @@ -161,16 +161,16 @@ public abstract class ActiveMQTestBase extends Assert { protected static final long WAIT_TIMEOUT = 30000; // There is a verification about thread leakages. We only fail a single thread when this happens - private static Set alreadyFailedThread = new HashSet(); + private static Set alreadyFailedThread = new HashSet<>(); - private final Collection servers = new ArrayList(); - private final Collection locators = new ArrayList(); - private final Collection sessionFactories = new ArrayList(); - private final Collection clientSessions = new HashSet(); - private final Collection clientConsumers = new HashSet(); - private final Collection clientProducers = new HashSet(); - private final Collection otherComponents = new HashSet(); - private final Set executorSet = new HashSet(); + private final Collection servers = new ArrayList<>(); + private final Collection locators = new ArrayList<>(); + private final Collection sessionFactories = new ArrayList<>(); + private final Collection clientSessions = new HashSet<>(); + private final Collection clientConsumers = new HashSet<>(); + private final Collection clientProducers = new HashSet<>(); + private final Collection otherComponents = new HashSet<>(); + private final Set executorSet = new HashSet<>(); private boolean checkThread = true; private String testDir; @@ -466,7 +466,7 @@ public abstract class ActiveMQTestBase extends Assert { } protected Map generateInVMParams(final int node) { - Map params = new HashMap(); + Map params = new HashMap<>(); params.put(org.apache.activemq.artemis.core.remoting.impl.invm.TransportConstants.SERVER_ID_PROP_NAME, node); @@ -547,7 +547,7 @@ public abstract class ActiveMQTestBase extends Assert { long waitUntil = System.currentTimeMillis() + timeout; // A loop that will wait GC, using the minimal time as possible while (ref.get() != null && System.currentTimeMillis() < waitUntil) { - ArrayList list = new ArrayList(); + ArrayList list = new ArrayList<>(); for (int i = 0; i < 1000; i++) { list.add("Some string with garbage with concatenation " + i); } @@ -750,7 +750,7 @@ public abstract class ActiveMQTestBase extends Assert { // The connectors need to be pre-configured at main config object but this method is taking // TransportConfigurations directly // So this will first register them at the config and then generate a list of objects - ArrayList connectors = new ArrayList(); + ArrayList connectors = new ArrayList<>(); for (TransportConfiguration tnsp : connectorConfigs) { String name1 = RandomUtil.randomString(); @@ -1017,7 +1017,7 @@ public abstract class ActiveMQTestBase extends Assert { * You can pass a list of properties to be ignored, as some properties will have a pre-defined domain (not being possible to use random-values on them) */ protected void validateGettersAndSetters(final Object pojo, final String... ignoredProperties) throws Exception { - HashSet ignoreSet = new HashSet(); + HashSet ignoreSet = new HashSet<>(); for (String ignore : ignoredProperties) { ignoreSet.add(ignore); @@ -1186,7 +1186,7 @@ public abstract class ActiveMQTestBase extends Assert { } protected static final Map generateParams(final int node, final boolean netty) { - Map params = new HashMap(); + Map params = new HashMap<>(); if (netty) { params.put(org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants.PORT_PROP_NAME, org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants.DEFAULT_PORT + node); @@ -1203,7 +1203,7 @@ public abstract class ActiveMQTestBase extends Assert { return new TransportConfiguration(NETTY_ACCEPTOR_FACTORY); } - Map server1Params = new HashMap(); + Map server1Params = new HashMap<>(); server1Params.put(org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants.PORT_PROP_NAME, org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants.DEFAULT_PORT + 1); @@ -1215,7 +1215,7 @@ public abstract class ActiveMQTestBase extends Assert { return new TransportConfiguration(NETTY_CONNECTOR_FACTORY); } - Map server1Params = new HashMap(); + Map server1Params = new HashMap<>(); server1Params.put(org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants.PORT_PROP_NAME, org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants.DEFAULT_PORT + 1); return new TransportConfiguration(NETTY_CONNECTOR_FACTORY, server1Params); @@ -1242,7 +1242,7 @@ public abstract class ActiveMQTestBase extends Assert { } } if (params == null) - params = new HashMap(); + params = new HashMap<>(); return new TransportConfiguration(className, params); } @@ -1531,7 +1531,7 @@ public abstract class ActiveMQTestBase extends Assert { * @return */ protected final TransportConfiguration createInVMTransportConnectorConfig(final int serverID, String name1) { - Map server1Params = new HashMap(); + Map server1Params = new HashMap<>(); if (serverID != 0) { server1Params.put(TransportConstants.SERVER_ID_PROP_NAME, serverID); @@ -1631,14 +1631,14 @@ public abstract class ActiveMQTestBase extends Assert { SequentialFileFactory messagesFF = new NIOSequentialFileFactory(new File(getJournalDir()), null, 1); messagesJournal = new JournalImpl(config.getJournalFileSize(), config.getJournalMinFiles(), 0, 0, messagesFF, "activemq-data", "amq", 1); - final List committedRecords = new LinkedList(); - final List preparedTransactions = new LinkedList(); + final List committedRecords = new LinkedList<>(); + final List preparedTransactions = new LinkedList<>(); messagesJournal.start(); messagesJournal.load(committedRecords, preparedTransactions, null, false); - return new Pair, List>(committedRecords, preparedTransactions); + return new Pair<>(committedRecords, preparedTransactions); } finally { try { @@ -1661,7 +1661,7 @@ public abstract class ActiveMQTestBase extends Assert { * @throws Exception */ protected HashMap countJournal(Configuration config) throws Exception { - final HashMap recordsType = new HashMap(); + final HashMap recordsType = new HashMap<>(); SequentialFileFactory messagesFF = new NIOSequentialFileFactory(config.getJournalLocation(), null, 1); JournalImpl messagesJournal = new JournalImpl(config.getJournalFileSize(), config.getJournalMinFiles(), 0, 0, messagesFF, "activemq-data", "amq", 1); @@ -1694,7 +1694,7 @@ public abstract class ActiveMQTestBase extends Assert { */ protected HashMap internalCountJournalLivingRecords(Configuration config, boolean messageJournal) throws Exception { - final HashMap recordsType = new HashMap(); + final HashMap recordsType = new HashMap<>(); SequentialFileFactory ff; JournalImpl journal; @@ -1709,8 +1709,8 @@ public abstract class ActiveMQTestBase extends Assert { } journal.start(); - final List committedRecords = new LinkedList(); - final List preparedTransactions = new LinkedList(); + final List committedRecords = new LinkedList<>(); + final List preparedTransactions = new LinkedList<>(); journal.load(committedRecords, preparedTransactions, null, false); @@ -2251,7 +2251,7 @@ public abstract class ActiveMQTestBase extends Assert { private List getLocalQueueBindings(final PostOffice postOffice, final String address) throws Exception { - ArrayList bindingsFound = new ArrayList(); + ArrayList bindingsFound = new ArrayList<>(); Bindings bindings = postOffice.getBindingsForAddress(new SimpleString(address)); diff --git a/artemis-service-extensions/src/main/java/org/apache/activemq/artemis/service/extensions/xa/recovery/ActiveMQXAResourceRecovery.java b/artemis-service-extensions/src/main/java/org/apache/activemq/artemis/service/extensions/xa/recovery/ActiveMQXAResourceRecovery.java index 3b2b3e7824..f22f295a06 100644 --- a/artemis-service-extensions/src/main/java/org/apache/activemq/artemis/service/extensions/xa/recovery/ActiveMQXAResourceRecovery.java +++ b/artemis-service-extensions/src/main/java/org/apache/activemq/artemis/service/extensions/xa/recovery/ActiveMQXAResourceRecovery.java @@ -172,7 +172,7 @@ public class ActiveMQXAResourceRecovery { } // other tokens are for connector configurations - connectorParameters = new HashMap(); + connectorParameters = new HashMap<>(); if (strings.length >= 3) { for (int i = 3; i < strings.length; i++) { String[] str = strings[i].split("="); diff --git a/artemis-service-extensions/src/test/java/org/apache/activemq/artemis/service/extensions/tests/xa/ActiveMQXAResourceWrapperImplTest.java b/artemis-service-extensions/src/test/java/org/apache/activemq/artemis/service/extensions/tests/xa/ActiveMQXAResourceWrapperImplTest.java index eff8533b38..3d7f37ec61 100644 --- a/artemis-service-extensions/src/test/java/org/apache/activemq/artemis/service/extensions/tests/xa/ActiveMQXAResourceWrapperImplTest.java +++ b/artemis-service-extensions/src/test/java/org/apache/activemq/artemis/service/extensions/tests/xa/ActiveMQXAResourceWrapperImplTest.java @@ -35,7 +35,7 @@ public class ActiveMQXAResourceWrapperImplTest { String nodeId = "0"; XAResource xaResource = new MockXAResource(); - Map xaResourceWrapperProperties = new HashMap(); + Map xaResourceWrapperProperties = new HashMap<>(); xaResourceWrapperProperties.put(ActiveMQXAResourceWrapper.ACTIVEMQ_JNDI_NAME, jndiName); xaResourceWrapperProperties.put(ActiveMQXAResourceWrapper.ACTIVEMQ_NODE_ID, nodeId); xaResourceWrapperProperties.put(ActiveMQXAResourceWrapper.ACTIVEMQ_PRODUCT_VERSION, "6"); diff --git a/examples/features/clustered/clustered-jgroups/src/main/java/org/apache/activemq/artemis/jms/example/ClusteredJgroupsExample.java b/examples/features/clustered/clustered-jgroups/src/main/java/org/apache/activemq/artemis/jms/example/ClusteredJgroupsExample.java index f8016b1fb7..5f956b5b32 100644 --- a/examples/features/clustered/clustered-jgroups/src/main/java/org/apache/activemq/artemis/jms/example/ClusteredJgroupsExample.java +++ b/examples/features/clustered/clustered-jgroups/src/main/java/org/apache/activemq/artemis/jms/example/ClusteredJgroupsExample.java @@ -42,7 +42,7 @@ public class ClusteredJgroupsExample { try { // Step 1. Get an initial context for looking up JNDI from server 0 - Hashtable properties = new Hashtable(); + Hashtable properties = new Hashtable<>(); properties.put("java.naming.factory.initial", "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); properties.put("connectionFactory.ConnectionFactory", "tcp://localhost:61616"); properties.put("queue.queue/exampleQueue", "exampleQueue"); @@ -55,7 +55,7 @@ public class ClusteredJgroupsExample { ConnectionFactory cf0 = (ConnectionFactory) ic0.lookup("ConnectionFactory"); // Step 4. Get an initial context for looking up JNDI from server 1 - properties = new Hashtable(); + properties = new Hashtable<>(); properties.put("java.naming.factory.initial", "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); properties.put("connectionFactory.ConnectionFactory", "tcp://localhost:61617"); ic1 = new InitialContext(properties); diff --git a/examples/features/ha/colocated-failover-scale-down/src/main/java/org/apache/activemq/artemis/jms/example/ColocatedFailoverScaleDownExample.java b/examples/features/ha/colocated-failover-scale-down/src/main/java/org/apache/activemq/artemis/jms/example/ColocatedFailoverScaleDownExample.java index 08683ab97e..ee592f9aff 100644 --- a/examples/features/ha/colocated-failover-scale-down/src/main/java/org/apache/activemq/artemis/jms/example/ColocatedFailoverScaleDownExample.java +++ b/examples/features/ha/colocated-failover-scale-down/src/main/java/org/apache/activemq/artemis/jms/example/ColocatedFailoverScaleDownExample.java @@ -54,12 +54,12 @@ public class ColocatedFailoverScaleDownExample { Thread.sleep(3000); // Step 1. Get an initial context for looking up JNDI for both servers - Hashtable properties = new Hashtable(); + Hashtable properties = new Hashtable<>(); properties.put("java.naming.factory.initial", "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); properties.put("connectionFactory.ConnectionFactory", "tcp://localhost:61617"); initialContext1 = new InitialContext(properties); - properties = new Hashtable(); + properties = new Hashtable<>(); properties.put("java.naming.factory.initial", "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); properties.put("connectionFactory.ConnectionFactory", "tcp://localhost:61616?ha=true&retryInterval=1000&retryIntervalMultiplier=1.0&reconnectAttempts=-1"); properties.put("queue.queue/exampleQueue", "exampleQueue"); diff --git a/examples/features/ha/colocated-failover/src/main/java/org/apache/activemq/artemis/jms/example/ColocatedFailoverExample.java b/examples/features/ha/colocated-failover/src/main/java/org/apache/activemq/artemis/jms/example/ColocatedFailoverExample.java index ac882381ab..5bf32f5dc2 100644 --- a/examples/features/ha/colocated-failover/src/main/java/org/apache/activemq/artemis/jms/example/ColocatedFailoverExample.java +++ b/examples/features/ha/colocated-failover/src/main/java/org/apache/activemq/artemis/jms/example/ColocatedFailoverExample.java @@ -53,13 +53,13 @@ public class ColocatedFailoverExample { Thread.sleep(3000); // Step 1. Get an initial context for looking up JNDI for both servers - Hashtable properties = new Hashtable(); + Hashtable properties = new Hashtable<>(); properties.put("java.naming.factory.initial", "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); properties.put("connectionFactory.ConnectionFactory", "tcp://localhost:61616?ha=true&retryInterval=1000&retryIntervalMultiplier=1.0&reconnectAttempts=-1"); properties.put("queue.queue/exampleQueue", "exampleQueue"); initialContext = new InitialContext(properties); - properties = new Hashtable(); + properties = new Hashtable<>(); properties.put("java.naming.factory.initial", "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); properties.put("connectionFactory.ConnectionFactory", "tcp://localhost:61617"); initialContext1 = new InitialContext(properties); diff --git a/examples/features/ha/ha-policy-autobackup/src/main/java/org/apache/activemq/artemis/jms/example/HAPolicyAutoBackupExample.java b/examples/features/ha/ha-policy-autobackup/src/main/java/org/apache/activemq/artemis/jms/example/HAPolicyAutoBackupExample.java index 0df8bfd9bf..0401617c63 100644 --- a/examples/features/ha/ha-policy-autobackup/src/main/java/org/apache/activemq/artemis/jms/example/HAPolicyAutoBackupExample.java +++ b/examples/features/ha/ha-policy-autobackup/src/main/java/org/apache/activemq/artemis/jms/example/HAPolicyAutoBackupExample.java @@ -136,7 +136,7 @@ public class HAPolicyAutoBackupExample { private static void waitForBackups(ConnectionFactory cf0, int backups) throws InterruptedException { final CountDownLatch latch = new CountDownLatch(backups); ((ActiveMQConnectionFactory) cf0).getServerLocator().addClusterTopologyListener(new ClusterTopologyListener() { - List backups = new ArrayList(); + List backups = new ArrayList<>(); @Override public void nodeUP(TopologyMember member, boolean last) { diff --git a/examples/features/ha/scale-down/src/main/java/org/apache/activemq/artemis/jms/example/ScaleDownExample.java b/examples/features/ha/scale-down/src/main/java/org/apache/activemq/artemis/jms/example/ScaleDownExample.java index 3d81a38539..4383b287fd 100644 --- a/examples/features/ha/scale-down/src/main/java/org/apache/activemq/artemis/jms/example/ScaleDownExample.java +++ b/examples/features/ha/scale-down/src/main/java/org/apache/activemq/artemis/jms/example/ScaleDownExample.java @@ -51,13 +51,13 @@ public class ScaleDownExample { server1 = ServerUtil.startServer(args[1], ScaleDownExample.class.getSimpleName() + "1", 1, 5000); // Step 1. Get an initial context for looking up JNDI for both servers - Hashtable properties = new Hashtable(); + Hashtable properties = new Hashtable<>(); properties.put("java.naming.factory.initial", "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); properties.put("connectionFactory.ConnectionFactory", "tcp://localhost:61616?ha=true&retryInterval=1000&retryIntervalMultiplier=1.0&reconnectAttempts=-1"); properties.put("queue.queue/exampleQueue", "exampleQueue"); initialContext = new InitialContext(properties); - properties = new Hashtable(); + properties = new Hashtable<>(); properties.put("java.naming.factory.initial", "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); properties.put("connectionFactory.ConnectionFactory", "tcp://localhost:61617?ha=true&retryInterval=1000&retryIntervalMultiplier=1.0&reconnectAttempts=-1"); initialContext1 = new InitialContext(properties); diff --git a/examples/features/standard/bridge/src/main/java/org/apache/activemq/artemis/jms/example/BridgeExample.java b/examples/features/standard/bridge/src/main/java/org/apache/activemq/artemis/jms/example/BridgeExample.java index 0fa17c2710..4c0e3b97e3 100644 --- a/examples/features/standard/bridge/src/main/java/org/apache/activemq/artemis/jms/example/BridgeExample.java +++ b/examples/features/standard/bridge/src/main/java/org/apache/activemq/artemis/jms/example/BridgeExample.java @@ -44,7 +44,7 @@ public class BridgeExample { try { // Step 1 - we create an initial context for looking up JNDI on node 0 - Hashtable properties = new Hashtable(); + Hashtable properties = new Hashtable<>(); properties.put("java.naming.factory.initial", "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); properties.put("connectionFactory.ConnectionFactory", "tcp://127.0.0.1:61616"); properties.put("queue.queue/sausage-factory", "sausage-factory"); @@ -60,7 +60,7 @@ public class BridgeExample { // Step 4 - we create an initial context for looking up JNDI on node 1 - properties = new Hashtable(); + properties = new Hashtable<>(); properties.put("java.naming.factory.initial", "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); properties.put("connectionFactory.ConnectionFactory", "tcp://127.0.0.1:61617"); properties.put("queue.queue/mincing-machine", "mincing-machine"); diff --git a/examples/features/standard/client-kickoff/src/main/java/org/apache/activemq/artemis/jms/example/ClientKickoffExample.java b/examples/features/standard/client-kickoff/src/main/java/org/apache/activemq/artemis/jms/example/ClientKickoffExample.java index 14e9f379bd..bf70e96d28 100644 --- a/examples/features/standard/client-kickoff/src/main/java/org/apache/activemq/artemis/jms/example/ClientKickoffExample.java +++ b/examples/features/standard/client-kickoff/src/main/java/org/apache/activemq/artemis/jms/example/ClientKickoffExample.java @@ -54,7 +54,7 @@ public class ClientKickoffExample { connection = cf.createQueueConnection(); // Step 4. Set an exception listener on the connection to be notified after a problem occurred - final AtomicReference exception = new AtomicReference(); + final AtomicReference exception = new AtomicReference<>(); connection.setExceptionListener(new ExceptionListener() { @Override public void onException(final JMSException e) { diff --git a/examples/features/standard/embedded-simple/src/main/java/org/apache/activemq/artemis/jms/example/EmbeddedExample.java b/examples/features/standard/embedded-simple/src/main/java/org/apache/activemq/artemis/jms/example/EmbeddedExample.java index 334c58f570..526f870d39 100644 --- a/examples/features/standard/embedded-simple/src/main/java/org/apache/activemq/artemis/jms/example/EmbeddedExample.java +++ b/examples/features/standard/embedded-simple/src/main/java/org/apache/activemq/artemis/jms/example/EmbeddedExample.java @@ -53,7 +53,7 @@ public class EmbeddedExample { System.out.println("Started Embedded JMS Server"); JMSServerManager jmsServerManager = jmsServer.getJMSServerManager(); - List connectors = new ArrayList(); + List connectors = new ArrayList<>(); connectors.add("in-vm"); jmsServerManager.createConnectionFactory("ConnectionFactory", false, JMSFactoryType.CF, connectors, "ConnectionFactory"); jmsServerManager.createQueue(false, "exampleQueue", null, false, "queue/exampleQueue"); diff --git a/examples/features/standard/embedded/src/main/java/org/apache/activemq/artemis/jms/example/EmbeddedExample.java b/examples/features/standard/embedded/src/main/java/org/apache/activemq/artemis/jms/example/EmbeddedExample.java index cb39fd0aca..9cdc504cb7 100644 --- a/examples/features/standard/embedded/src/main/java/org/apache/activemq/artemis/jms/example/EmbeddedExample.java +++ b/examples/features/standard/embedded/src/main/java/org/apache/activemq/artemis/jms/example/EmbeddedExample.java @@ -60,7 +60,7 @@ public final class EmbeddedExample { JMSConfiguration jmsConfig = new JMSConfigurationImpl(); // Step 3. Configure the JMS ConnectionFactory - ArrayList connectorNames = new ArrayList(); + ArrayList connectorNames = new ArrayList<>(); connectorNames.add("connector"); ConnectionFactoryConfiguration cfConfig = new ConnectionFactoryConfigurationImpl().setName("cf").setConnectorNames(connectorNames).setBindings("cf"); jmsConfig.getConnectionFactoryConfigurations().add(cfConfig); diff --git a/examples/features/standard/jms-bridge/src/main/java/org/apache/activemq/artemis/jms/example/JMSBridgeExample.java b/examples/features/standard/jms-bridge/src/main/java/org/apache/activemq/artemis/jms/example/JMSBridgeExample.java index 8a65cd5895..f15db57d25 100644 --- a/examples/features/standard/jms-bridge/src/main/java/org/apache/activemq/artemis/jms/example/JMSBridgeExample.java +++ b/examples/features/standard/jms-bridge/src/main/java/org/apache/activemq/artemis/jms/example/JMSBridgeExample.java @@ -126,7 +126,7 @@ public class JMSBridgeExample { } private static Hashtable createJndiParams(String server) { - Hashtable jndiProps = new Hashtable(); + Hashtable jndiProps = new Hashtable<>(); jndiProps.put("connectionFactory.ConnectionFactory", server); jndiProps.put("java.naming.factory.initial", "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); jndiProps.put("queue.target/queue", "target"); diff --git a/examples/features/standard/message-group/src/main/java/org/apache/activemq/artemis/jms/example/MessageGroupExample.java b/examples/features/standard/message-group/src/main/java/org/apache/activemq/artemis/jms/example/MessageGroupExample.java index 88b75e4bcc..4db76180d9 100644 --- a/examples/features/standard/message-group/src/main/java/org/apache/activemq/artemis/jms/example/MessageGroupExample.java +++ b/examples/features/standard/message-group/src/main/java/org/apache/activemq/artemis/jms/example/MessageGroupExample.java @@ -37,7 +37,7 @@ import org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory; public class MessageGroupExample { public static void main(final String[] args) throws Exception { - final Map messageReceiverMap = new ConcurrentHashMap(); + final Map messageReceiverMap = new ConcurrentHashMap<>(); Connection connection = null; try { diff --git a/examples/features/standard/message-group2/src/main/java/org/apache/activemq/artemis/jms/example/MessageGroup2Example.java b/examples/features/standard/message-group2/src/main/java/org/apache/activemq/artemis/jms/example/MessageGroup2Example.java index db104f7604..717c4541f6 100644 --- a/examples/features/standard/message-group2/src/main/java/org/apache/activemq/artemis/jms/example/MessageGroup2Example.java +++ b/examples/features/standard/message-group2/src/main/java/org/apache/activemq/artemis/jms/example/MessageGroup2Example.java @@ -39,7 +39,7 @@ public class MessageGroup2Example { private boolean result = true; public static void main(String[] args) throws Exception { - final Map messageReceiverMap = new ConcurrentHashMap(); + final Map messageReceiverMap = new ConcurrentHashMap<>(); Connection connection = null; try { //Step 2. Perform a lookup on the queue diff --git a/examples/features/standard/message-priority/src/main/java/org/apache/activemq/artemis/jms/example/MessagePriorityExample.java b/examples/features/standard/message-priority/src/main/java/org/apache/activemq/artemis/jms/example/MessagePriorityExample.java index b9257c0878..b8796156ca 100644 --- a/examples/features/standard/message-priority/src/main/java/org/apache/activemq/artemis/jms/example/MessagePriorityExample.java +++ b/examples/features/standard/message-priority/src/main/java/org/apache/activemq/artemis/jms/example/MessagePriorityExample.java @@ -41,7 +41,7 @@ public class MessagePriorityExample { public static void main(final String[] args) throws Exception { AtomicBoolean result = new AtomicBoolean(true); - final ArrayList msgReceived = new ArrayList(); + final ArrayList msgReceived = new ArrayList<>(); Connection connection = null; try { diff --git a/examples/features/standard/request-reply/src/main/java/org/apache/activemq/artemis/jms/example/RequestReplyExample.java b/examples/features/standard/request-reply/src/main/java/org/apache/activemq/artemis/jms/example/RequestReplyExample.java index afdd738c14..edab71c91f 100644 --- a/examples/features/standard/request-reply/src/main/java/org/apache/activemq/artemis/jms/example/RequestReplyExample.java +++ b/examples/features/standard/request-reply/src/main/java/org/apache/activemq/artemis/jms/example/RequestReplyExample.java @@ -44,7 +44,7 @@ import javax.naming.InitialContext; public class RequestReplyExample { public static void main(final String[] args) throws Exception { - final Map requestMap = new HashMap(); + final Map requestMap = new HashMap<>(); Connection connection = null; InitialContext initialContext = null; diff --git a/examples/features/standard/xa-heuristic/src/main/java/org/apache/activemq/artemis/jms/example/XAHeuristicExample.java b/examples/features/standard/xa-heuristic/src/main/java/org/apache/activemq/artemis/jms/example/XAHeuristicExample.java index f6f8b9c866..1299f8e943 100644 --- a/examples/features/standard/xa-heuristic/src/main/java/org/apache/activemq/artemis/jms/example/XAHeuristicExample.java +++ b/examples/features/standard/xa-heuristic/src/main/java/org/apache/activemq/artemis/jms/example/XAHeuristicExample.java @@ -51,7 +51,7 @@ public class XAHeuristicExample { public static void main(final String[] args) throws Exception { Boolean result = true; - final ArrayList receiveHolder = new ArrayList(); + final ArrayList receiveHolder = new ArrayList<>(); XAConnection connection = null; InitialContext initialContext = null; try { diff --git a/examples/features/standard/xa-send/src/main/java/org/apache/activemq/artemis/jms/example/XASendExample.java b/examples/features/standard/xa-send/src/main/java/org/apache/activemq/artemis/jms/example/XASendExample.java index 9835f54a9f..53fed86243 100644 --- a/examples/features/standard/xa-send/src/main/java/org/apache/activemq/artemis/jms/example/XASendExample.java +++ b/examples/features/standard/xa-send/src/main/java/org/apache/activemq/artemis/jms/example/XASendExample.java @@ -43,7 +43,7 @@ public class XASendExample { public static void main(final String[] args) throws Exception { AtomicBoolean result = new AtomicBoolean(true); - final ArrayList receiveHolder = new ArrayList(); + final ArrayList receiveHolder = new ArrayList<>(); XAConnection connection = null; InitialContext initialContext = null; try { diff --git a/integration/activemq-vertx-integration/src/main/java/org/apache/activemq/artemis/integration/vertx/VertxConstants.java b/integration/activemq-vertx-integration/src/main/java/org/apache/activemq/artemis/integration/vertx/VertxConstants.java index 209dda5edc..e0d1537860 100644 --- a/integration/activemq-vertx-integration/src/main/java/org/apache/activemq/artemis/integration/vertx/VertxConstants.java +++ b/integration/activemq-vertx-integration/src/main/java/org/apache/activemq/artemis/integration/vertx/VertxConstants.java @@ -56,7 +56,7 @@ public class VertxConstants { public static final String VERTX_MESSAGE_TYPE = "VertxMessageType"; static { - ALLOWABLE_INCOMING_CONNECTOR_KEYS = new HashSet(); + ALLOWABLE_INCOMING_CONNECTOR_KEYS = new HashSet<>(); ALLOWABLE_INCOMING_CONNECTOR_KEYS.add(PORT); ALLOWABLE_INCOMING_CONNECTOR_KEYS.add(HOST); ALLOWABLE_INCOMING_CONNECTOR_KEYS.add(QUEUE_NAME); @@ -64,10 +64,10 @@ public class VertxConstants { ALLOWABLE_INCOMING_CONNECTOR_KEYS.add(VERTX_QUORUM_SIZE); ALLOWABLE_INCOMING_CONNECTOR_KEYS.add(VERTX_HA_GROUP); - REQUIRED_INCOMING_CONNECTOR_KEYS = new HashSet(); + REQUIRED_INCOMING_CONNECTOR_KEYS = new HashSet<>(); REQUIRED_INCOMING_CONNECTOR_KEYS.add(QUEUE_NAME); - ALLOWABLE_OUTGOING_CONNECTOR_KEYS = new HashSet(); + ALLOWABLE_OUTGOING_CONNECTOR_KEYS = new HashSet<>(); ALLOWABLE_OUTGOING_CONNECTOR_KEYS.add(PORT); ALLOWABLE_OUTGOING_CONNECTOR_KEYS.add(HOST); ALLOWABLE_OUTGOING_CONNECTOR_KEYS.add(QUEUE_NAME); @@ -76,7 +76,7 @@ public class VertxConstants { ALLOWABLE_OUTGOING_CONNECTOR_KEYS.add(VERTX_QUORUM_SIZE); ALLOWABLE_OUTGOING_CONNECTOR_KEYS.add(VERTX_HA_GROUP); - REQUIRED_OUTGOING_CONNECTOR_KEYS = new HashSet(); + REQUIRED_OUTGOING_CONNECTOR_KEYS = new HashSet<>(); REQUIRED_OUTGOING_CONNECTOR_KEYS.add(QUEUE_NAME); } } diff --git a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/ActiveMQConnectionFactory.java b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/ActiveMQConnectionFactory.java index e6d835ee14..02e5c622fd 100644 --- a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/ActiveMQConnectionFactory.java +++ b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/ActiveMQConnectionFactory.java @@ -250,7 +250,7 @@ public class ActiveMQConnectionFactory extends JNDIBaseStorable implements Conne Map params = URISupport.parseParameters(uri); //EMPTY_MAP is immutable, so use a normal map instead. if (params == Collections.EMPTY_MAP) { - params = new HashMap(); + params = new HashMap<>(); } params.put("invmBrokerId", uri.getHost() == null ? "localhost" : uri.getHost()); defaultTcpUri = URISupport.createRemainingURI(defaultTcpUri, params); diff --git a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/BrokerService.java b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/BrokerService.java index e50fdf8483..ffdfc6eef6 100644 --- a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/BrokerService.java +++ b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/BrokerService.java @@ -91,9 +91,9 @@ public class BrokerService implements Service { private BrokerId brokerId; private Throwable startException = null; private boolean startAsync = false; - public Set extraConnectors = new HashSet(); + public Set extraConnectors = new HashSet<>(); - private List transportConnectors = new ArrayList(); + private List transportConnectors = new ArrayList<>(); private File dataDirectoryFile; private PolicyMap destinationPolicy; diff --git a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/ArtemisBrokerWrapper.java b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/ArtemisBrokerWrapper.java index 14b93c6d79..61d62504db 100644 --- a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/ArtemisBrokerWrapper.java +++ b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/ArtemisBrokerWrapper.java @@ -43,7 +43,7 @@ import org.apache.activemq.broker.region.policy.PolicyMap; public class ArtemisBrokerWrapper extends ArtemisBrokerBase { - protected final Map testQueues = new HashMap(); + protected final Map testQueues = new HashMap<>(); protected JMSServerManagerImpl jmsServer; public ArtemisBrokerWrapper(BrokerService brokerService) { @@ -56,7 +56,7 @@ public class ArtemisBrokerWrapper extends ArtemisBrokerBase { clearDataRecreateServerDirs(); server = createServer(realStore, true); server.getConfiguration().getAcceptorConfigurations().clear(); - HashMap params = new HashMap(); + HashMap params = new HashMap<>(); params.put(TransportConstants.PORT_PROP_NAME, "61616"); params.put(TransportConstants.PROTOCOLS_PROP_NAME, "OPENWIRE,CORE"); TransportConfiguration transportConfiguration = new TransportConfiguration(NETTY_ACCEPTOR_FACTORY, params); @@ -84,7 +84,7 @@ public class ArtemisBrokerWrapper extends ArtemisBrokerBase { serverConfig.getAcceptorConfigurations().add(transportConfiguration); if (this.bservice.enableSsl()) { - params = new HashMap(); + params = new HashMap<>(); params.put(TransportConstants.SSL_ENABLED_PROP_NAME, true); params.put(TransportConstants.PORT_PROP_NAME, 61611); params.put(TransportConstants.PROTOCOLS_PROP_NAME, "OPENWIRE"); @@ -104,7 +104,7 @@ public class ArtemisBrokerWrapper extends ArtemisBrokerBase { for (Integer port : bservice.extraConnectors) { if (port.intValue() != 61616) { //extra port - params = new HashMap(); + params = new HashMap<>(); params.put(TransportConstants.PORT_PROP_NAME, port.intValue()); params.put(TransportConstants.PROTOCOLS_PROP_NAME, "OPENWIRE"); TransportConfiguration extraTransportConfiguration = new TransportConfiguration(NETTY_ACCEPTOR_FACTORY, params); @@ -143,12 +143,12 @@ public class ArtemisBrokerWrapper extends ArtemisBrokerBase { Map> settings = server.getConfiguration().getSecurityRoles(); if (settings == null) { - settings = new HashMap>(); + settings = new HashMap<>(); server.getConfiguration().setSecurityRoles(settings); } Set anySet = settings.get("#"); if (anySet == null) { - anySet = new HashSet(); + anySet = new HashSet<>(); settings.put("#", anySet); } anySet.add(senderRole); diff --git a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/InVMNamingContext.java b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/InVMNamingContext.java index f77a413447..27b9f7209c 100644 --- a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/InVMNamingContext.java +++ b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/broker/artemiswrapper/InVMNamingContext.java @@ -175,13 +175,13 @@ public class InVMNamingContext implements Context, Serializable { } } - List l = new ArrayList(); + List l = new ArrayList<>(); for (Object element : map.keySet()) { String name = (String) element; Object object = map.get(name); l.add(new Binding(name, object)); } - return new NamingEnumerationImpl(l.iterator()); + return new NamingEnumerationImpl<>(l.iterator()); } @Override @@ -252,7 +252,7 @@ public class InVMNamingContext implements Context, Serializable { @Override public Hashtable getEnvironment() throws NamingException { - Hashtable env = new Hashtable(); + Hashtable env = new Hashtable<>(); env.put("java.naming.factory.initial", "org.apache.activemq.artemis.jms.tests.tools.container.InVMInitialContextFactory"); return env; } diff --git a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/transport/tcp/TcpTransportFactory.java b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/transport/tcp/TcpTransportFactory.java index 58d51ca45c..34babf8ddf 100644 --- a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/transport/tcp/TcpTransportFactory.java +++ b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/transport/tcp/TcpTransportFactory.java @@ -72,7 +72,7 @@ public class TcpTransportFactory extends TransportFactory { @Override public TransportServer doBind(final URI location) throws IOException { try { - Map options = new HashMap(URISupport.parseParameters(location)); + Map options = new HashMap<>(URISupport.parseParameters(location)); ServerSocketFactory serverSocketFactory = createServerSocketFactory(); TcpTransportServer server = createTcpTransportServer(location, serverSocketFactory); diff --git a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/usage/SystemUsage.java b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/usage/SystemUsage.java index e36ab87f63..f6b4cdee05 100644 --- a/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/usage/SystemUsage.java +++ b/tests/activemq5-unit-tests/src/main/java/org/apache/activemq/usage/SystemUsage.java @@ -46,7 +46,7 @@ public class SystemUsage implements Service { private boolean sendFailIfNoSpaceAfterTimeoutExplicitySet; private long sendFailIfNoSpaceAfterTimeout = 0; - private final List children = new CopyOnWriteArrayList(); + private final List children = new CopyOnWriteArrayList<>(); public SystemUsage() { this("default", null, null, null); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ActiveMQMessageAuditTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ActiveMQMessageAuditTest.java index 2bd8382642..d63d3c4998 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ActiveMQMessageAuditTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/ActiveMQMessageAuditTest.java @@ -70,7 +70,7 @@ public class ActiveMQMessageAuditTest extends TestCase { ActiveMQMessageAudit audit = new ActiveMQMessageAudit(); IdGenerator idGen = new IdGenerator(); // add to a list - List list = new ArrayList(); + List list = new ArrayList<>(); for (int i = 0; i < count; i++) { String id = idGen.generateId(); list.add(id); @@ -86,7 +86,7 @@ public class ActiveMQMessageAuditTest extends TestCase { int count = 10000; ActiveMQMessageAudit audit = new ActiveMQMessageAudit(); // add to a list - List list = new ArrayList(); + List list = new ArrayList<>(); for (int i = 0; i < count; i++) { ProducerId pid = new ProducerId(); pid.setConnectionId("test"); @@ -111,7 +111,7 @@ public class ActiveMQMessageAuditTest extends TestCase { ActiveMQMessageAudit audit = new ActiveMQMessageAudit(); IdGenerator idGen = new IdGenerator(); // add to a list - List list = new ArrayList(); + List list = new ArrayList<>(); for (int i = 0; i < count; i++) { String id = idGen.generateId(); if (i == 0) { @@ -136,7 +136,7 @@ public class ActiveMQMessageAuditTest extends TestCase { LOG.debug("Length: " + bytes.length); audit = recover(bytes); - List list = new ArrayList(); + List list = new ArrayList<>(); for (int j = 0; j < 1000; j++) { ProducerId pid = new ProducerId(); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/CombinationTestSupport.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/CombinationTestSupport.java index 2b1b3bb590..d7caafa4a4 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/CombinationTestSupport.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/CombinationTestSupport.java @@ -67,7 +67,7 @@ public abstract class CombinationTestSupport extends AutoFailTestSupport { private static final Logger LOG = LoggerFactory.getLogger(CombinationTestSupport.class); - private final HashMap comboOptions = new HashMap(); + private final HashMap comboOptions = new HashMap<>(); private boolean combosEvaluated; private Map options; protected File basedir; @@ -85,7 +85,7 @@ public abstract class CombinationTestSupport extends AutoFailTestSupport { static class ComboOption { final String attribute; - final LinkedHashSet values = new LinkedHashSet(); + final LinkedHashSet values = new LinkedHashSet<>(); public ComboOption(String attribute, Collection options) { this.attribute = attribute; @@ -206,8 +206,8 @@ public abstract class CombinationTestSupport extends AutoFailTestSupport { } try { - ArrayList> expandedOptions = new ArrayList>(); - expandCombinations(new ArrayList(comboOptions.values()), expandedOptions); + ArrayList> expandedOptions = new ArrayList<>(); + expandCombinations(new ArrayList<>(comboOptions.values()), expandedOptions); if (expandedOptions.isEmpty()) { combosEvaluated = true; @@ -215,7 +215,7 @@ public abstract class CombinationTestSupport extends AutoFailTestSupport { } else { - ArrayList result = new ArrayList(); + ArrayList result = new ArrayList<>(); // Run the test case for each possible combination for (Iterator> iter = expandedOptions.iterator(); iter.hasNext(); ) { CombinationTestSupport combo = (CombinationTestSupport) TestSuite.createTest(getClass(), name); @@ -240,14 +240,14 @@ public abstract class CombinationTestSupport extends AutoFailTestSupport { if (!optionsLeft.isEmpty()) { HashMap map; if (comboOptions.size() == optionsLeft.size()) { - map = new HashMap(); + map = new HashMap<>(); expandedCombos.add(map); } else { map = expandedCombos.get(expandedCombos.size() - 1); } - LinkedList l = new LinkedList(optionsLeft); + LinkedList l = new LinkedList<>(optionsLeft); ComboOption comboOption = l.removeLast(); int i = 0; if (comboOption.values.isEmpty() && !l.isEmpty()) { @@ -257,7 +257,7 @@ public abstract class CombinationTestSupport extends AutoFailTestSupport { for (Iterator iter = comboOption.values.iterator(); iter.hasNext(); ) { Object value = iter.next(); if (i != 0) { - map = new HashMap(map); + map = new HashMap<>(map); expandedCombos.add(map); } map.put(comboOption.attribute, value); @@ -271,7 +271,7 @@ public abstract class CombinationTestSupport extends AutoFailTestSupport { public static Test suite(Class clazz) { TestSuite suite = new TestSuite(); - ArrayList names = new ArrayList(); + ArrayList names = new ArrayList<>(); Method[] methods = clazz.getMethods(); for (int i = 0; i < methods.length; i++) { String name = methods[i].getName(); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JMSMessageTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JMSMessageTest.java index 61a5de5005..e38f92fb5f 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JMSMessageTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JMSMessageTest.java @@ -271,7 +271,7 @@ public class JMSMessageTest extends JmsTestSupport { private long expiration; private int priority; private String text; - private final HashMap props = new HashMap(); + private final HashMap props = new HashMap<>(); @Override public String getJMSMessageID() throws JMSException { @@ -438,7 +438,7 @@ public class JMSMessageTest extends JmsTestSupport { @Override public Enumeration getPropertyNames() throws JMSException { - return new Vector(props.keySet()).elements(); + return new Vector<>(props.keySet()).elements(); } @Override diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsConnectionStartStopTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsConnectionStartStopTest.java index 0bf2799b8c..e5990714af 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsConnectionStartStopTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsConnectionStartStopTest.java @@ -115,7 +115,7 @@ public class JmsConnectionStartStopTest extends TestSupport { public void testConcurrentSessionCreateWithStart() throws Exception { ThreadPoolExecutor executor = new ThreadPoolExecutor(50, Integer.MAX_VALUE, 60L, TimeUnit.SECONDS, new SynchronousQueue()); - final Vector exceptions = new Vector(); + final Vector exceptions = new Vector<>(); final Random rand = new Random(); Runnable createSessionTask = new Runnable() { @Override diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsConsumerResetActiveListenerTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsConsumerResetActiveListenerTest.java index 1a80ac9ef6..1361b791e7 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsConsumerResetActiveListenerTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsConsumerResetActiveListenerTest.java @@ -65,7 +65,7 @@ public class JmsConsumerResetActiveListenerTest extends TestCase { final CountDownLatch latch = new CountDownLatch(2); final AtomicBoolean first = new AtomicBoolean(true); - final Vector results = new Vector(); + final Vector results = new Vector<>(); consumer.setMessageListener(new MessageListener() { @Override @@ -116,7 +116,7 @@ public class JmsConsumerResetActiveListenerTest extends TestCase { final CountDownLatch latch = new CountDownLatch(2); final AtomicBoolean first = new AtomicBoolean(true); - final Vector results = new Vector(); + final Vector results = new Vector<>(); consumer.setMessageListener(new MessageListener() { @Override diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsMultipleBrokersTestSupport.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsMultipleBrokersTestSupport.java index 7848d6c948..a826b0ad23 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsMultipleBrokersTestSupport.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsMultipleBrokersTestSupport.java @@ -514,8 +514,8 @@ public class JmsMultipleBrokersTestSupport extends CombinationTestSupport { @Override protected void setUp() throws Exception { super.setUp(); - brokers = new HashMap(); - destinations = new HashMap(); + brokers = new HashMap<>(); + destinations = new HashMap<>(); } @Override diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsMultipleClientsTestSupport.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsMultipleClientsTestSupport.java index 233e9e08d7..5ee575e2f1 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsMultipleClientsTestSupport.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsMultipleClientsTestSupport.java @@ -63,7 +63,7 @@ public class JmsMultipleClientsTestSupport { protected static final Logger LOG = LoggerFactory.getLogger(JmsMultipleClientsTestSupport.class); - protected Map consumers = new HashMap(); // Map of consumer with messages + protected Map consumers = new HashMap<>(); // Map of consumer with messages // received protected int consumerCount = 1; protected int producerCount = 1; diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueBrowserTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueBrowserTest.java index 059ec2cbc9..b458223d45 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueBrowserTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueBrowserTest.java @@ -363,7 +363,7 @@ public class JmsQueueBrowserTest extends JmsTestSupport { @SuppressWarnings("unchecked") Enumeration browserView = browser.getEnumeration(); - List messages = new ArrayList(); + List messages = new ArrayList<>(); for (int i = 0; i < numMessages; i++) { Message m1 = consumer.receive(5000); assertNotNull("m1 is null for index: " + i, m1); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueSendReceiveTwoConnectionsStartBeforeBrokerTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueSendReceiveTwoConnectionsStartBeforeBrokerTest.java index 412577e962..b60c091513 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueSendReceiveTwoConnectionsStartBeforeBrokerTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsQueueSendReceiveTwoConnectionsStartBeforeBrokerTest.java @@ -30,7 +30,7 @@ public class JmsQueueSendReceiveTwoConnectionsStartBeforeBrokerTest extends JmsQ private static final Logger LOG = LoggerFactory.getLogger(JmsQueueSendReceiveTwoConnectionsStartBeforeBrokerTest.class); - private Queue errors = new ConcurrentLinkedQueue(); + private Queue errors = new ConcurrentLinkedQueue<>(); private int delayBeforeStartingBroker = 1000; private BrokerService broker; diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsRollbackRedeliveryTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsRollbackRedeliveryTest.java index 3c50c62e73..5b99ad98d9 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsRollbackRedeliveryTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsRollbackRedeliveryTest.java @@ -111,7 +111,7 @@ public class JmsRollbackRedeliveryTest { // Consume messages and rollback transactions { AtomicInteger received = new AtomicInteger(); - Map rolledback = new ConcurrentHashMap(); + Map rolledback = new ConcurrentHashMap<>(); while (received.get() < nbMessages) { Session session = connection.createSession(true, Session.AUTO_ACKNOWLEDGE); Destination destination = session.createQueue(destinationName); @@ -148,7 +148,7 @@ public class JmsRollbackRedeliveryTest { // Consume messages and rollback transactions { AtomicInteger received = new AtomicInteger(); - Map rolledback = new ConcurrentHashMap(); + Map rolledback = new ConcurrentHashMap<>(); Session session = connection.createSession(true, Session.AUTO_ACKNOWLEDGE); Destination destination = session.createQueue(destinationName); MessageConsumer consumer = session.createConsumer(destination); @@ -183,7 +183,7 @@ public class JmsRollbackRedeliveryTest { // Consume messages and rollback transactions { AtomicInteger received = new AtomicInteger(); - Map rolledback = new ConcurrentHashMap(); + Map rolledback = new ConcurrentHashMap<>(); Session session = connection.createSession(true, Session.AUTO_ACKNOWLEDGE); Destination destination = session.createQueue(destinationName); while (received.get() < nbMessages) { diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsSendReceiveWithMessageExpirationTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsSendReceiveWithMessageExpirationTest.java index 19290c0007..5932c0683b 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsSendReceiveWithMessageExpirationTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsSendReceiveWithMessageExpirationTest.java @@ -145,7 +145,7 @@ public class JmsSendReceiveWithMessageExpirationTest extends TestSupport { producerNormal.send(producerDestination, message); } - Vector messages = new Vector(); + Vector messages = new Vector<>(); Message received; while ((received = consumer.receive(1000)) != null) { messages.add(received); @@ -158,7 +158,7 @@ public class JmsSendReceiveWithMessageExpirationTest extends TestSupport { assertEquals("got all (normal plus one with ttl) messages", messageCount + 1, messages.size()); - Vector dlqMessages = new Vector(); + Vector dlqMessages = new Vector<>(); while ((received = dlqConsumer.receive(1000)) != null) { dlqMessages.add(received); } diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsTempDestinationTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsTempDestinationTest.java index c1d75a4f77..9d04bf1022 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsTempDestinationTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsTempDestinationTest.java @@ -178,7 +178,7 @@ public class JmsTempDestinationTest extends TestCase { int count = 500; int dataSize = 1024; - ArrayList list = new ArrayList(count); + ArrayList list = new ArrayList<>(count); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Queue queue = session.createTemporaryQueue(); MessageProducer producer = session.createProducer(queue); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsTopicRequestReplyTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsTopicRequestReplyTest.java index ce73a837bb..ad94f098f3 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsTopicRequestReplyTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/JmsTopicRequestReplyTest.java @@ -48,7 +48,7 @@ public class JmsTopicRequestReplyTest extends TestSupport implements MessageList private MessageProducer replyProducer; private Session serverSession; private Destination requestDestination; - private List failures = new Vector(); + private List failures = new Vector<>(); private boolean dynamicallyCreateProducer; private String clientSideClientID; diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/MessageEvictionTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/MessageEvictionTest.java index 2a091b138e..d95350eeba 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/MessageEvictionTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/MessageEvictionTest.java @@ -250,7 +250,7 @@ public class MessageEvictionTest { // spooling to disk early so topic memory limit is not reached brokerService.getSystemUsage().getMemoryUsage().setLimit(500 * 1024); - final List policyEntries = new ArrayList(); + final List policyEntries = new ArrayList<>(); final PolicyEntry entry = new PolicyEntry(); entry.setTopic(">"); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/MessageListenerRedeliveryTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/MessageListenerRedeliveryTest.java index f2db097823..80744bd4db 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/MessageListenerRedeliveryTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/MessageListenerRedeliveryTest.java @@ -263,7 +263,7 @@ public class MessageListenerRedeliveryTest extends TestCase { final CountDownLatch gotMessage = new CountDownLatch(2); final AtomicInteger count = new AtomicInteger(0); final int maxDeliveries = getRedeliveryPolicy().getMaximumRedeliveries(); - final ArrayList received = new ArrayList(); + final ArrayList received = new ArrayList<>(); consumer.setMessageListener(new MessageListener() { @Override public void onMessage(Message message) { diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/SpringTestSupport.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/SpringTestSupport.java index f8cc498192..3418bf996c 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/SpringTestSupport.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/SpringTestSupport.java @@ -57,7 +57,7 @@ public abstract class SpringTestSupport extends TestCase { } protected void assertSetEquals(String description, Object[] expected, Set actual) { - Set expectedSet = new HashSet(); + Set expectedSet = new HashSet<>(); expectedSet.addAll(Arrays.asList(expected)); assertEquals(description, expectedSet, actual); } diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/advisory/AdvisoryTempDestinationTests.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/advisory/AdvisoryTempDestinationTests.java index 65b5243819..5889689f58 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/advisory/AdvisoryTempDestinationTests.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/advisory/AdvisoryTempDestinationTests.java @@ -201,7 +201,7 @@ public class AdvisoryTempDestinationTests extends TestCase { tempTopicEntry.setTempTopic(true); PolicyMap pMap = new PolicyMap(); - final List policyEntries = new ArrayList(); + final List policyEntries = new ArrayList<>(); policyEntries.add(tempQueueEntry); policyEntries.add(tempTopicEntry); pMap.setPolicyEntries(policyEntries); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/advisory/ConsumerListenerTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/advisory/ConsumerListenerTest.java index 8a9871ef4e..feb9bc8129 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/advisory/ConsumerListenerTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/advisory/ConsumerListenerTest.java @@ -44,7 +44,7 @@ public class ConsumerListenerTest extends EmbeddedBrokerTestSupport implements C protected Session consumerSession2; protected int consumerCounter; protected ConsumerEventSource consumerEventSource; - protected BlockingQueue eventQueue = new ArrayBlockingQueue(1000); + protected BlockingQueue eventQueue = new ArrayBlockingQueue<>(1000); private Connection connection; public void testConsumerEvents() throws Exception { diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/advisory/DestinationListenerTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/advisory/DestinationListenerTest.java index 0f0e118ce4..1f00df77f2 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/advisory/DestinationListenerTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/advisory/DestinationListenerTest.java @@ -45,7 +45,7 @@ public class DestinationListenerTest extends EmbeddedBrokerTestSupport implement protected ActiveMQConnection connection; protected ActiveMQQueue sampleQueue = new ActiveMQQueue("foo.bar"); protected ActiveMQTopic sampleTopic = new ActiveMQTopic("cheese"); - protected List newDestinations = new ArrayList(); + protected List newDestinations = new ArrayList<>(); public void testDestiationSourceHasInitialDestinations() throws Exception { Thread.sleep(1000); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/advisory/ProducerListenerTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/advisory/ProducerListenerTest.java index fa12fd5b56..3f443e6559 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/advisory/ProducerListenerTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/advisory/ProducerListenerTest.java @@ -42,7 +42,7 @@ public class ProducerListenerTest extends EmbeddedBrokerTestSupport implements P protected Session consumerSession2; protected int consumerCounter; protected ProducerEventSource producerEventSource; - protected BlockingQueue eventQueue = new ArrayBlockingQueue(1000); + protected BlockingQueue eventQueue = new ArrayBlockingQueue<>(1000); private Connection connection; public void testProducerEvents() throws Exception { diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/advisory/TempDestDeleteTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/advisory/TempDestDeleteTest.java index 4d84c024e5..958acd5818 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/advisory/TempDestDeleteTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/advisory/TempDestDeleteTest.java @@ -45,7 +45,7 @@ public class TempDestDeleteTest extends EmbeddedBrokerTestSupport implements Con protected int consumerCounter; protected ConsumerEventSource topicConsumerEventSource; - protected BlockingQueue eventQueue = new ArrayBlockingQueue(1000); + protected BlockingQueue eventQueue = new ArrayBlockingQueue<>(1000); private ConsumerEventSource queueConsumerEventSource; private Connection connection; diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/advisory/TempQueueMemoryTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/advisory/TempQueueMemoryTest.java index ce9efc9c14..04be79aaac 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/advisory/TempQueueMemoryTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/advisory/TempQueueMemoryTest.java @@ -114,7 +114,7 @@ public class TempQueueMemoryTest extends EmbeddedBrokerTestSupport { } } } - Vector threads = new Vector(numProducers); + Vector threads = new Vector<>(numProducers); for (int i = 0; i < numProducers; i++) { threads.add(new Producer(messagesToSend / numProducers)); } diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/blob/FTPTestSupport.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/blob/FTPTestSupport.java index 467f0e0d7a..0793b043ee 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/blob/FTPTestSupport.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/blob/FTPTestSupport.java @@ -68,7 +68,7 @@ public abstract class FTPTestSupport extends EmbeddedBrokerTestSupport { user.setHomeDirectory(ftpHomeDirFile.getParent()); // authorize user - List auths = new ArrayList(); + List auths = new ArrayList<>(); Authority auth = new WritePermission(); auths.add(auth); user.setAuthorities(auths); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/AMQ4351Test.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/AMQ4351Test.java index 1c6a6c1259..1e2448a4fa 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/AMQ4351Test.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/AMQ4351Test.java @@ -229,7 +229,7 @@ public class AMQ4351Test extends BrokerTestSupport { listener2.start(); listener3.start(); - List subscribers = new ArrayList(subs); + List subscribers = new ArrayList<>(subs); for (int i = 4; i < subs; i++) { ConsumingClient client = new ConsumingClient("subscriber-" + i, startedLatch, shutdownLatch); subscribers.add(client); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/BrokerTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/BrokerTest.java index 8ec55b7945..1e833191a4 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/BrokerTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/BrokerTest.java @@ -137,7 +137,7 @@ public class BrokerTest extends BrokerTestSupport { connection2.send(sessionInfo2); connection2.request(consumerInfo2); - List messages = new ArrayList(); + List messages = new ArrayList<>(); for (int i = 0; i < 4; i++) { Message m1 = receiveMessage(connection1); @@ -197,7 +197,7 @@ public class BrokerTest extends BrokerTestSupport { //one to ensure they arrive in the order we want connection1.request(createMessage(producerInfo, destination, deliveryMode)); - List messages = new ArrayList(); + List messages = new ArrayList<>(); for (int i = 0; i < 4; i++) { Message m1 = receiveMessage(connection1); @@ -249,7 +249,7 @@ public class BrokerTest extends BrokerTestSupport { //one to ensure they arrive in the order we want connection1.request(createMessage(producerInfo, destination, deliveryMode)); - List messages = new ArrayList(); + List messages = new ArrayList<>(); for (int i = 0; i < 4; i++) { Message m1 = receiveMessage(connection1); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/BrokerTestSupport.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/BrokerTestSupport.java index dd247d3254..4ded65e410 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/BrokerTestSupport.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/BrokerTestSupport.java @@ -250,7 +250,7 @@ public class BrokerTestSupport extends CombinationTestSupport { consumerInfo.setBrowser(true); connection.send(consumerInfo); - ArrayList skipped = new ArrayList(); + ArrayList skipped = new ArrayList<>(); // Now get the messages. Object m = connection.getDispatchQueue().poll(maxWait, TimeUnit.MILLISECONDS); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/NioQueueSubscriptionTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/NioQueueSubscriptionTest.java index 3126491638..3d0f54aee8 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/NioQueueSubscriptionTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/NioQueueSubscriptionTest.java @@ -62,7 +62,7 @@ public class NioQueueSubscriptionTest extends QueueSubscriptionTest { answer.getManagementContext().setCreateConnector(false); answer.setUseJmx(false); answer.setDeleteAllMessagesOnStartup(true); - final List policyEntries = new ArrayList(); + final List policyEntries = new ArrayList<>(); final PolicyEntry entry = new PolicyEntry(); entry.setQueue(">"); entry.setOptimizedDispatch(true); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/QueueMbeanRestartTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/QueueMbeanRestartTest.java index 886e38c20e..5e2839c956 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/QueueMbeanRestartTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/QueueMbeanRestartTest.java @@ -49,7 +49,7 @@ public class QueueMbeanRestartTest extends TestSupport { TestSupport.PersistenceAdapterChoice[] kahaDb = {TestSupport.PersistenceAdapterChoice.KahaDB}; TestSupport.PersistenceAdapterChoice[] levelDb = {TestSupport.PersistenceAdapterChoice.LevelDB}; TestSupport.PersistenceAdapterChoice[] jdbc = {TestSupport.PersistenceAdapterChoice.JDBC}; - List choices = new ArrayList(); + List choices = new ArrayList<>(); choices.add(kahaDb); choices.add(levelDb); choices.add(jdbc); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/RecoveryBrokerTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/RecoveryBrokerTest.java index 65612fe4ee..da79961dee 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/RecoveryBrokerTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/RecoveryBrokerTest.java @@ -53,9 +53,9 @@ public class RecoveryBrokerTest extends BrokerRestartTestSupport { ActiveMQDestination dest3 = new ActiveMQTopic("TEST.C"); ActiveMQDestination wildDest = new ActiveMQTopic("TEST.>"); - ArrayList sentBeforeRestart = new ArrayList(); - ArrayList sentBeforeCreateConsumer = new ArrayList(); - ArrayList sentAfterCreateConsumer = new ArrayList(); + ArrayList sentBeforeRestart = new ArrayList<>(); + ArrayList sentBeforeCreateConsumer = new ArrayList<>(); + ArrayList sentAfterCreateConsumer = new ArrayList<>(); // Setup a first connection { diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/StubBroker.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/StubBroker.java index fd84bee251..cc9627a781 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/StubBroker.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/StubBroker.java @@ -23,8 +23,8 @@ import org.apache.activemq.command.ConnectionInfo; public class StubBroker extends EmptyBroker { - public LinkedList addConnectionData = new LinkedList(); - public LinkedList removeConnectionData = new LinkedList(); + public LinkedList addConnectionData = new LinkedList<>(); + public LinkedList removeConnectionData = new LinkedList<>(); public class AddConnectionData { diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/StubConnection.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/StubConnection.java index 531cc4c290..4d6e59a306 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/StubConnection.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/StubConnection.java @@ -36,12 +36,12 @@ import org.apache.activemq.util.ServiceSupport; public class StubConnection implements Service { - private final BlockingQueue dispatchQueue = new LinkedBlockingQueue(); + private final BlockingQueue dispatchQueue = new LinkedBlockingQueue<>(); private Connection connection; private Transport transport; private boolean shuttingDown; private TransportListener listener; - public AtomicReference error = new AtomicReference(); + public AtomicReference error = new AtomicReference<>(); public StubConnection(BrokerService broker) throws Exception { this(TransportFactory.connect(broker.getVmConnectorURI())); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/XARecoveryBrokerTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/XARecoveryBrokerTest.java index 9032f37df4..3a008dce67 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/XARecoveryBrokerTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/XARecoveryBrokerTest.java @@ -902,7 +902,7 @@ public class XARecoveryBrokerTest extends BrokerRestartTestSupport { // consumer (PrefetchSubscription) cannot handle in a tx // atm. The matching is based on messageId rather than messageId // and destination - Set consumerInfos = new HashSet(); + Set consumerInfos = new HashSet<>(); for (ActiveMQDestination dest : destinationList(destination)) { ConsumerInfo consumerInfo = createConsumerInfo(sessionInfo, dest); consumerInfo.setPrefetchSize(numMessages); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/ft/QueueMasterSlaveTestSupport.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/ft/QueueMasterSlaveTestSupport.java index d3e1a712a1..c7d571a096 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/ft/QueueMasterSlaveTestSupport.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/ft/QueueMasterSlaveTestSupport.java @@ -44,7 +44,7 @@ abstract public class QueueMasterSlaveTestSupport extends JmsTopicSendReceiveWit private static final transient Logger LOG = LoggerFactory.getLogger(QueueMasterSlaveTestSupport.class); protected BrokerService master; - protected AtomicReference slave = new AtomicReference(); + protected AtomicReference slave = new AtomicReference<>(); protected CountDownLatch slaveStarted = new CountDownLatch(1); protected int inflightMessageCount; protected int failureCount = 50; diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/jmx/MBeanTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/jmx/MBeanTest.java index a156393491..be9e222417 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/jmx/MBeanTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/jmx/MBeanTest.java @@ -419,7 +419,7 @@ public class MBeanTest extends EmbeddedBrokerTestSupport { for (int i = 0; i < count; i++) { String body = "message:" + i; - Map headers = new HashMap(); + Map headers = new HashMap<>(); headers.put("JMSCorrelationID", "MyCorrId"); headers.put("JMSDeliveryMode", Boolean.FALSE); headers.put("JMSXGroupID", "MyGroupID"); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/policy/AbortSlowConsumerBase.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/policy/AbortSlowConsumerBase.java index 28cb1ee9bb..b6944c20d9 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/policy/AbortSlowConsumerBase.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/policy/AbortSlowConsumerBase.java @@ -54,7 +54,7 @@ public class AbortSlowConsumerBase extends JmsMultipleClientsTestSupport impleme protected boolean abortConnection = false; protected long checkPeriod = 2 * 1000; protected long maxSlowDuration = 5 * 1000; - protected final List exceptions = new ArrayList(); + protected final List exceptions = new ArrayList<>(); @Override @Before diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/policy/PriorityNetworkDispatchPolicyTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/policy/PriorityNetworkDispatchPolicyTest.java index 9367184483..0d318cbdbe 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/policy/PriorityNetworkDispatchPolicyTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/policy/PriorityNetworkDispatchPolicyTest.java @@ -63,7 +63,7 @@ public class PriorityNetworkDispatchPolicyTest { @Test public void testRemoveLowerPriorityDup() throws Exception { - List consumers = new ArrayList(); + List consumers = new ArrayList<>(); for (int i = 0; i < 3; i++) { ConsumerInfo instance = info.copy(); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/region/QueueDuplicatesFromStoreTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/region/QueueDuplicatesFromStoreTest.java index 252b7037bd..c85a678a94 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/region/QueueDuplicatesFromStoreTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/region/QueueDuplicatesFromStoreTest.java @@ -122,7 +122,7 @@ public class QueueDuplicatesFromStoreTest extends TestCase { final CountDownLatch receivedLatch = new CountDownLatch(count); final AtomicLong ackedCount = new AtomicLong(0); final AtomicLong enqueueCounter = new AtomicLong(0); - final Vector errors = new Vector(); + final Vector errors = new Vector<>(); // populate the queue store, exceed memory limit so that cache is disabled for (int i = 0; i < count; i++) { diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/region/SubscriptionAddRemoveQueueTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/region/SubscriptionAddRemoveQueueTest.java index a2ec1f7469..b38a965f1a 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/region/SubscriptionAddRemoveQueueTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/region/SubscriptionAddRemoveQueueTest.java @@ -69,7 +69,7 @@ public class SubscriptionAddRemoveQueueTest extends TestCase { Queue queue; ConsumerInfo info = new ConsumerInfo(); - List subs = new ArrayList(); + List subs = new ArrayList<>(); ConnectionContext context = new ConnectionContext(); ProducerBrokerExchange producerBrokerExchange = new ProducerBrokerExchange(); ProducerInfo producerInfo = new ProducerInfo(); @@ -354,7 +354,7 @@ public class SubscriptionAddRemoveQueueTest extends TestCase { @Override public List remove(ConnectionContext context, Destination destination) throws Exception { - return new ArrayList(dispatched); + return new ArrayList<>(dispatched); } @Override diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/region/UniquePropertyMessageEvictionStrategyTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/region/UniquePropertyMessageEvictionStrategyTest.java index 4779e91483..9c13f832e0 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/region/UniquePropertyMessageEvictionStrategyTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/region/UniquePropertyMessageEvictionStrategyTest.java @@ -33,7 +33,7 @@ public class UniquePropertyMessageEvictionStrategyTest extends EmbeddedBrokerTes @Override protected BrokerService createBroker() throws Exception { BrokerService broker = super.createBroker(); - final List policyEntries = new ArrayList(); + final List policyEntries = new ArrayList<>(); final PolicyEntry entry = new PolicyEntry(); entry.setTopic(">"); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/region/cursors/CursorSupport.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/region/cursors/CursorSupport.java index 4ffb73da2f..59dadcabef 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/region/cursors/CursorSupport.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/region/cursors/CursorSupport.java @@ -65,7 +65,7 @@ public abstract class CursorSupport extends CombinationTestSupport { producerConnection.start(); Session session = producerConnection.createSession(false, Session.AUTO_ACKNOWLEDGE); MessageProducer producer = session.createProducer(getDestination(session)); - List senderList = new ArrayList(); + List senderList = new ArrayList<>(); for (int i = 0; i < MESSAGE_COUNT; i++) { Message msg = session.createTextMessage("test" + i); senderList.add(msg); @@ -76,7 +76,7 @@ public abstract class CursorSupport extends CombinationTestSupport { consumerConnection = getConsumerConnection(factory); // create durable subs consumer = getConsumer(consumerConnection); - List consumerList = new ArrayList(); + List consumerList = new ArrayList<>(); for (int i = 0; i < MESSAGE_COUNT; i++) { Message msg = consumer.receive(1000 * 5); assertNotNull("Message " + i + " was missing.", msg); @@ -101,7 +101,7 @@ public abstract class CursorSupport extends CombinationTestSupport { producerConnection.start(); Session session = producerConnection.createSession(false, Session.AUTO_ACKNOWLEDGE); MessageProducer producer = session.createProducer(getDestination(session)); - List senderList = new ArrayList(); + List senderList = new ArrayList<>(); for (int i = 0; i < MESSAGE_COUNT / 10; i++) { TextMessage msg = session.createTextMessage("test" + i); senderList.add(msg); @@ -111,7 +111,7 @@ public abstract class CursorSupport extends CombinationTestSupport { consumerConnection = getConsumerConnection(factory); // create durable subs consumer = getConsumer(consumerConnection); - final List consumerList = new ArrayList(); + final List consumerList = new ArrayList<>(); final CountDownLatch latch = new CountDownLatch(1); consumer.setMessageListener(new MessageListener() { diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/region/cursors/NegativeQueueTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/region/cursors/NegativeQueueTest.java index a0b67acfb9..ab388f0868 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/region/cursors/NegativeQueueTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/region/cursors/NegativeQueueTest.java @@ -158,7 +158,7 @@ public class NegativeQueueTest extends AutoFailTestSupport { Session session = producerConnection.createSession(TRANSACTED, Session.AUTO_ACKNOWLEDGE); Destination queue = session.createQueue(QUEUE_1_NAME); MessageProducer producer = session.createProducer(queue); - List senderList = new ArrayList(); + List senderList = new ArrayList<>(); for (int i = 0; i < MESSAGE_COUNT; i++) { TextMessage msg = session.createTextMessage(i + " " + formatter.format(new Date())); senderList.add(msg); @@ -183,10 +183,10 @@ public class NegativeQueueTest extends AutoFailTestSupport { final CountDownLatch latch1 = new CountDownLatch(1); final CountDownLatch latch2 = new CountDownLatch(1); Connection[] consumerConnections1 = new Connection[NUM_CONSUMERS]; - List consumerList1 = new ArrayList(); + List consumerList1 = new ArrayList<>(); Connection[] consumerConnections2 = new Connection[NUM_CONSUMERS]; Connection[] producerConnections2 = new Connection[NUM_CONSUMERS]; - List consumerList2 = new ArrayList(); + List consumerList2 = new ArrayList<>(); for (int ix = 0; ix < NUM_CONSUMERS; ix++) { producerConnections2[ix] = factory.createConnection(); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/region/cursors/OrderPendingListTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/region/cursors/OrderPendingListTest.java index 634f3822c3..0dafbf6319 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/region/cursors/OrderPendingListTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/region/cursors/OrderPendingListTest.java @@ -270,7 +270,7 @@ public class OrderPendingListTest { static class TestPendingList implements PendingList { - private final LinkedList theList = new LinkedList(); + private final LinkedList theList = new LinkedList<>(); @Override public boolean isEmpty() { diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/scheduler/JobSchedulerStoreTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/scheduler/JobSchedulerStoreTest.java index c816d45649..2afa60e98e 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/scheduler/JobSchedulerStoreTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/scheduler/JobSchedulerStoreTest.java @@ -42,7 +42,7 @@ public class JobSchedulerStoreTest { store.setDirectory(directory); final int NUMBER = 1000; store.start(); - List list = new ArrayList(); + List list = new ArrayList<>(); for (int i = 0; i < NUMBER; i++) { ByteSequence buff = new ByteSequence(new String("testjob" + i).getBytes()); list.add(buff); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/scheduler/KahaDBSchedulerMissingJournalLogsTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/scheduler/KahaDBSchedulerMissingJournalLogsTest.java index 852d4c62e6..338e4718ce 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/scheduler/KahaDBSchedulerMissingJournalLogsTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/scheduler/KahaDBSchedulerMissingJournalLogsTest.java @@ -105,7 +105,7 @@ public class KahaDBSchedulerMissingJournalLogsTest { int jobCount = schedulerStore.getJobScheduler("JMS").getAllJobs().size(); LOG.info("There are {} jobs in the store.", jobCount); - List toDelete = new ArrayList(); + List toDelete = new ArrayList<>(); Map files = schedulerStore.getJournal().getFileMap(); for (int i = files.size(); i > files.size() / 2; i--) { toDelete.add(files.get(i).getFile()); @@ -134,7 +134,7 @@ public class KahaDBSchedulerMissingJournalLogsTest { int jobCount = schedulerStore.getJobScheduler("JMS").getAllJobs().size(); LOG.info("There are {} jobs in the store.", jobCount); - List toDelete = new ArrayList(); + List toDelete = new ArrayList<>(); Map files = schedulerStore.getJournal().getFileMap(); for (int i = files.size() - 1; i > files.size() / 2; i--) { toDelete.add(files.get(i).getFile()); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/scheduler/memory/InMemoryJobSchedulerStoreTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/scheduler/memory/InMemoryJobSchedulerStoreTest.java index 06146a6fa4..6bf8b0faee 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/scheduler/memory/InMemoryJobSchedulerStoreTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/scheduler/memory/InMemoryJobSchedulerStoreTest.java @@ -46,7 +46,7 @@ public class InMemoryJobSchedulerStoreTest { store.setDirectory(directory); final int NUMBER = 1000; store.start(); - List list = new ArrayList(); + List list = new ArrayList<>(); for (int i = 0; i < NUMBER; i++) { ByteSequence buff = new ByteSequence(new String("testjob" + i).getBytes()); list.add(buff); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/store/RecoverExpiredMessagesTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/store/RecoverExpiredMessagesTest.java index 0ec435a5f6..77c06f63f8 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/store/RecoverExpiredMessagesTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/store/RecoverExpiredMessagesTest.java @@ -45,7 +45,7 @@ import org.apache.activemq.util.IOHelper; public class RecoverExpiredMessagesTest extends BrokerRestartTestSupport { - final ArrayList expected = new ArrayList(); + final ArrayList expected = new ArrayList<>(); final ActiveMQDestination destination = new ActiveMQQueue("TEST"); public PendingQueueMessageStoragePolicy queuePendingPolicy; diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/virtual/MirroredQueueCorrectMemoryUsageTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/virtual/MirroredQueueCorrectMemoryUsageTest.java index 47fa95ff36..5ca00b70ab 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/virtual/MirroredQueueCorrectMemoryUsageTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/virtual/MirroredQueueCorrectMemoryUsageTest.java @@ -88,7 +88,7 @@ public class MirroredQueueCorrectMemoryUsageTest extends EmbeddedBrokerTestSuppo broker.setDestinationInterceptors(destinationInterceptors); // Create the destination policy for the topics and queues PolicyMap policyMap = new PolicyMap(); - List entries = new LinkedList(); + List entries = new LinkedList<>(); // Create Topic policy entry PolicyEntry policyEntry = new PolicyEntry(); super.useTopic = true; diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/virtual/VirtualDestPerfTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/virtual/VirtualDestPerfTest.java index bcbf28bcc3..6cca5004e7 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/virtual/VirtualDestPerfTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/virtual/VirtualDestPerfTest.java @@ -71,7 +71,7 @@ public class VirtualDestPerfTest { messageCount = 22000; messageSize = 10 * 1024; - LinkedHashMap results = new LinkedHashMap(); + LinkedHashMap results = new LinkedHashMap<>(); final ActiveMQQueue queue = new ActiveMQQueue("targetQ"); for (Integer numThreads : new Integer[]{1, 2}) { @@ -117,8 +117,8 @@ public class VirtualDestPerfTest { @Test @Ignore("comparison test - takes too long and really needs a peek at the graph") public void testPerf() throws Exception { - LinkedHashMap resultsT = new LinkedHashMap(); - LinkedHashMap resultsF = new LinkedHashMap(); + LinkedHashMap resultsT = new LinkedHashMap<>(); + LinkedHashMap resultsF = new LinkedHashMap<>(); for (int i = 2; i < 11; i++) { for (Boolean concurrent : new Boolean[]{true, false}) { @@ -180,7 +180,7 @@ public class VirtualDestPerfTest { route.setName("target"); route.setForwardOnly(true); route.setConcurrentSend(concurrentSend); - Collection routes = new ArrayList(); + Collection routes = new ArrayList<>(); for (int i = 0; i < fanoutCount; i++) { routes.add(new ActiveMQQueue("route." + i)); } diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/virtual/VirtualTopicPubSubTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/virtual/VirtualTopicPubSubTest.java index e203fb9bbd..0f2af0a493 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/virtual/VirtualTopicPubSubTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/broker/virtual/VirtualTopicPubSubTest.java @@ -38,7 +38,7 @@ import org.apache.activemq.spring.ConsumerBean; */ public class VirtualTopicPubSubTest extends EmbeddedBrokerTestSupport { - private Vector connections = new Vector(); + private Vector connections = new Vector<>(); public int ackMode = Session.AUTO_ACKNOWLEDGE; public static Test suite() { diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ1853Test.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ1853Test.java index 86326deef0..2f7b8fe036 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ1853Test.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ1853Test.java @@ -96,7 +96,7 @@ public class AMQ1853Test { public void testConsumerMessagesAreNotOrdered() throws Exception { TestConsumer consumerAllFail = null; - messageList = new Hashtable(); + messageList = new Hashtable<>(); try { diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ1866.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ1866.java index 4b960c451b..ad12f71a80 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ1866.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ1866.java @@ -49,7 +49,7 @@ public class AMQ1866 extends TestCase { private static final Logger log = LoggerFactory.getLogger(ConsumerThread.class); private BrokerService brokerService; - private ArrayList threads = new ArrayList(); + private ArrayList threads = new ArrayList<>(); private final String ACTIVEMQ_BROKER_BIND = "tcp://localhost:0"; private String ACTIVEMQ_BROKER_URI; diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ1917Test.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ1917Test.java index 3ae47ad893..a7eb699579 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ1917Test.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ1917Test.java @@ -70,7 +70,7 @@ public class AMQ1917Test extends TestCase { connectionUri = broker.getTransportConnectors().get(0).getPublishableConnectString(); - BlockingQueue queue = new ArrayBlockingQueue(10000); + BlockingQueue queue = new ArrayBlockingQueue<>(10000); tpe = new ThreadPoolExecutor(NUM_THREADS, NUM_THREADS, 60000, TimeUnit.MILLISECONDS, queue); ThreadFactory limitedthreadFactory = new LimitedThreadFactory(tpe.getThreadFactory()); tpe.setThreadFactory(limitedthreadFactory); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ1936Test.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ1936Test.java index d96fbfc931..345fb69e82 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ1936Test.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ1936Test.java @@ -148,7 +148,7 @@ public class AMQ1936Test extends TestCase { } public void testForDuplicateMessages() throws Exception { - final ConcurrentHashMap messages = new ConcurrentHashMap(); + final ConcurrentHashMap messages = new ConcurrentHashMap<>(); final Object lock = new Object(); final CountDownLatch duplicateSignal = new CountDownLatch(1); final AtomicInteger messageCount = new AtomicInteger(0); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2021Test.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2021Test.java index b2f9495758..7236581864 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2021Test.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2021Test.java @@ -57,7 +57,7 @@ public class AMQ2021Test implements ExceptionListener, UncaughtExceptionHandler private static final Logger log = LoggerFactory.getLogger(AMQ2021Test.class); BrokerService brokerService; - ArrayList threads = new ArrayList(); + ArrayList threads = new ArrayList<>(); Vector exceptions; @Rule @@ -88,7 +88,7 @@ public class AMQ2021Test implements ExceptionListener, UncaughtExceptionHandler brokerService.addConnector(ACTIVEMQ_BROKER_BIND); brokerService.start(); destination = new ActiveMQTopic(name.getMethodName()); - exceptions = new Vector(); + exceptions = new Vector<>(); CONSUMER_BROKER_URL = brokerService.getTransportConnectors().get(0).getPublishableConnectString() + CONSUMER_BROKER_URL; PRODUCER_BROKER_URL = brokerService.getTransportConnectors().get(0).getPublishableConnectString(); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2149Test.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2149Test.java index ae8ca8ce21..ce9bebea29 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2149Test.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2149Test.java @@ -85,7 +85,7 @@ public class AMQ2149Test { int numBrokerRestarts = 0; final static int MAX_BROKER_RESTARTS = 4; BrokerService broker; - Vector exceptions = new Vector(); + Vector exceptions = new Vector<>(); protected File dataDirFile; final LoggingBrokerPlugin[] plugins = new LoggingBrokerPlugin[]{new LoggingBrokerPlugin()}; @@ -145,7 +145,7 @@ public class AMQ2149Test { return stringBuilder.toString(); } - HashSet connections = new HashSet(); + HashSet connections = new HashSet<>(); private class Receiver implements MessageListener { @@ -535,8 +535,8 @@ public class AMQ2149Test { int concurrentPairs, boolean transactional) throws Exception { - Vector threads = new Vector(); - Vector receivers = new Vector(); + Vector threads = new Vector<>(); + Vector receivers = new Vector<>(); for (int i = 0; i < concurrentPairs; ++i) { final javax.jms.Destination destination = ActiveMQDestination.createDestination("test.dest." + i, destinationType); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2171Test.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2171Test.java index 52ee09b089..e6026fdfbb 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2171Test.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2171Test.java @@ -43,7 +43,7 @@ public class AMQ2171Test implements Thread.UncaughtExceptionHandler { private String brokerUri; private String brokerUriNoPrefetch; - private Collection exceptions = new CopyOnWriteArrayList(); + private Collection exceptions = new CopyOnWriteArrayList<>(); @Before public void setUp() throws Exception { diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2401Test.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2401Test.java index c0979aaacc..9fdc2e09ca 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2401Test.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2401Test.java @@ -56,7 +56,7 @@ public class AMQ2401Test extends TestCase implements MessageListener { private static final Logger LOG = LoggerFactory.getLogger(AMQ2401Test.class); - private final ArrayList services = new ArrayList(CONSUMER_COUNT + PRODUCER_COUNT); + private final ArrayList services = new ArrayList<>(CONSUMER_COUNT + PRODUCER_COUNT); private int count = 0; private CountDownLatch latch; diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2413Test.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2413Test.java index ac5ecdb7b4..32162158e1 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2413Test.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2413Test.java @@ -69,7 +69,7 @@ public class AMQ2413Test extends CombinationTestSupport implements MessageListen public boolean useVMCursor = false; public boolean useOptimizeAcks = false; - private final ArrayList services = new ArrayList(CONSUMER_COUNT + PRODUCER_COUNT); + private final ArrayList services = new ArrayList<>(CONSUMER_COUNT + PRODUCER_COUNT); AtomicInteger count = new AtomicInteger(0); Semaphore receivedMessages; AtomicBoolean running = new AtomicBoolean(false); @@ -180,7 +180,7 @@ public class AMQ2413Test extends CombinationTestSupport implements MessageListen } - HashMap tracker = new HashMap(); + HashMap tracker = new HashMap<>(); private synchronized void track(Message message) { try { @@ -224,7 +224,7 @@ public class AMQ2413Test extends CombinationTestSupport implements MessageListen } private void verifyTracking() { - Vector missing = new Vector(); + Vector missing = new Vector<>(); for (ProducerId pid : tracker.keySet()) { boolean[] ids = tracker.get(pid); for (int i = 1; i < TO_SEND + 1; i++) { diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2489Test.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2489Test.java index cc9630fa92..bcd2db1b51 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2489Test.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2489Test.java @@ -99,7 +99,7 @@ public class AMQ2489Test extends TestSupport { final TestExceptionListener exceptionListener = new TestExceptionListener(); connection.setExceptionListener(exceptionListener); try { - consumers = new ArrayList(); + consumers = new ArrayList<>(); // start customers for (int i = 0; i < CONSUMERS_CNT; i++) { consumers.add(new Consumer(acknowledgmentMode)); @@ -209,7 +209,7 @@ public class AMQ2489Test extends TestSupport { public final class TestExceptionListener implements ExceptionListener { - private final java.util.Queue exceptions = new ConcurrentLinkedQueue(); + private final java.util.Queue exceptions = new ConcurrentLinkedQueue<>(); @Override public void onException(JMSException e) { diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2512Test.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2512Test.java index d950459855..b18a7b42dc 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2512Test.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2512Test.java @@ -68,7 +68,7 @@ public class AMQ2512Test extends EmbeddedBrokerTestSupport { final long startTime = System.nanoTime(); - final List consumers = new ArrayList(); + final List consumers = new ArrayList<>(); for (int i = 0; i < 20; i++) { consumers.add(new Consumer("worker-" + i)); } diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2584ConcurrentDlqTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2584ConcurrentDlqTest.java index 35ac1f8119..3b7a11b9c7 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2584ConcurrentDlqTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2584ConcurrentDlqTest.java @@ -59,7 +59,7 @@ public class AMQ2584ConcurrentDlqTest extends org.apache.activemq.TestSupport { Session consumerSession; Session producerSession; MessageProducer producer; - Vector duralbeSubs = new Vector(); + Vector duralbeSubs = new Vector<>(); final int numMessages = 1000; final int numDurableSubs = 2; diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2584Test.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2584Test.java index e772fe8a7d..14760d9ebc 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2584Test.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2584Test.java @@ -67,7 +67,7 @@ public class AMQ2584Test extends org.apache.activemq.TestSupport { public static Collection getTestParameters() { TestSupport.PersistenceAdapterChoice[] kahaDb = {TestSupport.PersistenceAdapterChoice.KahaDB}; TestSupport.PersistenceAdapterChoice[] levelDb = {TestSupport.PersistenceAdapterChoice.LevelDB}; - List choices = new ArrayList(); + List choices = new ArrayList<>(); choices.add(kahaDb); choices.add(levelDb); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2616Test.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2616Test.java index 3181e4bdb7..f22ff48f34 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2616Test.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2616Test.java @@ -40,7 +40,7 @@ public class AMQ2616Test extends TestCase { private static final int NUMBER = 2000; private BrokerService brokerService; - private final ArrayList threads = new ArrayList(); + private final ArrayList threads = new ArrayList<>(); private final String ACTIVEMQ_BROKER_BIND = "tcp://0.0.0.0:0"; private final AtomicBoolean shutdown = new AtomicBoolean(); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2801Test.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2801Test.java index 02b28117ae..43394dc9af 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2801Test.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2801Test.java @@ -90,7 +90,7 @@ public class AMQ2801Test { memoryManager.getTempUsage().setLimit(3221225472L); broker.setSystemUsage(memoryManager); - final List policyEntries = new ArrayList(); + final List policyEntries = new ArrayList<>(); final PolicyEntry entry = new PolicyEntry(); entry.setQueue(">"); entry.setProducerFlowControl(false); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2870Test.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2870Test.java index fc3ae3b3db..b4f0a33b71 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2870Test.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2870Test.java @@ -65,7 +65,7 @@ public class AMQ2870Test extends org.apache.activemq.TestSupport { LOG.info("Running on [" + osName + "]"); PersistenceAdapterChoice[] kahaDb = {PersistenceAdapterChoice.KahaDB}; PersistenceAdapterChoice[] levelDb = {PersistenceAdapterChoice.LevelDB}; - List choices = new ArrayList(); + List choices = new ArrayList<>(); choices.add(kahaDb); if (!osName.equalsIgnoreCase("AIX") && !osName.equalsIgnoreCase("SunOS")) { choices.add(levelDb); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2910Test.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2910Test.java index 5205fbf5a5..362fa5c6f0 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2910Test.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2910Test.java @@ -39,7 +39,7 @@ public class AMQ2910Test extends JmsMultipleClientsTestSupport { final int maxConcurrency = 60; final int msgCount = 200; - final Vector exceptions = new Vector(); + final Vector exceptions = new Vector<>(); @Override protected BrokerService createBroker() throws Exception { diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2983Test.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2983Test.java index fe3a971a62..8714477a6d 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2983Test.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ2983Test.java @@ -126,7 +126,7 @@ public class AMQ2983Test { @Test public void testNoStickyKahaDbLogFilesOnConcurrentTransactionalConsumer() throws Exception { - List consumerThreads = new ArrayList(); + List consumerThreads = new ArrayList<>(); for (int i = 0; i < MAX_CONSUMER; i++) { ConsumerThread thread = new ConsumerThread(); thread.start(); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ3140Test.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ3140Test.java index edc7bd8291..621b42138f 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ3140Test.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ3140Test.java @@ -122,7 +122,7 @@ public class AMQ3140Test { } }); - List senderThreads = new ArrayList(); + List senderThreads = new ArrayList<>(); for (int i = 0; i < THREAD_COUNT; i++) { Sender sender = new Sender(); senderThreads.add(sender); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ3167Test.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ3167Test.java index c0855abdec..6fd81b2c8a 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ3167Test.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ3167Test.java @@ -133,7 +133,7 @@ public class AMQ3167Test { PolicyEntry pol_ent; ArrayList ent_list; - ent_list = new ArrayList(); + ent_list = new ArrayList<>(); // // QUEUES diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ3274Test.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ3274Test.java index 6c2405c5ca..74c19b7706 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ3274Test.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ3274Test.java @@ -518,7 +518,7 @@ public class AMQ3274Test { excl_dest = ActiveMQDestination.createDestination(">", ActiveMQDestination.TOPIC_TYPE); } - excludes = new ArrayList(); + excludes = new ArrayList<>(); excludes.add(excl_dest); nw_conn.setExcludedDestinations(excludes); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ3622Test.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ3622Test.java index 7abe33f1ca..7556def48d 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ3622Test.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ3622Test.java @@ -71,7 +71,7 @@ public class AMQ3622Test { policy.setPendingSubscriberPolicy(new FilePendingSubscriberMessageStoragePolicy()); policy.setSubscriptionRecoveryPolicy(new LastImageSubscriptionRecoveryPolicy()); policy.setExpireMessagesPeriod(500); - List entries = new ArrayList(); + List entries = new ArrayList<>(); entries.add(policy); PolicyMap pMap = new PolicyMap(); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ3732Test.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ3732Test.java index e7028045b3..d0f6692c2b 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ3732Test.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ3732Test.java @@ -86,7 +86,7 @@ public class AMQ3732Test { Queue queue = session.createQueue("AMQ3732Test"); - final LinkedBlockingQueue workQueue = new LinkedBlockingQueue(); + final LinkedBlockingQueue workQueue = new LinkedBlockingQueue<>(); final MessageConsumer consumer1 = session.createConsumer(queue); final MessageConsumer consumer2 = session.createConsumer(queue); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ3841Test.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ3841Test.java index ca198699fb..48248555ff 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ3841Test.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ3841Test.java @@ -106,7 +106,7 @@ public class AMQ3841Test { if (deleteAllMessages) { multiKahaDBPersistenceAdapter.deleteAllMessages(); } - ArrayList adapters = new ArrayList(); + ArrayList adapters = new ArrayList<>(); FilteredKahaDBPersistenceAdapter template = new FilteredKahaDBPersistenceAdapter(); template.setPersistenceAdapter(createStore(deleteAllMessages)); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ3961Test.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ3961Test.java index df7a942c0a..c39cabf85e 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ3961Test.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ3961Test.java @@ -111,8 +111,8 @@ public class AMQ3961Test { } public static final int MESSAGE_COUNT = 16; - private final List processedSessions = new LinkedList(); - private final List committedSessions = new LinkedList(); + private final List processedSessions = new LinkedList<>(); + private final List committedSessions = new LinkedList<>(); @Test public void testPrefetchInDurableSubscription() throws Exception { @@ -162,7 +162,7 @@ public class AMQ3961Test { final LinkedList collected; synchronized (processedSessions) { - collected = new LinkedList(processedSessions); + collected = new LinkedList<>(processedSessions); processedSessions.clear(); } diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4083Test.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4083Test.java index c655a226ff..1e4d0625f0 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4083Test.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4083Test.java @@ -484,7 +484,7 @@ public class AMQ4083Test { producerNormal.send(queue, message); } - ArrayList messages = new ArrayList(); + ArrayList messages = new ArrayList<>(); Message received; while ((received = consumer.receive(1000)) != null) { messages.add(received); @@ -497,7 +497,7 @@ public class AMQ4083Test { assertEquals("got messages", messageCount + 1, messages.size()); - ArrayList dlqMessages = new ArrayList(); + ArrayList dlqMessages = new ArrayList<>(); while ((received = dlqConsumer.receive(1000)) != null) { dlqMessages.add(received); } diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4092Test.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4092Test.java index 633d246631..e894b70735 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4092Test.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4092Test.java @@ -61,7 +61,7 @@ public class AMQ4092Test extends TestCase { private BrokerService brokerService; private ActiveMQQueue destination; - private HashMap exceptions = new HashMap(); + private HashMap exceptions = new HashMap<>(); private ExceptionListener exceptionListener = new ExceptionListener() { @Override public void onException(JMSException exception) { diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4157Test.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4157Test.java index d9caf7f6e5..f932a4981c 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4157Test.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4157Test.java @@ -55,7 +55,7 @@ public class AMQ4157Test { private final int parallelProducer = 20; private final int parallelConsumer = 100; - private final Vector exceptions = new Vector(); + private final Vector exceptions = new Vector<>(); long toSend = 1000; @Test diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4220Test.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4220Test.java index 3e1e8637ae..7433b18d6f 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4220Test.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4220Test.java @@ -106,7 +106,7 @@ public class AMQ4220Test { if (deleteAllMessages) { multiKahaDBPersistenceAdapter.deleteAllMessages(); } - ArrayList adapters = new ArrayList(); + ArrayList adapters = new ArrayList<>(); FilteredKahaDBPersistenceAdapter template = new FilteredKahaDBPersistenceAdapter(); template.setPersistenceAdapter(createStore(deleteAllMessages)); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4221Test.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4221Test.java index 5a6c630af2..0e9c488514 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4221Test.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4221Test.java @@ -72,7 +72,7 @@ public class AMQ4221Test extends TestSupport { final byte[] payload = new byte[PAYLOAD_SIZE_BYTES]; final AtomicInteger counter = new AtomicInteger(0); - final HashSet exceptions = new HashSet(); + final HashSet exceptions = new HashSet<>(); BrokerService brokerService; private String brokerUrlString; ExecutorService executorService = Executors.newCachedThreadPool(); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4361Test.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4361Test.java index 69c1e1dbf2..27c4f645bf 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4361Test.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4361Test.java @@ -95,8 +95,8 @@ public class AMQ4361Test { producer.setTimeToLive(0); producer.setDeliveryMode(DeliveryMode.NON_PERSISTENT); - final AtomicReference publishException = new AtomicReference(null); - final AtomicReference closeException = new AtomicReference(null); + final AtomicReference publishException = new AtomicReference<>(null); + final AtomicReference closeException = new AtomicReference<>(null); final AtomicLong lastLoop = new AtomicLong(System.currentTimeMillis() + 100); Thread pubThread = new Thread(new Runnable() { diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4407Test.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4407Test.java index c0cf07af70..38a9398984 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4407Test.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4407Test.java @@ -123,7 +123,7 @@ public class AMQ4407Test { if (deleteAllMessages) { multiKahaDBPersistenceAdapter.deleteAllMessages(); } - ArrayList adapters = new ArrayList(); + ArrayList adapters = new ArrayList<>(); adapters.add(createFilteredKahaDBByDestinationPrefix(PREFIX_DESTINATION_NAME, deleteAllMessages)); adapters.add(createFilteredKahaDBByDestinationPrefix(PREFIX_DESTINATION_NAME + "2", deleteAllMessages)); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4413Test.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4413Test.java index dab48cb355..cd3ed9582d 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4413Test.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4413Test.java @@ -235,7 +235,7 @@ public class AMQ4413Test { } }; - ArrayList> results = new ArrayList>(); + ArrayList> results = new ArrayList<>(); results.add(threadPool.submit(publisher)); results.add(threadPool.submit(durableSubscriber)); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4475Test.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4475Test.java index 0e528bde39..558bc083fb 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4475Test.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4475Test.java @@ -112,7 +112,7 @@ public class AMQ4475Test { long startTime = System.nanoTime(); // Produce to network - List> tasks = new ArrayList>(); + List> tasks = new ArrayList<>(); for (int index = 0; index < 1; index++) { ProducerTask p = new ProducerTask(connectionUri, original, NUM_MSGS); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4485LowLimitTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4485LowLimitTest.java index ba64b8b13d..a034b37ee6 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4485LowLimitTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4485LowLimitTest.java @@ -71,8 +71,8 @@ public class AMQ4485LowLimitTest extends JmsMultipleBrokersTestSupport { final int numMessages = 1000; final int consumerSleepTime = 40; StringBuilder brokersUrl = new StringBuilder(); - HashMap accumulators = new HashMap(); - private ArrayList exceptions = new ArrayList(); + HashMap accumulators = new HashMap<>(); + private ArrayList exceptions = new ArrayList<>(); protected void buildUrlList() throws Exception { for (int i = 0; i < numBrokers; i++) { @@ -330,7 +330,7 @@ public class AMQ4485LowLimitTest extends JmsMultipleBrokersTestSupport { } private List startAllGWConsumers(int nBrokers) throws Exception { - List consumerStates = new LinkedList(); + List consumerStates = new LinkedList<>(); for (int id = 0; id < nBrokers; id++) { ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("failover:(tcp://localhost:" + (portBase + id) + ")"); connectionFactory.setWatchTopicAdvisories(false); @@ -437,7 +437,7 @@ public class AMQ4485LowLimitTest extends JmsMultipleBrokersTestSupport { } }); LOG.info("verify infos " + broker.getBrokerName() + ", len: " + regionBroker.getPeerBrokerInfos().length); - List missing = new ArrayList(); + List missing = new ArrayList<>(); for (int i = 0; i < max; i++) { missing.add("B" + i); } @@ -469,6 +469,6 @@ public class AMQ4485LowLimitTest extends JmsMultipleBrokersTestSupport { String brokerName; QueueReceiver receiver; ActiveMQDestination destination; - ConcurrentLinkedQueue expected = new ConcurrentLinkedQueue(); + ConcurrentLinkedQueue expected = new ConcurrentLinkedQueue<>(); } } \ No newline at end of file diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4485NetworkOfXBrokersWithNDestsFanoutTransactionTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4485NetworkOfXBrokersWithNDestsFanoutTransactionTest.java index add1526dab..5ddb14f9ee 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4485NetworkOfXBrokersWithNDestsFanoutTransactionTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4485NetworkOfXBrokersWithNDestsFanoutTransactionTest.java @@ -67,8 +67,8 @@ public class AMQ4485NetworkOfXBrokersWithNDestsFanoutTransactionTest extends Jms final int numMessages = 800; final int consumerSleepTime = 20; StringBuilder brokersUrl = new StringBuilder(); - HashMap accumulators = new HashMap(); - private ArrayList exceptions = new ArrayList(); + HashMap accumulators = new HashMap<>(); + private ArrayList exceptions = new ArrayList<>(); protected void buildUrlList() throws Exception { for (int i = 0; i < numBrokers; i++) { @@ -216,7 +216,7 @@ public class AMQ4485NetworkOfXBrokersWithNDestsFanoutTransactionTest extends Jms } private List startAllGWConsumers(int nBrokers) throws Exception { - List consumerStates = new LinkedList(); + List consumerStates = new LinkedList<>(); for (int id = 0; id < nBrokers; id++) { ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory("failover:(tcp://localhost:" + (portBase + id) + ")"); connectionFactory.setWatchTopicAdvisories(false); @@ -321,7 +321,7 @@ public class AMQ4485NetworkOfXBrokersWithNDestsFanoutTransactionTest extends Jms } }); LOG.info("verify infos " + broker.getBrokerName() + ", len: " + regionBroker.getPeerBrokerInfos().length); - List missing = new ArrayList(); + List missing = new ArrayList<>(); for (int i = 0; i < max; i++) { missing.add("B" + i); } @@ -353,6 +353,6 @@ public class AMQ4485NetworkOfXBrokersWithNDestsFanoutTransactionTest extends Jms String brokerName; QueueReceiver receiver; ActiveMQDestination destination; - Vector expected = new Vector(); + Vector expected = new Vector<>(); } } diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4485Test.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4485Test.java index c9176daa5e..777d582160 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4485Test.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4485Test.java @@ -57,7 +57,7 @@ public class AMQ4485Test extends TestCase { final int messageCount = 20; int memoryLimit = 40 * 1024; final ActiveMQQueue destination = new ActiveMQQueue("QUEUE." + this.getClass().getName()); - final Vector exceptions = new Vector(); + final Vector exceptions = new Vector<>(); final CountDownLatch slowSendResume = new CountDownLatch(1); protected void configureBroker(long memoryLimit) throws Exception { @@ -109,8 +109,8 @@ public class AMQ4485Test extends TestCase { public void testOutOfOrderTransactionCompletionOnMemoryLimit() throws Exception { - Set expected = new HashSet(); - final Vector sessionVector = new Vector(); + Set expected = new HashSet<>(); + final Vector sessionVector = new Vector<>(); ExecutorService executorService = Executors.newCachedThreadPool(); for (int i = 1; i <= messageCount; i++) { sessionVector.add(send(i, 1, true)); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4607Test.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4607Test.java index 841f46370a..527309bdcb 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4607Test.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4607Test.java @@ -52,7 +52,7 @@ public class AMQ4607Test extends JmsMultipleBrokersTestSupport implements Uncaug public boolean duplex = true; protected Map consumerMap; - final Map unhandeledExceptions = new HashMap(); + final Map unhandeledExceptions = new HashMap<>(); private void assertNoUnhandeledExceptions() { for (Entry e : unhandeledExceptions.entrySet()) { @@ -242,7 +242,7 @@ public class AMQ4607Test extends JmsMultipleBrokersTestSupport implements Uncaug createBroker(new URI("broker:(tcp://localhost:6161" + i + ")/Broker" + i + "?persistent=false&useJmx=true")); } - consumerMap = new LinkedHashMap(); + consumerMap = new LinkedHashMap<>(); } @Override diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4853Test.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4853Test.java index c6b3227291..ad04d96717 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4853Test.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4853Test.java @@ -89,7 +89,7 @@ public class AMQ4853Test { public void test() throws Exception { // Create a stable set of consumers to fill in the advisory broker's consumer list. - ArrayList fixedConsumers = new ArrayList(100); + ArrayList fixedConsumers = new ArrayList<>(100); for (int i = 0; i < 200; ++i) { fixedConsumers.add(new Consumer()); } diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4952Test.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4952Test.java index 549f77b32c..dd4c7b31b1 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4952Test.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ4952Test.java @@ -297,7 +297,7 @@ public class AMQ4952Test { protected BrokerService createProducerBroker() throws Exception { String networkToPorts[] = new String[]{"2006"}; - HashMap networkProps = new HashMap(); + HashMap networkProps = new HashMap<>(); networkProps.put("networkTTL", "10"); networkProps.put("conduitSubscriptions", "true"); @@ -313,7 +313,7 @@ public class AMQ4952Test { // lazy init listener on broker start TransportConnector transportConnector = new TransportConnector(); transportConnector.setUri(new URI("tcp://localhost:2003")); - List transportConnectors = new ArrayList(); + List transportConnectors = new ArrayList<>(); transportConnectors.add(transportConnector); broker.setTransportConnectors(transportConnectors); @@ -379,7 +379,7 @@ public class AMQ4952Test { // lazy init listener on broker start TransportConnector transportConnector = new TransportConnector(); transportConnector.setUri(new URI(scheme + "://localhost:" + listenPort)); - List transportConnectors = new ArrayList(); + List transportConnectors = new ArrayList<>(); transportConnectors.add(transportConnector); broker.setTransportConnectors(transportConnectors); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ5266SingleDestTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ5266SingleDestTest.java index 405e56bc9c..6cf42f3728 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ5266SingleDestTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ5266SingleDestTest.java @@ -206,7 +206,7 @@ public class AMQ5266SingleDestTest { List idList = entry.getValue(); - int distinctConsumed = new TreeSet(idList).size(); + int distinctConsumed = new TreeSet<>(idList).size(); StringBuilder sb = new StringBuilder(); sb.append(" Queue: " + entry.getKey() + @@ -247,7 +247,7 @@ public class AMQ5266SingleDestTest { this.activemqURL = activemqURL; this.activemqQueues = activemqQueues; - threads = new ArrayList(); + threads = new ArrayList<>(); // Build the threads and tell them how many messages to publish for (int i = 0; i < threadCount; i++) { @@ -397,7 +397,7 @@ public class AMQ5266SingleDestTest { private String[] queues = null; // Map of IDs that were consumed, keyed by queue name. // We'll compare these against what was published to know if any got stuck or dropped. - private Map> idsByQueue = new HashMap>(); + private Map> idsByQueue = new HashMap<>(); private Map> threads; public ExportQueueConsumer(String activemqURL, @@ -416,12 +416,12 @@ public class AMQ5266SingleDestTest { queues[i] = queues[i].trim(); } - threads = new HashMap>(); + threads = new HashMap<>(); // For each queue, create a list of threads and set up the list of ids for (String q : queues) { - List list = new ArrayList(); + List list = new ArrayList<>(); idsByQueue.put(q, Collections.synchronizedList(new ArrayList())); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ5266StarvedConsumerTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ5266StarvedConsumerTest.java index 86dcf5ad18..b47c17a2b2 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ5266StarvedConsumerTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ5266StarvedConsumerTest.java @@ -212,7 +212,7 @@ public class AMQ5266StarvedConsumerTest { List idList = entry.getValue(); - int distinctConsumed = new TreeSet(idList).size(); + int distinctConsumed = new TreeSet<>(idList).size(); StringBuilder sb = new StringBuilder(); sb.append(" Queue: " + entry.getKey() + @@ -250,7 +250,7 @@ public class AMQ5266StarvedConsumerTest { this.activemqURL = activemqURL; this.activemqQueues = activemqQueues; - threads = new ArrayList(); + threads = new ArrayList<>(); // Build the threads and tell them how many messages to publish for (int i = 0; i < threadCount; i++) { @@ -407,7 +407,7 @@ public class AMQ5266StarvedConsumerTest { private String[] queues = null; // Map of IDs that were consumed, keyed by queue name. // We'll compare these against what was published to know if any got stuck or dropped. - private Map> idsByQueue = new HashMap>(); + private Map> idsByQueue = new HashMap<>(); private Map> threads; public ExportQueueConsumer(String activemqURL, @@ -426,12 +426,12 @@ public class AMQ5266StarvedConsumerTest { queues[i] = queues[i].trim(); } - threads = new HashMap>(); + threads = new HashMap<>(); // For each queue, create a list of threads and set up the list of ids for (String q : queues) { - List list = new ArrayList(); + List list = new ArrayList<>(); idsByQueue.put(q, Collections.synchronizedList(new ArrayList())); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ5266Test.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ5266Test.java index 582600c823..4765fab446 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ5266Test.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ5266Test.java @@ -193,7 +193,7 @@ public class AMQ5266Test { List idList = entry.getValue(); - int distinctConsumed = new TreeSet(idList).size(); + int distinctConsumed = new TreeSet<>(idList).size(); StringBuilder sb = new StringBuilder(); sb.append(" Queue: " + entry.getKey() + @@ -231,7 +231,7 @@ public class AMQ5266Test { this.activemqURL = activemqURL; this.activemqQueues = activemqQueues; - threads = new ArrayList(); + threads = new ArrayList<>(); // Build the threads and tell them how many messages to publish for (int i = 0; i < threadCount; i++) { @@ -382,7 +382,7 @@ public class AMQ5266Test { private String[] queues = null; // Map of IDs that were consumed, keyed by queue name. // We'll compare these against what was published to know if any got stuck or dropped. - private Map> idsByQueue = new HashMap>(); + private Map> idsByQueue = new HashMap<>(); private Map> threads; public ExportQueueConsumer(String activemqURL, @@ -401,12 +401,12 @@ public class AMQ5266Test { queues[i] = queues[i].trim(); } - threads = new HashMap>(); + threads = new HashMap<>(); // For each queue, create a list of threads and set up the list of ids for (String q : queues) { - List list = new ArrayList(); + List list = new ArrayList<>(); idsByQueue.put(q, Collections.synchronizedList(new ArrayList())); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ5450Test.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ5450Test.java index 21380e58f9..7ea4044ae6 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ5450Test.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/AMQ5450Test.java @@ -132,7 +132,7 @@ public class AMQ5450Test { MultiKahaDBPersistenceAdapter multiKahaDBPersistenceAdapter = new MultiKahaDBPersistenceAdapter(); multiKahaDBPersistenceAdapter.deleteAllMessages(); - ArrayList adapters = new ArrayList(); + ArrayList adapters = new ArrayList<>(); if (compositeMatch) { StringBuffer compositeDestBuf = new StringBuffer(); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/DurableConsumerTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/DurableConsumerTest.java index 695b1a4759..30464233e5 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/DurableConsumerTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/DurableConsumerTest.java @@ -74,7 +74,7 @@ public class DurableConsumerTest extends CombinationTestSupport { protected byte[] payload = new byte[1024 * 32]; protected ConnectionFactory factory; - protected Vector exceptions = new Vector(); + protected Vector exceptions = new Vector<>(); private static final String TOPIC_NAME = "failoverTopic"; private static final String CONNECTION_URL = "failover:(tcp://localhost:61616,tcp://localhost:61617)"; @@ -184,7 +184,7 @@ public class DurableConsumerTest extends CombinationTestSupport { Thread publisherThread = new Thread(new MessagePublisher()); publisherThread.start(); final int numSubs = 100; - final List list = new ArrayList(numSubs); + final List list = new ArrayList<>(numSubs); for (int i = 0; i < numSubs; i++) { final int id = i; diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/MemoryUsageBlockResumeTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/MemoryUsageBlockResumeTest.java index 84ed4d5099..1026a0564a 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/MemoryUsageBlockResumeTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/MemoryUsageBlockResumeTest.java @@ -65,7 +65,7 @@ public class MemoryUsageBlockResumeTest extends TestSupport implements Thread.Un Destination bigDestination = new ActiveMQQueue("FooTwoBig"); private String connectionUri; - private final Vector exceptions = new Vector(); + private final Vector exceptions = new Vector<>(); @Test(timeout = 60 * 1000) public void testBlockByOtherResumeNoException() throws Exception { diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/QueueWorkerPrefetchTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/QueueWorkerPrefetchTest.java index 18853258aa..95057b9556 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/QueueWorkerPrefetchTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/QueueWorkerPrefetchTest.java @@ -87,7 +87,7 @@ public class QueueWorkerPrefetchTest extends TestCase implements MessageListener */ private final AtomicLong acksReceived = new AtomicLong(0); - private final AtomicReference latch = new AtomicReference(); + private final AtomicReference latch = new AtomicReference<>(); private String connectionUri; diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/RawRollbackSharedConsumerTests.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/RawRollbackSharedConsumerTests.java index d45834801d..549922d948 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/RawRollbackSharedConsumerTests.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/RawRollbackSharedConsumerTests.java @@ -105,7 +105,7 @@ public class RawRollbackSharedConsumerTests { connection.start(); Session session = connection.createSession(true, Session.AUTO_ACKNOWLEDGE); String next = ""; - List msgs = new ArrayList(); + List msgs = new ArrayList<>(); MessageConsumer consumer = session.createConsumer(queue); while (next != null) { next = receiveAndConvert(consumer); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/RawRollbackTests.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/RawRollbackTests.java index 3c252205cb..74437b7afb 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/RawRollbackTests.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/RawRollbackTests.java @@ -106,7 +106,7 @@ public class RawRollbackTests { connection.start(); Session session = connection.createSession(true, Session.AUTO_ACKNOWLEDGE); String next = ""; - List msgs = new ArrayList(); + List msgs = new ArrayList<>(); while (next != null) { next = receiveAndConvert(session); if (next != null) diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/TrapMessageInJDBCStoreTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/TrapMessageInJDBCStoreTest.java index 36a80b442e..b6787e6075 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/TrapMessageInJDBCStoreTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/TrapMessageInJDBCStoreTest.java @@ -149,7 +149,7 @@ public class TrapMessageInJDBCStoreTest extends TestCase { Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Destination destination = session.createQueue(queue); - ArrayList consumedMessages = new ArrayList(); + ArrayList consumedMessages = new ArrayList<>(); MessageConsumer messageConsumer = session.createConsumer(destination); @@ -226,7 +226,7 @@ public class TrapMessageInJDBCStoreTest extends TestCase { try { ResultSet result = statement.executeQuery(); - ArrayList dbSeq = new ArrayList(); + ArrayList dbSeq = new ArrayList<>(); while (result.next()) { dbSeq.add(result.getLong(1)); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/amq1095/ActiveMQTestCase.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/amq1095/ActiveMQTestCase.java index cd0a1c489b..89b89db7b1 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/amq1095/ActiveMQTestCase.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/bugs/amq1095/ActiveMQTestCase.java @@ -55,7 +55,7 @@ public class ActiveMQTestCase extends TestCase { private BrokerService broker; protected Connection connection; protected Destination destination; - private final List consumersToEmpty = new LinkedList(); + private final List consumersToEmpty = new LinkedList<>(); protected final long RECEIVE_TIMEOUT = 500; /** diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/command/ActiveMQDestinationTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/command/ActiveMQDestinationTest.java index 46ede44255..bd5dd0d4d6 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/command/ActiveMQDestinationTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/command/ActiveMQDestinationTest.java @@ -56,11 +56,11 @@ public class ActiveMQDestinationTest extends DataStructureTestSupport { } public void testSorting() throws Exception { - SortedSet set = new TreeSet(); + SortedSet set = new TreeSet<>(); ActiveMQDestination[] destinations = {new ActiveMQQueue("A"), new ActiveMQQueue("B"), new ActiveMQTopic("A"), new ActiveMQTopic("B")}; List expected = Arrays.asList(destinations); set.addAll(expected); - List actual = new ArrayList(set); + List actual = new ArrayList<>(set); assertEquals("Sorted order", expected, actual); } diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/config/BrokerXmlConfigFromJNDITest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/config/BrokerXmlConfigFromJNDITest.java index a1da8f5f4e..8d658e75d8 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/config/BrokerXmlConfigFromJNDITest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/config/BrokerXmlConfigFromJNDITest.java @@ -36,7 +36,7 @@ public class BrokerXmlConfigFromJNDITest extends JmsTopicSendReceiveWithTwoConne // we could put these properties into a jndi.properties // on the classpath instead - Hashtable properties = new Hashtable(); + Hashtable properties = new Hashtable<>(); properties.put("java.naming.factory.initial", "org.apache.activemq.jndi.ActiveMQInitialContextFactory"); // configure the embedded broker using an XML config file diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/console/command/AMQ3410Test.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/console/command/AMQ3410Test.java index 6ba38ef322..317fd55835 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/console/command/AMQ3410Test.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/console/command/AMQ3410Test.java @@ -71,7 +71,7 @@ public class AMQ3410Test extends TestCase { command.setCommandContext(context); - List tokens = new ArrayList(); + List tokens = new ArrayList<>(); tokens.addAll(DEFAULT_OPTIONS); tokens.addAll(DEFAULT_TOKENS); @@ -88,7 +88,7 @@ public class AMQ3410Test extends TestCase { command.setCommandContext(context); - List tokens = new ArrayList(); + List tokens = new ArrayList<>(); tokens.addAll(DEFAULT_OPTIONS); tokens.add("--factory"); tokens.add(DummyConnectionFactory.class.getCanonicalName()); @@ -108,7 +108,7 @@ public class AMQ3410Test extends TestCase { command.setCommandContext(context); - List tokens = new ArrayList(); + List tokens = new ArrayList<>(); tokens.addAll(DEFAULT_OPTIONS); tokens.add("--factory"); tokens.add("org.apache.activemq.console.command.TestAMQ3410.DoesntExistFactory"); @@ -135,7 +135,7 @@ public class AMQ3410Test extends TestCase { command.setCommandContext(context); - List tokens = new ArrayList(); + List tokens = new ArrayList<>(); tokens.addAll(DEFAULT_OPTIONS); tokens.add("--factory"); tokens.add(InvalidConnectionFactory.class.getCanonicalName()); @@ -164,7 +164,7 @@ public class AMQ3410Test extends TestCase { command.setCommandContext(context); - List tokens = new ArrayList(); + List tokens = new ArrayList<>(); tokens.addAll(DEFAULT_OPTIONS); tokens.add("--factory"); tokens.add("java.lang.Object"); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/console/command/AMQ3411Test.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/console/command/AMQ3411Test.java index dc307cba88..9ca9d18126 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/console/command/AMQ3411Test.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/console/command/AMQ3411Test.java @@ -70,7 +70,7 @@ public class AMQ3411Test extends TestCase { command.setCommandContext(context); - List tokens = new ArrayList(); + List tokens = new ArrayList<>(); tokens.addAll(DEFAULT_OPTIONS); tokens.addAll(DEFAULT_TOKENS); @@ -92,7 +92,7 @@ public class AMQ3411Test extends TestCase { command.setCommandContext(context); - List tokens = new ArrayList(); + List tokens = new ArrayList<>(); tokens.addAll(DEFAULT_OPTIONS); tokens.add("--password"); tokens.add(password); @@ -117,7 +117,7 @@ public class AMQ3411Test extends TestCase { command.setCommandContext(context); - List tokens = new ArrayList(); + List tokens = new ArrayList<>(); tokens.addAll(DEFAULT_OPTIONS); tokens.add("--passwordFactory"); tokens.add(LowercasingPasswordFactory.class.getCanonicalName()); @@ -141,7 +141,7 @@ public class AMQ3411Test extends TestCase { command.setCommandContext(context); - List tokens = new ArrayList(); + List tokens = new ArrayList<>(); tokens.addAll(DEFAULT_OPTIONS); tokens.add("--passwordFactory"); tokens.add("org.apache.activemq.console.command.TestAMQ3411.DoesntExistFactory"); @@ -173,7 +173,7 @@ public class AMQ3411Test extends TestCase { command.setCommandContext(context); - List tokens = new ArrayList(); + List tokens = new ArrayList<>(); tokens.addAll(DEFAULT_OPTIONS); tokens.add("--passwordFactory"); tokens.add("java.lang.Object"); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/console/command/PurgeCommandTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/console/command/PurgeCommandTest.java index 374fa01ba8..cc30cb066f 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/console/command/PurgeCommandTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/console/command/PurgeCommandTest.java @@ -237,7 +237,7 @@ public class PurgeCommandTest extends TestCase { purgeCommand.setCommandContext(context); purgeCommand.setJmxUseLocal(true); - List tokens = new ArrayList(); + List tokens = new ArrayList<>(); tokens.add("--msgsel"); tokens.add(MSG_SEL_WITH_PROPERTY); @@ -263,7 +263,7 @@ public class PurgeCommandTest extends TestCase { purgeCommand.setCommandContext(context); purgeCommand.setJmxUseLocal(true); - List tokens = new ArrayList(); + List tokens = new ArrayList<>(); tokens.add("--msgsel"); tokens.add(MSG_SEL_COMPLEX); @@ -314,7 +314,7 @@ public class PurgeCommandTest extends TestCase { purgeCommand.setCommandContext(context); purgeCommand.setJmxUseLocal(true); - List tokens = new ArrayList(); + List tokens = new ArrayList<>(); tokens.add("--msgsel"); tokens.add(MSG_SEL_COMPLEX_SQL_AND); @@ -352,7 +352,7 @@ public class PurgeCommandTest extends TestCase { purgeCommand.setCommandContext(context); purgeCommand.setJmxUseLocal(true); - List tokens = new ArrayList(); + List tokens = new ArrayList<>(); tokens.add("--msgsel"); tokens.add(MSG_SEL_COMPLEX_SQL_OR); @@ -403,7 +403,7 @@ public class PurgeCommandTest extends TestCase { purgeCommand.setCommandContext(context); purgeCommand.setJmxUseLocal(true); - List tokens = new ArrayList(); + List tokens = new ArrayList<>(); tokens.add("--msgsel"); tokens.add("(XTestProperty LIKE '1:*') AND (JMSPriority>3)"); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/jndi/ActiveMQWASInitialContextFactoryTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/jndi/ActiveMQWASInitialContextFactoryTest.java index 2045534226..0a4fb479e9 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/jndi/ActiveMQWASInitialContextFactoryTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/jndi/ActiveMQWASInitialContextFactoryTest.java @@ -24,7 +24,7 @@ public class ActiveMQWASInitialContextFactoryTest extends JNDITestSupport { @SuppressWarnings("unchecked") public void testTransformEnvironment() { - Hashtable originalEnvironment = new Hashtable(); + Hashtable originalEnvironment = new Hashtable<>(); originalEnvironment.put("java.naming.connectionFactoryNames", "ConnectionFactory"); originalEnvironment.put("java.naming.topic.jms.systemMessageTopic", "jms/systemMessageTopic"); originalEnvironment.put(Context.PROVIDER_URL, "tcp://localhost:61616;tcp://localhost:61617"); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/jndi/JNDITestSupport.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/jndi/JNDITestSupport.java index f1bb0cb34b..a00ffee7c7 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/jndi/JNDITestSupport.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/jndi/JNDITestSupport.java @@ -38,7 +38,7 @@ public abstract class JNDITestSupport extends TestCase { private static final org.apache.commons.logging.Log LOG = org.apache.commons.logging.LogFactory.getLog(JNDITestSupport.class); - protected Hashtable environment = new Hashtable(); + protected Hashtable environment = new Hashtable<>(); protected Context context; protected void assertConnectionFactoryPresent(String lookupName) throws NamingException { diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/joramtests/ActiveMQAdmin.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/joramtests/ActiveMQAdmin.java index d5109d97be..3befdb619d 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/joramtests/ActiveMQAdmin.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/joramtests/ActiveMQAdmin.java @@ -42,7 +42,7 @@ public class ActiveMQAdmin implements Admin { { try { // Use the jetty JNDI context since it's mutable. - final Hashtable env = new Hashtable(); + final Hashtable env = new Hashtable<>(); env.put("java.naming.factory.initial", "org.eclipse.jetty.jndi.InitialContextFactory"); env.put("java.naming.factory.url.pkgs", "org.eclipse.jetty.jndi"); ; diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/network/BrokerNetworkWithStuckMessagesTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/network/BrokerNetworkWithStuckMessagesTest.java index aa6f9b96fc..fe6f31cf6d 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/network/BrokerNetworkWithStuckMessagesTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/network/BrokerNetworkWithStuckMessagesTest.java @@ -90,8 +90,8 @@ public class BrokerNetworkWithStuckMessagesTest { private BrokerService secondRemoteBroker; private DemandForwardingBridge bridge; - protected Map brokers = new HashMap(); - protected ArrayList connections = new ArrayList(); + protected Map brokers = new HashMap<>(); + protected ArrayList connections = new ArrayList<>(); protected TransportConnector connector; protected TransportConnector remoteConnector; @@ -491,7 +491,7 @@ public class BrokerNetworkWithStuckMessagesTest { session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); Queue destination = session.createQueue(queueName); QueueBrowser browser = session.createBrowser(destination); - List list = new ArrayList(); + List list = new ArrayList<>(); for (Enumeration enumn = browser.getEnumeration(); enumn.hasMoreElements(); ) { list.add(enumn.nextElement()); } @@ -511,7 +511,7 @@ public class BrokerNetworkWithStuckMessagesTest { } private Object[] browseQueueWithJmx(BrokerService broker) throws Exception { - Hashtable params = new Hashtable(); + Hashtable params = new Hashtable<>(); params.put("brokerName", broker.getBrokerName()); params.put("type", "Broker"); params.put("destinationType", "Queue"); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/network/CheckDuplicateMessagesOnDuplexTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/network/CheckDuplicateMessagesOnDuplexTest.java index c60abe659b..19122151bf 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/network/CheckDuplicateMessagesOnDuplexTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/network/CheckDuplicateMessagesOnDuplexTest.java @@ -180,7 +180,7 @@ public class CheckDuplicateMessagesOnDuplexTest { localBroker.setManagementContext(managementContext); PersistenceAdapter persistenceAdapter = persistenceAdapterFactory("target/local"); localBroker.setPersistenceAdapter(persistenceAdapter); - List transportConnectors = new ArrayList(); + List transportConnectors = new ArrayList<>(); DebugTransportFactory tf = new DebugTransportFactory(); TransportServer transport = tf.doBind(URI.create("nio://127.0.0.1:23539")); TransportConnector transportConnector = new TransportConnector(transport); @@ -200,7 +200,7 @@ public class CheckDuplicateMessagesOnDuplexTest { remoteBroker.setManagementContext(managementContext); PersistenceAdapter persistenceAdapter = persistenceAdapterFactory("target/remote"); remoteBroker.setPersistenceAdapter(persistenceAdapter); - List networkConnectors = new ArrayList(); + List networkConnectors = new ArrayList<>(); DiscoveryNetworkConnector networkConnector = new DiscoveryNetworkConnector(); networkConnector.setName("to local"); // set maxInactivityDuration to 0, otherwise the broker restarts while you are in the debugger diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/network/FailoverStaticNetworkTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/network/FailoverStaticNetworkTest.java index 8fcc6fadfd..d541a15642 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/network/FailoverStaticNetworkTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/network/FailoverStaticNetworkTest.java @@ -84,7 +84,7 @@ public class FailoverStaticNetworkTest { // lazy init listener on broker start TransportConnector transportConnector = new TransportConnector(); transportConnector.setUri(new URI(scheme + "://localhost:" + listenPort)); - List transportConnectors = new ArrayList(); + List transportConnectors = new ArrayList<>(); transportConnectors.add(transportConnector); broker.setTransportConnectors(transportConnectors); if (networkToPorts != null && networkToPorts.length > 0) { @@ -191,7 +191,7 @@ public class FailoverStaticNetworkTest { } private Set getNetworkBridgeMBeanName(BrokerService brokerB) throws Exception { - Set names = new HashSet(); + Set names = new HashSet<>(); for (ObjectName objectName : brokerB.getManagementContext().queryNames(null, null)) { if (objectName.getKeyProperty("networkBridge") != null) { names.add(objectName.getKeyProperty("networkBridge")); @@ -202,7 +202,7 @@ public class FailoverStaticNetworkTest { @Test public void testSendReceiveFailoverDuplex() throws Exception { - final Vector errors = new Vector(); + final Vector errors = new Vector<>(); final String dataDir = "target/data/shared"; brokerA = createBroker("61617", dataDir); brokerA.start(); @@ -224,7 +224,7 @@ public class FailoverStaticNetworkTest { }); executor.shutdown(); - HashMap networkConnectorProps = new HashMap(); + HashMap networkConnectorProps = new HashMap<>(); networkConnectorProps.put("duplex", "true"); brokerB = createBroker("tcp", "62617", new String[]{"61617", "63617"}, networkConnectorProps); brokerB.start(); @@ -268,7 +268,7 @@ public class FailoverStaticNetworkTest { }); executor.shutdown(); - HashMap networkConnectorProps = new HashMap(); + HashMap networkConnectorProps = new HashMap<>(); networkConnectorProps.put("duplex", "true"); networkConnectorProps.put("networkTTL", "2"); @@ -330,7 +330,7 @@ public class FailoverStaticNetworkTest { @Test public void testRepeatedSendReceiveWithMasterSlaveAlternateDuplex() throws Exception { - HashMap networkConnectorProps = new HashMap(); + HashMap networkConnectorProps = new HashMap<>(); networkConnectorProps.put("duplex", "true"); doTestRepeatedSendReceiveWithMasterSlaveAlternate(networkConnectorProps); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/network/NetworkDestinationFilterTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/network/NetworkDestinationFilterTest.java index c65f36a511..b1db5af703 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/network/NetworkDestinationFilterTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/network/NetworkDestinationFilterTest.java @@ -32,7 +32,7 @@ public class NetworkDestinationFilterTest extends TestCase { public void testFilter() throws Exception { NetworkBridgeConfiguration config = new NetworkBridgeConfiguration(); assertEquals(AdvisorySupport.CONSUMER_ADVISORY_TOPIC_PREFIX + ">", config.getDestinationFilter()); - List dests = new ArrayList(); + List dests = new ArrayList<>(); config.setDynamicallyIncludedDestinations(dests); assertEquals(AdvisorySupport.CONSUMER_ADVISORY_TOPIC_PREFIX + ">", config.getDestinationFilter()); dests.add(new ActiveMQQueue("TEST.>")); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/network/NetworkLoadTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/network/NetworkLoadTest.java index 0a8ed30bd9..335a63c005 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/network/NetworkLoadTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/network/NetworkLoadTest.java @@ -185,7 +185,7 @@ public class NetworkLoadTest extends TestCase { memoryManager.getMemoryUsage().setLimit(1024 * 1024 * 50); // 50 MB broker.setSystemUsage(memoryManager); - final List policyEntries = new ArrayList(); + final List policyEntries = new ArrayList<>(); final PolicyEntry entry = new PolicyEntry(); entry.setQueue(">"); entry.setMemoryLimit(1024 * 1024 * 1); // Set to 1 MB @@ -230,7 +230,7 @@ public class NetworkLoadTest extends TestCase { Session fromSession = fromConnection.createSession(false, Session.AUTO_ACKNOWLEDGE); MessageConsumer consumer = fromSession.createConsumer(new ActiveMQQueue("Q" + from)); - final AtomicReference lastMessageReceived = new AtomicReference(); + final AtomicReference lastMessageReceived = new AtomicReference<>(); final AtomicLong producedMessages = new AtomicLong(); final AtomicLong receivedMessages = new AtomicLong(); final AtomicBoolean done = new AtomicBoolean(); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/network/NetworkReconnectTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/network/NetworkReconnectTest.java index 34d779ec78..8e345f491f 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/network/NetworkReconnectTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/network/NetworkReconnectTest.java @@ -56,7 +56,7 @@ public class NetworkReconnectTest extends TestCase { private ActiveMQConnectionFactory producerConnectionFactory; private ActiveMQConnectionFactory consumerConnectionFactory; private Destination destination; - private ArrayList connections = new ArrayList(); + private ArrayList connections = new ArrayList<>(); public void xtestMultipleProducerBrokerRestarts() throws Exception { for (int i = 0; i < 10; i++) { diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/network/NetworkTestSupport.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/network/NetworkTestSupport.java index bb875dc978..722459c492 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/network/NetworkTestSupport.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/network/NetworkTestSupport.java @@ -36,7 +36,7 @@ import org.apache.activemq.usage.SystemUsage; public class NetworkTestSupport extends BrokerTestSupport { - protected ArrayList connections = new ArrayList(); + protected ArrayList connections = new ArrayList<>(); protected TransportConnector connector; diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/network/SSHTunnelNetworkReconnectTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/network/SSHTunnelNetworkReconnectTest.java index 5e74f1d7da..ba10f4536d 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/network/SSHTunnelNetworkReconnectTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/network/SSHTunnelNetworkReconnectTest.java @@ -31,7 +31,7 @@ import org.apache.activemq.broker.BrokerService; */ public class SSHTunnelNetworkReconnectTest extends NetworkReconnectTest { - ArrayList processes = new ArrayList(); + ArrayList processes = new ArrayList<>(); @Override protected BrokerService createFirstBroker() throws Exception { diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/network/jms/QueueBridgeStandaloneReconnectTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/network/jms/QueueBridgeStandaloneReconnectTest.java index 2f2a489adb..b76c85924b 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/network/jms/QueueBridgeStandaloneReconnectTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/network/jms/QueueBridgeStandaloneReconnectTest.java @@ -51,7 +51,7 @@ public class QueueBridgeStandaloneReconnectTest { private Destination outbound; private Destination inbound; - private final ArrayList connections = new ArrayList(); + private final ArrayList connections = new ArrayList<>(); @Test(timeout = 60 * 1000) public void testSendAndReceiveOverConnectedBridges() throws Exception { diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/network/jms/QueueOutboundBridgeReconnectTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/network/jms/QueueOutboundBridgeReconnectTest.java index 7a4582a2c1..04e2a29d38 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/network/jms/QueueOutboundBridgeReconnectTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/network/jms/QueueOutboundBridgeReconnectTest.java @@ -54,7 +54,7 @@ public class QueueOutboundBridgeReconnectTest { private ActiveMQConnectionFactory producerConnectionFactory; private ActiveMQConnectionFactory consumerConnectionFactory; private Destination destination; - private final ArrayList connections = new ArrayList(); + private final ArrayList connections = new ArrayList<>(); @Test public void testMultipleProducerBrokerRestarts() throws Exception { diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/network/jms/TopicBridgeStandaloneReconnectTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/network/jms/TopicBridgeStandaloneReconnectTest.java index 8f62a4f43e..34236ff6e4 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/network/jms/TopicBridgeStandaloneReconnectTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/network/jms/TopicBridgeStandaloneReconnectTest.java @@ -51,7 +51,7 @@ public class TopicBridgeStandaloneReconnectTest { private Destination outbound; private Destination inbound; - private final ArrayList connections = new ArrayList(); + private final ArrayList connections = new ArrayList<>(); @Test public void testSendAndReceiveOverConnectedBridges() throws Exception { diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/network/jms/TopicOutboundBridgeReconnectTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/network/jms/TopicOutboundBridgeReconnectTest.java index 745d1ae08f..dfcf4a850f 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/network/jms/TopicOutboundBridgeReconnectTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/network/jms/TopicOutboundBridgeReconnectTest.java @@ -54,7 +54,7 @@ public class TopicOutboundBridgeReconnectTest { private ActiveMQConnectionFactory producerConnectionFactory; private ActiveMQConnectionFactory consumerConnectionFactory; private Destination destination; - private final ArrayList connections = new ArrayList(); + private final ArrayList connections = new ArrayList<>(); @Test public void testMultipleProducerBrokerRestarts() throws Exception { diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/openwire/DataFileGenerator.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/openwire/DataFileGenerator.java index 31bb4ed58a..029ee7128c 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/openwire/DataFileGenerator.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/openwire/DataFileGenerator.java @@ -51,7 +51,7 @@ public abstract class DataFileGenerator extends org.junit.Assert { */ public static ArrayList getAllDataFileGenerators() throws Exception { // System.out.println("Looking for generators in : "+classFileDir); - ArrayList l = new ArrayList(); + ArrayList l = new ArrayList<>(); File[] files = CLASS_FILE_DIR.listFiles(); for (int i = 0; files != null && i < files.length; i++) { File file = files[i]; diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/openwire/DataFileGeneratorTestSupport.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/openwire/DataFileGeneratorTestSupport.java index 42516143e4..cbaa099ff5 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/openwire/DataFileGeneratorTestSupport.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/openwire/DataFileGeneratorTestSupport.java @@ -103,7 +103,7 @@ public abstract class DataFileGeneratorTestSupport extends TestSupport { ByteArrayInputStream in = new ByteArrayInputStream(buffer.toByteArray()); DataInputStream dis = new DataInputStream(in); Object actual = openWireformat.unmarshal(dis); - assertBeansEqual("", new HashSet(), expected, actual); + assertBeansEqual("", new HashSet<>(), expected, actual); LOG.info("Parsed: " + actual); } diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/perf/ConnectionChurnTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/perf/ConnectionChurnTest.java index 83a98c2cf9..fdb1d96524 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/perf/ConnectionChurnTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/perf/ConnectionChurnTest.java @@ -45,7 +45,7 @@ public class ConnectionChurnTest extends TestCase { public void testPerformance() throws Exception { ConnectionFactory factory = createConnectionFactory(); - List list = new ArrayList(); + List list = new ArrayList<>(); for (int i = 0; i < CONNECTION_COUNT; i++) { Connection connection = factory.createConnection(); connection.start(); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/perf/SimpleNonPersistentQueueNetworkTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/perf/SimpleNonPersistentQueueNetworkTest.java index a24044823f..eb45c681db 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/perf/SimpleNonPersistentQueueNetworkTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/perf/SimpleNonPersistentQueueNetworkTest.java @@ -74,7 +74,7 @@ public class SimpleNonPersistentQueueNetworkTest extends SimpleNetworkTest { protected void configureBroker(BrokerService answer) throws Exception { answer.setPersistent(false); answer.setMonitorConnectionSplits(true); - final List policyEntries = new ArrayList(); + final List policyEntries = new ArrayList<>(); final PolicyEntry entry = new PolicyEntry(); entry.setQueue(">"); entry.setMemoryLimit(1024 * 1024 * 100); // Set to 1 MB diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/perf/SimpleNonPersistentQueueTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/perf/SimpleNonPersistentQueueTest.java index ed5d525eb3..38dddd6794 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/perf/SimpleNonPersistentQueueTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/perf/SimpleNonPersistentQueueTest.java @@ -64,7 +64,7 @@ public class SimpleNonPersistentQueueTest extends SimpleQueueTest { @Override protected void configureBroker(BrokerService answer, String uri) throws Exception { // answer.setPersistent(false); - final List policyEntries = new ArrayList(); + final List policyEntries = new ArrayList<>(); final PolicyEntry entry = new PolicyEntry(); entry.setQueue(">"); entry.setMemoryLimit(1024 * 1024 * 1); // Set to 1 MB diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/proxy/AMQ4889Test.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/proxy/AMQ4889Test.java index 94505958fa..df05d7f9ee 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/proxy/AMQ4889Test.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/proxy/AMQ4889Test.java @@ -62,7 +62,7 @@ public class AMQ4889Test { brokerService = new BrokerService(); brokerService.setPersistent(false); - ArrayList plugins = new ArrayList(); + ArrayList plugins = new ArrayList<>(); BrokerPlugin authenticationPlugin = configureAuthentication(); plugins.add(authenticationPlugin); BrokerPlugin[] array = new BrokerPlugin[plugins.size()]; @@ -82,7 +82,7 @@ public class AMQ4889Test { } protected BrokerPlugin configureAuthentication() throws Exception { - List users = new ArrayList(); + List users = new ArrayList<>(); users.add(new AuthenticationUser(USER, GOOD_USER_PASSWORD, "users")); SimpleAuthenticationPlugin authenticationPlugin = new SimpleAuthenticationPlugin(users); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/proxy/ProxyTestSupport.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/proxy/ProxyTestSupport.java index 97c66b6e30..02284dfd86 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/proxy/ProxyTestSupport.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/proxy/ProxyTestSupport.java @@ -31,7 +31,7 @@ import org.apache.activemq.usage.SystemUsage; public class ProxyTestSupport extends BrokerTestSupport { - protected ArrayList connections = new ArrayList(); + protected ArrayList connections = new ArrayList<>(); protected TransportConnector connector; diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/security/AbstractCachedLDAPAuthorizationMapLegacyTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/security/AbstractCachedLDAPAuthorizationMapLegacyTest.java index 5ca32d7d97..902ee107c0 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/security/AbstractCachedLDAPAuthorizationMapLegacyTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/security/AbstractCachedLDAPAuthorizationMapLegacyTest.java @@ -373,7 +373,7 @@ public abstract class AbstractCachedLDAPAuthorizationMapLegacyTest extends Abstr String ldapPass, DirContext context) throws Exception { // Cleanup everything used for testing. - List dns = new LinkedList(); + List dns = new LinkedList<>(); dns.add(deleteFromDn); while (!dns.isEmpty()) { diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/security/AuthorizationMapTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/security/AuthorizationMapTest.java index 84753554ea..e0796ba09e 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/security/AuthorizationMapTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/security/AuthorizationMapTest.java @@ -94,7 +94,7 @@ public class AuthorizationMapTest extends TestCase { protected AuthorizationMap createWildcardAuthorizationMap() { DefaultAuthorizationMap answer = new DefaultAuthorizationMap(); - List entries = new ArrayList(); + List entries = new ArrayList<>(); AuthorizationEntry entry = new AuthorizationEntry(); entry.setQueue(">"); @@ -129,7 +129,7 @@ public class AuthorizationMapTest extends TestCase { protected AuthorizationMap createAuthorizationMap() { DefaultAuthorizationMap answer = new DefaultAuthorizationMap(); - List entries = new ArrayList(); + List entries = new ArrayList<>(); AuthorizationEntry entry = new AuthorizationEntry(); entry.setGroupClass("org.apache.activemq.jaas.GroupPrincipal"); @@ -162,7 +162,7 @@ public class AuthorizationMapTest extends TestCase { protected AuthorizationMap createAuthorizationMapWithTempDest() { DefaultAuthorizationMap answer = new DefaultAuthorizationMap(); - List entries = new ArrayList(); + List entries = new ArrayList<>(); AuthorizationEntry entry = new AuthorizationEntry(); entry.setQueue(">"); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/security/JaasCertificateAuthenticationBrokerTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/security/JaasCertificateAuthenticationBrokerTest.java index 72cbfc18ac..07b007af5f 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/security/JaasCertificateAuthenticationBrokerTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/security/JaasCertificateAuthenticationBrokerTest.java @@ -62,7 +62,7 @@ public class JaasCertificateAuthenticationBrokerTest extends TestCase { } private void setConfiguration(Set userNames, Set groupNames, boolean loginShouldSucceed) { - HashMap configOptions = new HashMap(); + HashMap configOptions = new HashMap<>(); String userNamesString; { @@ -95,10 +95,10 @@ public class JaasCertificateAuthenticationBrokerTest extends TestCase { public void testAddConnectionSuccess() { String dnUserName = "dnUserName"; - HashSet userNames = new HashSet(); + HashSet userNames = new HashSet<>(); userNames.add(dnUserName); - HashSet groupNames = new HashSet(); + HashSet groupNames = new HashSet<>(); groupNames.add("testGroup1"); groupNames.add("testGroup2"); groupNames.add("tesetGroup3"); @@ -155,9 +155,9 @@ public class JaasCertificateAuthenticationBrokerTest extends TestCase { } public void testAddConnectionFailure() { - HashSet userNames = new HashSet(); + HashSet userNames = new HashSet<>(); - HashSet groupNames = new HashSet(); + HashSet groupNames = new HashSet<>(); groupNames.add("testGroup1"); groupNames.add("testGroup2"); groupNames.add("tesetGroup3"); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/security/JaasDualAuthenticationBrokerTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/security/JaasDualAuthenticationBrokerTest.java index 17db0a8268..a3a5cd6a89 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/security/JaasDualAuthenticationBrokerTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/security/JaasDualAuthenticationBrokerTest.java @@ -66,8 +66,8 @@ public class JaasDualAuthenticationBrokerTest extends TestCase { * using the StubLoginModule */ void createLoginConfig() { - HashMap sslConfigOptions = new HashMap(); - HashMap configOptions = new HashMap(); + HashMap sslConfigOptions = new HashMap<>(); + HashMap configOptions = new HashMap<>(); sslConfigOptions.put(StubLoginModule.ALLOW_LOGIN_PROPERTY, "true"); sslConfigOptions.put(StubLoginModule.USERS_PROPERTY, DN_USERNAME); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/security/LDAPAuthorizationMapTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/security/LDAPAuthorizationMapTest.java index 34aa7b24c7..76986a3aea 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/security/LDAPAuthorizationMapTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/security/LDAPAuthorizationMapTest.java @@ -69,7 +69,7 @@ public class LDAPAuthorizationMapTest extends AbstractLdapTestUnit { @Test public void testOpen() throws Exception { DirContext ctx = authMap.open(); - HashSet set = new HashSet(); + HashSet set = new HashSet<>(); NamingEnumeration list = ctx.list("ou=destinations,o=ActiveMQ,ou=system"); while (list.hasMore()) { NameClassPair ncp = list.next(); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/security/SecurityJMXTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/security/SecurityJMXTest.java index d660de30b8..eb7fc046aa 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/security/SecurityJMXTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/security/SecurityJMXTest.java @@ -75,7 +75,7 @@ public class SecurityJMXTest extends TestCase { MBeanServerConnection connection = connector.getMBeanServerConnection(); ObjectName name = new ObjectName("org.apache.activemq:type=Broker,brokerName=localhost," + "destinationType=Queue,destinationName=TEST.Q"); QueueViewMBean queueMbean = MBeanServerInvocationHandler.newProxyInstance(connection, name, QueueViewMBean.class, true); - HashMap headers = new HashMap(); + HashMap headers = new HashMap<>(); headers.put("timeToLive", Long.toString(2000)); headers.put("JMSDeliveryMode", Integer.toString(DeliveryMode.PERSISTENT)); queueMbean.sendTextMessage(headers, "test", "system", "manager"); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/security/SimpleSecurityBrokerSystemTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/security/SimpleSecurityBrokerSystemTest.java index 7036dd0afe..b29bb21448 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/security/SimpleSecurityBrokerSystemTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/security/SimpleSecurityBrokerSystemTest.java @@ -151,15 +151,15 @@ public class SimpleSecurityBrokerSystemTest extends SecurityTestSupport { @Override public Broker installPlugin(Broker broker) { - HashMap u = new HashMap(); + HashMap u = new HashMap<>(); u.put("system", "manager"); u.put("user", "password"); u.put("guest", "password"); - Map> groups = new HashMap>(); - groups.put("system", new HashSet(Arrays.asList(new Principal[]{ADMINS, USERS}))); - groups.put("user", new HashSet(Arrays.asList(new Principal[]{USERS}))); - groups.put("guest", new HashSet(Arrays.asList(new Principal[]{GUESTS}))); + Map> groups = new HashMap<>(); + groups.put("system", new HashSet<>(Arrays.asList(new Principal[]{ADMINS, USERS}))); + groups.put("user", new HashSet<>(Arrays.asList(new Principal[]{USERS}))); + groups.put("guest", new HashSet<>(Arrays.asList(new Principal[]{GUESTS}))); return new SimpleAuthenticationBroker(broker, u, groups); } diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/spring/ConsumerBean.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/spring/ConsumerBean.java index 1aa215671d..c6abef89b3 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/spring/ConsumerBean.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/spring/ConsumerBean.java @@ -29,7 +29,7 @@ import org.slf4j.LoggerFactory; public class ConsumerBean extends Assert implements MessageListener { private static final Logger LOG = LoggerFactory.getLogger(ConsumerBean.class); - private final List messages = new ArrayList(); + private final List messages = new ArrayList<>(); private boolean verbose; /** @@ -44,7 +44,7 @@ public class ConsumerBean extends Assert implements MessageListener { public List flushMessages() { List answer = null; synchronized (messages) { - answer = new ArrayList(messages); + answer = new ArrayList<>(messages); messages.clear(); } return answer; diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/store/AutoStorePerDestinationTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/store/AutoStorePerDestinationTest.java index da18bebe82..e28288be4a 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/store/AutoStorePerDestinationTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/store/AutoStorePerDestinationTest.java @@ -31,7 +31,7 @@ public class AutoStorePerDestinationTest extends StorePerDestinationTest { if (deleteAllMessages) { multiKahaDBPersistenceAdapter.deleteAllMessages(); } - ArrayList adapters = new ArrayList(); + ArrayList adapters = new ArrayList<>(); FilteredKahaDBPersistenceAdapter template = new FilteredKahaDBPersistenceAdapter(); template.setPersistenceAdapter(createStore(deleteAllMessages)); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/store/StorePerDestinationTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/store/StorePerDestinationTest.java index 23c2e7dd0b..cc144d0589 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/store/StorePerDestinationTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/store/StorePerDestinationTest.java @@ -53,7 +53,7 @@ public class StorePerDestinationTest { static final Logger LOG = LoggerFactory.getLogger(StorePerDestinationTest.class); final static int maxFileLength = 1024 * 100; final static int numToSend = 5000; - final Vector exceptions = new Vector(); + final Vector exceptions = new Vector<>(); BrokerService brokerService; protected BrokerService createBroker(PersistenceAdapter kaha) throws Exception { @@ -85,7 +85,7 @@ public class StorePerDestinationTest { if (deleteAllMessages) { multiKahaDBPersistenceAdapter.deleteAllMessages(); } - ArrayList adapters = new ArrayList(); + ArrayList adapters = new ArrayList<>(); FilteredKahaDBPersistenceAdapter theRest = new FilteredKahaDBPersistenceAdapter(); theRest.setPersistenceAdapter(createStore(deleteAllMessages)); @@ -181,7 +181,7 @@ public class StorePerDestinationTest { @Test public void testDirectoryDefault() throws Exception { MultiKahaDBPersistenceAdapter multiKahaDBPersistenceAdapter = new MultiKahaDBPersistenceAdapter(); - ArrayList adapters = new ArrayList(); + ArrayList adapters = new ArrayList<>(); FilteredKahaDBPersistenceAdapter otherFilteredKahaDBPersistenceAdapter = new FilteredKahaDBPersistenceAdapter(); PersistenceAdapter otherStore = createStore(false); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/store/jdbc/JDBCIOExceptionHandlerMockeryTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/store/jdbc/JDBCIOExceptionHandlerMockeryTest.java index 20ee5b1c8e..fa7b848809 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/store/jdbc/JDBCIOExceptionHandlerMockeryTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/store/jdbc/JDBCIOExceptionHandlerMockeryTest.java @@ -39,7 +39,7 @@ import static org.junit.Assert.fail; public class JDBCIOExceptionHandlerMockeryTest { private static final Logger LOG = LoggerFactory.getLogger(JDBCIOExceptionHandlerMockeryTest.class); - private HashMap exceptions = new HashMap(); + private HashMap exceptions = new HashMap<>(); @Test public void testShutdownWithoutTransportRestart() throws Exception { diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/store/jdbc/JDBCIOExceptionHandlerTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/store/jdbc/JDBCIOExceptionHandlerTest.java index 5066100ce3..6c43646562 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/store/jdbc/JDBCIOExceptionHandlerTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/store/jdbc/JDBCIOExceptionHandlerTest.java @@ -121,7 +121,7 @@ public class JDBCIOExceptionHandlerTest extends TestCase { master.start(); master.waitUntilStarted(); - final AtomicReference slave = new AtomicReference(); + final AtomicReference slave = new AtomicReference<>(); Thread slaveThread = new Thread() { @Override diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/store/jdbc/JDBCMessagePriorityTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/store/jdbc/JDBCMessagePriorityTest.java index 4637778147..ae0ac1f33e 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/store/jdbc/JDBCMessagePriorityTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/store/jdbc/JDBCMessagePriorityTest.java @@ -144,7 +144,7 @@ public class JDBCMessagePriorityTest extends MessagePriorityTest { final AtomicInteger[] messageCounts = new AtomicInteger[maxPriority]; final long[] messageIds = new long[maxPriority]; - Vector producers = new Vector(); + Vector producers = new Vector<>(); for (int priority = 0; priority < maxPriority; priority++) { producers.add(new ProducerThread(topic, MSG_NUM, priority)); messageCounts[priority] = new AtomicInteger(0); @@ -156,7 +156,7 @@ public class JDBCMessagePriorityTest extends MessagePriorityTest { } final int closeFrequency = MSG_NUM / 2; - HashMap dups = new HashMap(); + HashMap dups = new HashMap<>(); sub = consumerSession.createDurableSubscriber(topic, subName); for (int i = 0; i < MSG_NUM * maxPriority; i++) { Message msg = sub.receive(10000); @@ -197,7 +197,7 @@ public class JDBCMessagePriorityTest extends MessagePriorityTest { sub.close(); final int TO_SEND = 2000; - final Vector duplicates = new Vector(); + final Vector duplicates = new Vector<>(); final int[] dups = new int[TO_SEND * 4]; long start; double max = 0, sum = 0; diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/store/jdbc/JDBCTablePrefixAssignedTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/store/jdbc/JDBCTablePrefixAssignedTest.java index bd00179481..7ac10b50a7 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/store/jdbc/JDBCTablePrefixAssignedTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/store/jdbc/JDBCTablePrefixAssignedTest.java @@ -97,7 +97,7 @@ public class JDBCTablePrefixAssignedTest { java.sql.Connection conn = ((JDBCPersistenceAdapter) service.getPersistenceAdapter()).getDataSource().getConnection(); PreparedStatement statement = conn.prepareStatement("SELECT ID, MSG FROM MYPREFIX_ACTIVEMQ_MSGS"); ResultSet result = statement.executeQuery(); - ArrayList results = new ArrayList(); + ArrayList results = new ArrayList<>(); while (result.next()) { long id = result.getLong(1); Message message = (Message) wireFormat.unmarshal(new ByteSequence(result.getBytes(2))); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/store/jdbc/LeaseDatabaseLockerTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/store/jdbc/LeaseDatabaseLockerTest.java index 814812502d..5db2c05070 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/store/jdbc/LeaseDatabaseLockerTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/store/jdbc/LeaseDatabaseLockerTest.java @@ -149,7 +149,7 @@ public class LeaseDatabaseLockerTest { lockerB.setLeaseHolderId("B"); jdbc.setLocker(lockerB); - final Set lockedSet = new HashSet(); + final Set lockedSet = new HashSet<>(); ExecutorService executor = Executors.newCachedThreadPool(); executor.execute(new Runnable() { @Override diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/store/kahadb/KahaDBFastEnqueueTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/store/kahadb/KahaDBFastEnqueueTest.java index b72fe343ba..352d2f00bb 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/store/kahadb/KahaDBFastEnqueueTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/store/kahadb/KahaDBFastEnqueueTest.java @@ -58,7 +58,7 @@ public class KahaDBFastEnqueueTest { private final String payloadString = new String(new byte[6 * 1024]); private final boolean useBytesMessage = true; private final int parallelProducer = 20; - private final Vector exceptions = new Vector(); + private final Vector exceptions = new Vector<>(); long toSend = 10000; // use with: diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/store/kahadb/KahaDBStoreRecoveryBrokerTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/store/kahadb/KahaDBStoreRecoveryBrokerTest.java index b815fe5301..2163e5cfd4 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/store/kahadb/KahaDBStoreRecoveryBrokerTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/store/kahadb/KahaDBStoreRecoveryBrokerTest.java @@ -152,7 +152,7 @@ public class KahaDBStoreRecoveryBrokerTest extends RecoveryBrokerTest { connection.send(sessionInfo); connection.send(producerInfo); - ArrayList expected = new ArrayList(); + ArrayList expected = new ArrayList<>(); int MESSAGE_COUNT = 10000; for (int i = 0; i < MESSAGE_COUNT; i++) { diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/store/kahadb/KahaDBStoreTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/store/kahadb/KahaDBStoreTest.java index 01271adeff..1b9980f9b8 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/store/kahadb/KahaDBStoreTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/store/kahadb/KahaDBStoreTest.java @@ -41,7 +41,7 @@ public class KahaDBStoreTest { ActiveMQMessage message; ProducerId producerId = new ProducerId("1.1.1"); private static final int MESSAGE_COUNT = 2000; - private Vector exceptions = new Vector(); + private Vector exceptions = new Vector<>(); @Before public void initStore() throws Exception { diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/store/kahadb/plist/PListTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/store/kahadb/plist/PListTest.java index 8d368975aa..7cff6448b8 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/store/kahadb/plist/PListTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/store/kahadb/plist/PListTest.java @@ -44,7 +44,7 @@ public class PListTest { private PListImpl plist; final ByteSequence payload = new ByteSequence(new byte[400]); final String idSeed = new String("Seed" + Arrays.toString(new byte[1024])); - final Vector exceptions = new Vector(); + final Vector exceptions = new Vector<>(); ExecutorService executor; private PListEntry getFirst(PList plist) throws IOException { @@ -65,7 +65,7 @@ public class PListTest { @Test public void testAddLast() throws Exception { final int COUNT = 1000; - Map map = new LinkedHashMap(); + Map map = new LinkedHashMap<>(); for (int i = 0; i < COUNT; i++) { String test = new String("test" + i); ByteSequence bs = new ByteSequence(test.getBytes()); @@ -86,7 +86,7 @@ public class PListTest { @Test public void testAddFirst() throws Exception { final int COUNT = 1000; - Map map = new LinkedHashMap(); + Map map = new LinkedHashMap<>(); for (int i = 0; i < COUNT; i++) { String test = new String("test" + i); ByteSequence bs = new ByteSequence(test.getBytes()); @@ -110,7 +110,7 @@ public class PListTest { } protected void doTestRemove(final int COUNT) throws IOException { - Map map = new LinkedHashMap(); + Map map = new LinkedHashMap<>(); for (int i = 0; i < COUNT; i++) { String test = new String("test" + i); ByteSequence bs = new ByteSequence(test.getBytes()); @@ -136,7 +136,7 @@ public class PListTest { @Test public void testDestroyNonEmpty() throws Exception { final int COUNT = 1000; - Map map = new LinkedHashMap(); + Map map = new LinkedHashMap<>(); for (int i = 0; i < COUNT; i++) { String test = new String("test" + i); ByteSequence bs = new ByteSequence(test.getBytes()); @@ -193,7 +193,7 @@ public class PListTest { final ByteSequence payload = new ByteSequence(new byte[1024 * 2]); - final Vector exceptions = new Vector(); + final Vector exceptions = new Vector<>(); final int iterations = 1000; final int numLists = 10; @@ -627,7 +627,7 @@ public class PListTest { } } - final Map locks = new HashMap(); + final Map locks = new HashMap<>(); private Object plistLocks(PList plist) { Object lock = null; diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/streams/JMSInputStreamTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/streams/JMSInputStreamTest.java index 6ec27c0c4b..38f0213b97 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/streams/JMSInputStreamTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/streams/JMSInputStreamTest.java @@ -121,7 +121,7 @@ public class JMSInputStreamTest extends JmsTestSupport { String name2 = "PROPERTY_2"; String value1 = "VALUE_1"; String value2 = "VALUE_2"; - Map jmsProperties = new HashMap(); + Map jmsProperties = new HashMap<>(); jmsProperties.put(name1, value1); jmsProperties.put(name2, value2); setUpConnection(jmsProperties, -1); @@ -157,7 +157,7 @@ public class JMSInputStreamTest extends JmsTestSupport { String name2 = "PROPERTY_2"; String value1 = "VALUE_1"; String value2 = "VALUE_2"; - Map jmsProperties = new HashMap(); + Map jmsProperties = new HashMap<>(); jmsProperties.put(name1, value1); jmsProperties.put(name2, value2); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/test/message/NestedMapAndListPropertyTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/test/message/NestedMapAndListPropertyTest.java index 291e4de9c7..34489ae163 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/test/message/NestedMapAndListPropertyTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/test/message/NestedMapAndListPropertyTest.java @@ -75,11 +75,11 @@ public class NestedMapAndListPropertyTest extends JmsTopicSendReceiveWithTwoConn answer.setStringProperty("textField", data[index]); - Map grandChildMap = new HashMap(); + Map grandChildMap = new HashMap<>(); grandChildMap.put("x", "abc"); grandChildMap.put("y", Arrays.asList(new Object[]{"a", "b", "c"})); - Map nestedMap = new HashMap(); + Map nestedMap = new HashMap<>(); nestedMap.put("a", "foo"); nestedMap.put("b", new Integer(23)); nestedMap.put("c", new Long(45)); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/test/message/NestedMapMessageTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/test/message/NestedMapMessageTest.java index 062cbab9f4..1bf7319dae 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/test/message/NestedMapMessageTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/test/message/NestedMapMessageTest.java @@ -79,11 +79,11 @@ public class NestedMapMessageTest extends JmsTopicSendReceiveWithTwoConnectionsA answer.setString("textField", data[index]); - Map grandChildMap = new HashMap(); + Map grandChildMap = new HashMap<>(); grandChildMap.put("x", "abc"); grandChildMap.put("y", Arrays.asList(new Object[]{"a", "b", "c"})); - Map nestedMap = new HashMap(); + Map nestedMap = new HashMap<>(); nestedMap.put("a", "foo"); nestedMap.put("b", Integer.valueOf(23)); nestedMap.put("c", Long.valueOf(45)); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/StubCompositeTransport.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/StubCompositeTransport.java index 57b7062154..108249a4f0 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/StubCompositeTransport.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/StubCompositeTransport.java @@ -26,7 +26,7 @@ import java.util.List; */ public class StubCompositeTransport extends StubTransport implements CompositeTransport { - private List transportURIs = new ArrayList(); + private List transportURIs = new ArrayList<>(); /** * @see org.apache.activemq.transport.CompositeTransport#add(java.net.URI[]) diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/StubTransport.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/StubTransport.java index 9375b6d483..1175e77ad9 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/StubTransport.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/StubTransport.java @@ -29,7 +29,7 @@ import org.apache.activemq.util.ServiceStopper; */ public class StubTransport extends TransportSupport { - private Queue queue = new ConcurrentLinkedQueue(); + private Queue queue = new ConcurrentLinkedQueue<>(); private AtomicInteger receiveCounter; @Override diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/StubTransportListener.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/StubTransportListener.java index 6c67e3cb07..a35003dc72 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/StubTransportListener.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/StubTransportListener.java @@ -26,8 +26,8 @@ import java.util.concurrent.ConcurrentLinkedQueue; */ public class StubTransportListener implements TransportListener { - private final Queue commands = new ConcurrentLinkedQueue(); - private final Queue exceptions = new ConcurrentLinkedQueue(); + private final Queue commands = new ConcurrentLinkedQueue<>(); + private final Queue exceptions = new ConcurrentLinkedQueue<>(); public Queue getCommands() { return commands; diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/TopicClusterTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/TopicClusterTest.java index c8aadbcf50..5157c33145 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/TopicClusterTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/TopicClusterTest.java @@ -60,7 +60,7 @@ public class TopicClusterTest extends TestCase implements MessageListener { protected int deliveryMode = DeliveryMode.NON_PERSISTENT; protected MessageProducer[] producers; protected Connection[] connections; - protected List services = new ArrayList(); + protected List services = new ArrayList<>(); protected String groupId; @Override diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/TransportBrokerTestSupport.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/TransportBrokerTestSupport.java index 18e4cdce69..1c39972243 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/TransportBrokerTestSupport.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/TransportBrokerTestSupport.java @@ -30,7 +30,7 @@ import org.apache.activemq.broker.artemiswrapper.ArtemisBrokerWrapper; public abstract class TransportBrokerTestSupport extends BrokerTest { protected TransportConnector connector; - private ArrayList connections = new ArrayList(); + private ArrayList connections = new ArrayList<>(); @Override protected void setUp() throws Exception { diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/discovery/DiscoveryNetworkReconnectTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/discovery/DiscoveryNetworkReconnectTest.java index 8ee3adc7b8..c63177bf15 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/discovery/DiscoveryNetworkReconnectTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/discovery/DiscoveryNetworkReconnectTest.java @@ -123,7 +123,7 @@ public class DiscoveryNetworkReconnectTest { allowing(managementContext).registerMBean(with(any(Object.class)), with(equal(new ObjectName("Test:type=Broker,brokerName=BrokerNC,destinationType=Topic,destinationName=ActiveMQ.Advisory.MasterBroker")))); allowing(managementContext).registerMBean(with(any(Object.class)), with(equal(new ObjectName("Test:type=Broker,brokerName=BrokerNC,service=jobScheduler,jobSchedulerName=JMS")))); - atLeast(maxReconnects - 1).of(managementContext).registerMBean(with(any(Object.class)), with(new NetworkBridgeObjectNameMatcher(new ObjectName("Test:type=Broker,brokerName=BrokerNC,connector=networkConnectors,networkConnectorName=NC,networkBridge=localhost/127.0.0.1_" + proxy.getUrl().getPort())))); + atLeast(maxReconnects - 1).of(managementContext).registerMBean(with(any(Object.class)), with(new NetworkBridgeObjectNameMatcher<>(new ObjectName("Test:type=Broker,brokerName=BrokerNC,connector=networkConnectors,networkConnectorName=NC,networkBridge=localhost/127.0.0.1_" + proxy.getUrl().getPort())))); will(new CustomAction("signal register network mbean") { @Override public Object invoke(Invocation invocation) throws Throwable { @@ -132,7 +132,7 @@ public class DiscoveryNetworkReconnectTest { return new ObjectInstance((ObjectName) invocation.getParameter(1), "discription"); } }); - atLeast(maxReconnects - 1).of(managementContext).unregisterMBean(with(new NetworkBridgeObjectNameMatcher(new ObjectName("Test:type=Broker,brokerName=BrokerNC,connector=networkConnectors,networkConnectorName=NC,networkBridge=localhost/127.0.0.1_" + proxy.getUrl().getPort())))); + atLeast(maxReconnects - 1).of(managementContext).unregisterMBean(with(new NetworkBridgeObjectNameMatcher<>(new ObjectName("Test:type=Broker,brokerName=BrokerNC,connector=networkConnectors,networkConnectorName=NC,networkBridge=localhost/127.0.0.1_" + proxy.getUrl().getPort())))); will(new CustomAction("signal unregister network mbean") { @Override public Object invoke(Invocation invocation) throws Throwable { diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/discovery/DiscoveryTransportNoBrokerTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/discovery/DiscoveryTransportNoBrokerTest.java index bf022f0eb1..d244dab768 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/discovery/DiscoveryTransportNoBrokerTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/discovery/DiscoveryTransportNoBrokerTest.java @@ -53,7 +53,7 @@ public class DiscoveryTransportNoBrokerTest extends CombinationTestSupport { broker.start(); broker.waitUntilStarted(); - Vector existingNames = new Vector(); + Vector existingNames = new Vector<>(); Thread[] threads = getThreads(); for (Thread t : threads) { existingNames.add(t.getName()); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/AMQ1925Test.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/AMQ1925Test.java index 4554a0ba98..f80b09a9c7 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/AMQ1925Test.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/AMQ1925Test.java @@ -154,7 +154,7 @@ public class AMQ1925Test extends TestCase implements ExceptionListener { } }).start(); - Collection results = new ArrayList(MESSAGE_COUNT); + Collection results = new ArrayList<>(MESSAGE_COUNT); for (int i = 0; i < MESSAGE_COUNT; i++) { Message message1 = consumer1.receive(20); Message message2 = consumer2.receive(20); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/ConnectionHangOnStartupTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/ConnectionHangOnStartupTest.java index 6f38203b7a..110e2fc5c1 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/ConnectionHangOnStartupTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/ConnectionHangOnStartupTest.java @@ -42,7 +42,7 @@ public class ConnectionHangOnStartupTest { // connection sooner) protected String uriString = "failover://(tcp://localhost:62001?wireFormat.maxInactivityDurationInitalDelay=1,tcp://localhost:62002?wireFormat.maxInactivityDurationInitalDelay=1)?randomize=false&maxReconnectDelay=200"; protected BrokerService master = null; - protected AtomicReference slave = new AtomicReference(); + protected AtomicReference slave = new AtomicReference<>(); @After public void tearDown() throws Exception { @@ -84,7 +84,7 @@ public class ConnectionHangOnStartupTest { @Test(timeout = 60000) public void testInitialWireFormatNegotiationTimeout() throws Exception { - final AtomicReference conn = new AtomicReference(); + final AtomicReference conn = new AtomicReference<>(); final CountDownLatch connStarted = new CountDownLatch(1); Thread t = new Thread() { diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverClusterTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverClusterTest.java index 113db64d00..c0c529d825 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverClusterTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverClusterTest.java @@ -44,7 +44,7 @@ public class FailoverClusterTest extends TestCase { private BrokerService brokerB; private String clientUrl; - private final List connections = new ArrayList(); + private final List connections = new ArrayList<>(); public void testClusterConnectedAfterClients() throws Exception { createClients(); @@ -52,7 +52,7 @@ public class FailoverClusterTest extends TestCase { brokerB = createBrokerB(BROKER_BIND_ADDRESS); } Thread.sleep(3000); - Set set = new HashSet(); + Set set = new HashSet<>(); for (ActiveMQConnection c : connections) { set.add(c.getTransportChannel().getRemoteAddress()); } @@ -66,7 +66,7 @@ public class FailoverClusterTest extends TestCase { brokerB = createBrokerB(BROKER_BIND_ADDRESS + "?transport.closeAsync=false"); } Thread.sleep(3000); - Set set = new HashSet(); + Set set = new HashSet<>(); for (ActiveMQConnection c : connections) { set.add(c.getTransportChannel().getRemoteAddress()); } diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverClusterTestSupport.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverClusterTestSupport.java index 2a125e106f..b518ad5dab 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverClusterTestSupport.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverClusterTestSupport.java @@ -47,11 +47,11 @@ public class FailoverClusterTestSupport extends TestCase { private String clientUrl; - private final Map brokers = new HashMap(); - private final List connections = new ArrayList(); + private final Map brokers = new HashMap<>(); + private final List connections = new ArrayList<>(); protected void assertClientsConnectedToTwoBrokers() { - Set set = new HashSet(); + Set set = new HashSet<>(); for (ActiveMQConnection c : connections) { if (c.getTransportChannel().getRemoteAddress() != null) { set.add(c.getTransportChannel().getRemoteAddress()); @@ -61,7 +61,7 @@ public class FailoverClusterTestSupport extends TestCase { } protected void assertClientsConnectedToThreeBrokers() { - Set set = new HashSet(); + Set set = new HashSet<>(); for (ActiveMQConnection c : connections) { if (c.getTransportChannel().getRemoteAddress() != null) { set.add(c.getTransportChannel().getRemoteAddress()); @@ -71,7 +71,7 @@ public class FailoverClusterTestSupport extends TestCase { } protected void assertClientsConnectionsEvenlyDistributed(double minimumPercentage) { - Map clientConnectionCounts = new HashMap(); + Map clientConnectionCounts = new HashMap<>(); int total = 0; for (ActiveMQConnection c : connections) { String key = c.getTransportChannel().getRemoteAddress(); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverConsumerOutstandingCommitTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverConsumerOutstandingCommitTest.java index ea0983293c..e33e7eaa44 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverConsumerOutstandingCommitTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverConsumerOutstandingCommitTest.java @@ -254,7 +254,7 @@ public class FailoverConsumerOutstandingCommitTest { final CountDownLatch commitDoneLatch = new CountDownLatch(1); final CountDownLatch messagesReceived = new CountDownLatch(3); final AtomicBoolean gotCommitException = new AtomicBoolean(false); - final ArrayList receivedMessages = new ArrayList(); + final ArrayList receivedMessages = new ArrayList<>(); final MessageConsumer testConsumer = consumerSession.createConsumer(destination); testConsumer.setMessageListener(new MessageListener() { diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverConsumerUnconsumedTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverConsumerUnconsumedTest.java index 310e239a87..2779f52da2 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverConsumerUnconsumedTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverConsumerUnconsumedTest.java @@ -139,7 +139,7 @@ public class FailoverConsumerUnconsumedTest { final Session consumerSession = connection.createSession(false, Session.CLIENT_ACKNOWLEDGE); final Queue destination = consumerSession.createQueue(QUEUE_NAME + "?jms.consumer.prefetch=" + prefetch); - final Vector testConsumers = new Vector(); + final Vector testConsumers = new Vector<>(); TestConsumer testConsumer = new TestConsumer(consumerSession, destination, connection); testConsumer.setMessageListener(new MessageListener() { @Override @@ -278,7 +278,7 @@ public class FailoverConsumerUnconsumedTest { final Session consumerSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); final Queue destination = consumerSession.createQueue(QUEUE_NAME + "?jms.consumer.prefetch=" + prefetch); - final Vector testConsumers = new Vector(); + final Vector testConsumers = new Vector<>(); for (int i = 0; i < maxConsumers - 1; i++) { testConsumers.add(new TestConsumer(consumerSession, destination, connection)); } diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverPrefetchZeroTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverPrefetchZeroTest.java index e48a699ce7..57899ba1be 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverPrefetchZeroTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverPrefetchZeroTest.java @@ -120,7 +120,7 @@ public class FailoverPrefetchZeroTest { produceMessage(consumerSession, destination, 1); final CountDownLatch receiveDone = new CountDownLatch(1); - final Vector received = new Vector(); + final Vector received = new Vector<>(); Executors.newSingleThreadExecutor().execute(new Runnable() { @Override public void run() { diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverPriorityTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverPriorityTest.java index fb4f969f26..b8860a79a5 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverPriorityTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverPriorityTest.java @@ -28,7 +28,7 @@ public class FailoverPriorityTest extends FailoverClusterTestSupport { private static final String BROKER_A_CLIENT_TC_ADDRESS = "tcp://127.0.0.1:61616"; private static final String BROKER_B_CLIENT_TC_ADDRESS = "tcp://127.0.0.1:61617"; private static final String BROKER_C_CLIENT_TC_ADDRESS = "tcp://127.0.0.1:61618"; - private final HashMap urls = new HashMap(); + private final HashMap urls = new HashMap<>(); @Override public void setUp() throws Exception { diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverTransactionTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverTransactionTest.java index 4ee219e3b1..eb5bc61bb8 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverTransactionTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/FailoverTransactionTest.java @@ -760,7 +760,7 @@ public class FailoverTransactionTest extends TestSupport { }}); broker.start(); - Vector connections = new Vector(); + Vector connections = new Vector<>(); ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("failover:(" + url + ")"); configureConnectionFactory(cf); Connection connection = cf.createConnection(); @@ -785,7 +785,7 @@ public class FailoverTransactionTest extends TestSupport { produceMessage(producerSession, destination); produceMessage(producerSession, destination); - final Vector receivedMessages = new Vector(); + final Vector receivedMessages = new Vector<>(); final CountDownLatch commitDoneLatch = new CountDownLatch(1); final AtomicBoolean gotTransactionRolledBackException = new AtomicBoolean(false); Executors.newSingleThreadExecutor().execute(new Runnable() { @@ -924,7 +924,7 @@ public class FailoverTransactionTest extends TestSupport { }}); broker.start(); - Vector connections = new Vector(); + Vector connections = new Vector<>(); ActiveMQConnectionFactory cf = new ActiveMQConnectionFactory("failover:(" + url + ")"); configureConnectionFactory(cf); Connection connection = cf.createConnection(); @@ -941,13 +941,13 @@ public class FailoverTransactionTest extends TestSupport { final Session consumerSession = connection.createSession(false, Session.CLIENT_ACKNOWLEDGE); final int sessionCount = 10; - final Stack sessions = new Stack(); + final Stack sessions = new Stack<>(); for (int i = 0; i < sessionCount; i++) { sessions.push(connection.createSession(false, Session.AUTO_ACKNOWLEDGE)); } final int consumerCount = 1000; - final Deque consumers = new ArrayDeque(); + final Deque consumers = new ArrayDeque<>(); for (int i = 0; i < consumerCount; i++) { consumers.push(consumerSession.createConsumer(destination)); } @@ -1150,7 +1150,7 @@ public class FailoverTransactionTest extends TestSupport { final CountDownLatch commitDone = new CountDownLatch(1); - final Vector exceptions = new Vector(); + final Vector exceptions = new Vector<>(); // commit may fail if other consumer gets the message on restart Executors.newSingleThreadExecutor().execute(new Runnable() { diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/SlowConnectionTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/SlowConnectionTest.java index 2826595ead..3a55473e89 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/SlowConnectionTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/failover/SlowConnectionTest.java @@ -85,7 +85,7 @@ public class SlowConnectionTest extends TestCase { @Override public void run() { - List inProgress = new ArrayList(); + List inProgress = new ArrayList<>(); ServerSocketFactory factory = ServerSocketFactory.getDefault(); try { diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/tcp/QualityOfServiceUtilsTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/tcp/QualityOfServiceUtilsTest.java index e45bf64cbc..84e8133c94 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/tcp/QualityOfServiceUtilsTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/tcp/QualityOfServiceUtilsTest.java @@ -58,7 +58,7 @@ public class QualityOfServiceUtilsTest extends TestCase { } public void testValidDiffServNames() { - Map namesToExpected = new HashMap(); + Map namesToExpected = new HashMap<>(); namesToExpected.put("CS0", Integer.valueOf("000000", 2)); namesToExpected.put("CS1", Integer.valueOf("001000", 2)); namesToExpected.put("CS2", Integer.valueOf("010000", 2)); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/tcp/SocketTstFactory.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/tcp/SocketTstFactory.java index b4de0cedc2..34158cb101 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/tcp/SocketTstFactory.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/tcp/SocketTstFactory.java @@ -36,7 +36,7 @@ public class SocketTstFactory extends SocketFactory { private static final Logger LOG = LoggerFactory.getLogger(SocketTstFactory.class); - private static final ConcurrentMap closeIter = new ConcurrentHashMap(); + private static final ConcurrentMap closeIter = new ConcurrentHashMap<>(); private class SocketTst { diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/tcp/SslTransportFactoryTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/tcp/SslTransportFactoryTest.java index 32e26a3174..8d3ff309d0 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/tcp/SslTransportFactoryTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/tcp/SslTransportFactoryTest.java @@ -90,7 +90,7 @@ public class SslTransportFactoryTest extends TestCase { // 2 transport options, 3 socket options, 3 settings for each option => // 3^5 = 243 combos. for (int i = 0; i < 243; ++i) { - Map options = new HashMap(); + Map options = new HashMap<>(); for (int j = 0; j < 5; ++j) { // -1 since the option range is [-1,1], not [0,2]. diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/tcp/TcpFaultyTransportFactory.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/tcp/TcpFaultyTransportFactory.java index 9640169f48..5bc9e2f361 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/tcp/TcpFaultyTransportFactory.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/tcp/TcpFaultyTransportFactory.java @@ -77,7 +77,7 @@ public class TcpFaultyTransportFactory extends TcpTransportFactory { @Override public TransportServer doBind(final URI location) throws IOException { try { - Map options = new HashMap(URISupport.parseParameters(location)); + Map options = new HashMap<>(URISupport.parseParameters(location)); ServerSocketFactory serverSocketFactory = createServerSocketFactory(); TcpFaultyTransportServer server = createTcpFaultyTransportServer(location, serverSocketFactory); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/tcp/WireformatNegociationTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/tcp/WireformatNegociationTest.java index fb9c7ba1b5..27a378d055 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/tcp/WireformatNegociationTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/tcp/WireformatNegociationTest.java @@ -43,9 +43,9 @@ public class WireformatNegociationTest extends CombinationTestSupport { private Transport clientTransport; private Transport serverTransport; - private final AtomicReference clientWF = new AtomicReference(); - private final AtomicReference serverWF = new AtomicReference(); - private final AtomicReference asyncError = new AtomicReference(); + private final AtomicReference clientWF = new AtomicReference<>(); + private final AtomicReference serverWF = new AtomicReference<>(); + private final AtomicReference asyncError = new AtomicReference<>(); private final AtomicBoolean ignoreAsycError = new AtomicBoolean(); private final CountDownLatch negotiationCounter = new CountDownLatch(2); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/vm/VMTransportThreadSafeTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/vm/VMTransportThreadSafeTest.java index 1f8ad67831..2268048f87 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/vm/VMTransportThreadSafeTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/vm/VMTransportThreadSafeTest.java @@ -54,8 +54,8 @@ public class VMTransportThreadSafeTest { private final static String location1 = "vm://transport1"; private final static String location2 = "vm://transport2"; - private final ConcurrentLinkedQueue localReceived = new ConcurrentLinkedQueue(); - private final ConcurrentLinkedQueue remoteReceived = new ConcurrentLinkedQueue(); + private final ConcurrentLinkedQueue localReceived = new ConcurrentLinkedQueue<>(); + private final ConcurrentLinkedQueue remoteReceived = new ConcurrentLinkedQueue<>(); private class DummyCommand extends BaseCommand { diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/vm/VmTransportNetworkBrokerTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/vm/VmTransportNetworkBrokerTest.java index 3453a2e6df..2b97cff214 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/vm/VmTransportNetworkBrokerTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/transport/vm/VmTransportNetworkBrokerTest.java @@ -129,7 +129,7 @@ public class VmTransportNetworkBrokerTest extends TestCase { */ public Thread[] filterDaemonThreads(Thread[] threads) throws Exception { - List threadList = new ArrayList(Arrays.asList(threads)); + List threadList = new ArrayList<>(Arrays.asList(threads)); // Can't use an Iterator as it would raise a // ConcurrentModificationException when trying to remove an element diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/AMQStackOverFlowTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/AMQStackOverFlowTest.java index 4e0acbaeb7..1154510c8a 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/AMQStackOverFlowTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/AMQStackOverFlowTest.java @@ -121,7 +121,7 @@ public class AMQStackOverFlowTest extends TestCase { //memoryManager.getMemoryUsage().setLimit(10); brokerService.setSystemUsage(memoryManager); - final List policyEntries = new ArrayList(); + final List policyEntries = new ArrayList<>(); final PolicyEntry entry = new PolicyEntry(); entry.setQueue(">"); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/ChangeSentMessageTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/ChangeSentMessageTest.java index 347548ce8c..dd7527d857 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/ChangeSentMessageTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/ChangeSentMessageTest.java @@ -50,7 +50,7 @@ public class ChangeSentMessageTest extends TestSupport { MessageConsumer consumer = consumerSession.createConsumer(destination); Session publisherSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); MessageProducer producer = publisherSession.createProducer(destination); - HashMap map = new HashMap(); + HashMap map = new HashMap<>(); ObjectMessage message = publisherSession.createObjectMessage(); for (int i = 0; i < COUNT; i++) { map.put(VALUE_NAME, Integer.valueOf(i)); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/ConcurrentDestinationCreationTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/ConcurrentDestinationCreationTest.java index d1e8a4228a..c577c86571 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/ConcurrentDestinationCreationTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/ConcurrentDestinationCreationTest.java @@ -70,7 +70,7 @@ public class ConcurrentDestinationCreationTest extends org.apache.activemq.TestS public void testSendRateWithActivatingConsumers() throws Exception { - final Vector exceptions = new Vector(); + final Vector exceptions = new Vector<>(); final int jobs = 50; final int destinationCount = 10; final CountDownLatch allDone = new CountDownLatch(jobs); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/ConcurrentProducerDurableConsumerTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/ConcurrentProducerDurableConsumerTest.java index a65d217272..e470949530 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/ConcurrentProducerDurableConsumerTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/ConcurrentProducerDurableConsumerTest.java @@ -69,7 +69,7 @@ public class ConcurrentProducerDurableConsumerTest extends TestSupport { private final int consumerCount = 5; BrokerService broker; protected List connections = Collections.synchronizedList(new ArrayList()); - protected Map consumers = new HashMap(); + protected Map consumers = new HashMap<>(); protected MessageIdList allMessagesList = new MessageIdList(); private final int messageSize = 1024; @@ -80,7 +80,7 @@ public class ConcurrentProducerDurableConsumerTest extends TestSupport { TestSupport.PersistenceAdapterChoice[] kahaDb = {TestSupport.PersistenceAdapterChoice.KahaDB}; TestSupport.PersistenceAdapterChoice[] levelDb = {TestSupport.PersistenceAdapterChoice.LevelDB}; TestSupport.PersistenceAdapterChoice[] mem = {TestSupport.PersistenceAdapterChoice.MEM}; - List choices = new ArrayList(); + List choices = new ArrayList<>(); choices.add(kahaDb); choices.add(levelDb); choices.add(mem); @@ -400,7 +400,7 @@ public class ConcurrentProducerDurableConsumerTest extends TestSupport { long batchReceiptAccumulator = 0; long maxReceiptTime = 0; AtomicLong count = new AtomicLong(0); - Map messageLists = new ConcurrentHashMap(new HashMap()); + Map messageLists = new ConcurrentHashMap<>(new HashMap()); @Override public void onMessage(Message message) { diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/ConcurrentProducerQueueConsumerTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/ConcurrentProducerQueueConsumerTest.java index bbd8e5d5d2..14ac31f49c 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/ConcurrentProducerQueueConsumerTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/ConcurrentProducerQueueConsumerTest.java @@ -60,7 +60,7 @@ public class ConcurrentProducerQueueConsumerTest extends TestSupport { private static final Logger LOG = LoggerFactory.getLogger(ConcurrentProducerQueueConsumerTest.class); protected List connections = Collections.synchronizedList(new ArrayList()); - protected Map consumers = new HashMap(); + protected Map consumers = new HashMap<>(); protected MessageIdList allMessagesList = new MessageIdList(); private BrokerService broker; @@ -354,7 +354,7 @@ public class ConcurrentProducerQueueConsumerTest extends TestSupport { long batchReceiptAccumulator = 0; long maxReceiptTime = 0; - final Map messageLists = new ConcurrentHashMap(new HashMap()); + final Map messageLists = new ConcurrentHashMap<>(new HashMap()); @Override public void onMessage(Message message) { diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/ConsumeTopicPrefetchTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/ConsumeTopicPrefetchTest.java index 91103cd547..5c2c29e371 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/ConsumeTopicPrefetchTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/ConsumeTopicPrefetchTest.java @@ -66,7 +66,7 @@ public class ConsumeTopicPrefetchTest extends ProducerConsumerTestSupport { validateConsumerPrefetch(this.getSubject(), prefetchSize); - LinkedList consumed = new LinkedList(); + LinkedList consumed = new LinkedList<>(); // lets consume them in two fetch batches int batchSize = messageCount / 2; for (int i = 0; i < batchSize; i++) { diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubDelayedUnsubscribeTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubDelayedUnsubscribeTest.java index a8f85f31ad..25330980e0 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubDelayedUnsubscribeTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubDelayedUnsubscribeTest.java @@ -61,7 +61,7 @@ public class DurableSubDelayedUnsubscribeTest { private static final int CARGO_SIZE = 400; // max private static final int MAX_CLIENTS = 15; private static boolean ALLOW_SUBSCRIPTION_ABANDONMENT = true; - private static final Vector exceptions = new Vector(); + private static final Vector exceptions = new Vector<>(); private BrokerService broker; private ActiveMQTopic topic; @@ -357,7 +357,7 @@ public class DurableSubDelayedUnsubscribeTest { private int clientRover = 0; - private final CopyOnWriteArrayList clients = new CopyOnWriteArrayList(); + private final CopyOnWriteArrayList clients = new CopyOnWriteArrayList<>(); private boolean stopped; @@ -605,7 +605,7 @@ public class DurableSubDelayedUnsubscribeTest { setDaemon(true); } - public final CopyOnWriteArrayList abandonedSubscriptions = new CopyOnWriteArrayList(); + public final CopyOnWriteArrayList abandonedSubscriptions = new CopyOnWriteArrayList<>(); public void shutdown() throws Exception { done.set(true); @@ -650,7 +650,7 @@ public class DurableSubDelayedUnsubscribeTest { LOG.info("Housekeeper sweeping."); int closed = 0; - ArrayList sweeped = new ArrayList(); + ArrayList sweeped = new ArrayList<>(); try { for (String clientId : abandonedSubscriptions) { LOG.info("Sweeping out subscription of " + clientId + "."); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubProcessConcurrentCommitActivateNoDuplicateTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubProcessConcurrentCommitActivateNoDuplicateTest.java index e03ecf3edf..e04ca9c8cc 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubProcessConcurrentCommitActivateNoDuplicateTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubProcessConcurrentCommitActivateNoDuplicateTest.java @@ -87,7 +87,7 @@ public class DurableSubProcessConcurrentCommitActivateNoDuplicateTest { private final ReentrantReadWriteLock processLock = new ReentrantReadWriteLock(true); private int restartCount = 0; private final AtomicInteger onlineCount = new AtomicInteger(0); - static final Vector exceptions = new Vector(); + static final Vector exceptions = new Vector<>(); // long form of test that found https://issues.apache.org/jira/browse/AMQ-3805 @Ignore("short version in org.apache.activemq.usecases.DurableSubscriptionOfflineTest.testNoDuplicateOnConcurrentSendTranCommitAndActivate" + " and org.apache.activemq.usecases.DurableSubscriptionOfflineTest.testOrderOnActivateDeactivate") @@ -292,7 +292,7 @@ public class DurableSubProcessConcurrentCommitActivateNoDuplicateTest { ClientType(String... messageTypes) { this.messageTypes = messageTypes; - messageTypeSet = new HashSet(Arrays.asList(messageTypes)); + messageTypeSet = new HashSet<>(Arrays.asList(messageTypes)); StringBuilder sb = new StringBuilder("TYPE in ("); for (int i = 0; i < messageTypes.length; i++) { @@ -333,7 +333,7 @@ public class DurableSubProcessConcurrentCommitActivateNoDuplicateTest { private int clientRover = 0; - private final CopyOnWriteArrayList clients = new CopyOnWriteArrayList(); + private final CopyOnWriteArrayList clients = new CopyOnWriteArrayList<>(); private boolean end; @@ -434,7 +434,7 @@ public class DurableSubProcessConcurrentCommitActivateNoDuplicateTest { private final ClientType clientType; private final String selector; - private final ConcurrentLinkedQueue waitingList = new ConcurrentLinkedQueue(); + private final ConcurrentLinkedQueue waitingList = new ConcurrentLinkedQueue<>(); private final HashSet processed = CHECK_REDELIVERY ? new HashSet(10000) : null; private ActiveMQMessageConsumer consumer = null; @@ -702,7 +702,7 @@ public class DurableSubProcessConcurrentCommitActivateNoDuplicateTest { setDaemon(true); } - public final CopyOnWriteArrayList abandonedSubscriptions = new CopyOnWriteArrayList(); + public final CopyOnWriteArrayList abandonedSubscriptions = new CopyOnWriteArrayList<>(); @Override public void run() { @@ -732,7 +732,7 @@ public class DurableSubProcessConcurrentCommitActivateNoDuplicateTest { LOG.info("Housekeeper sweeping."); int closed = 0; - ArrayList sweeped = new ArrayList(); + ArrayList sweeped = new ArrayList<>(); try { for (String clientId : abandonedSubscriptions) { LOG.info("Sweeping out subscription of " + clientId + "."); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubProcessMultiRestartTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubProcessMultiRestartTest.java index 90a02c9919..79d3eb0e4a 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubProcessMultiRestartTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubProcessMultiRestartTest.java @@ -61,7 +61,7 @@ public class DurableSubProcessMultiRestartTest { private int restartCount = 0; private final int SUBSCRIPTION_ID = 1; - static final Vector exceptions = new Vector(); + static final Vector exceptions = new Vector<>(); /** * The test creates a durable subscriber and producer with a broker that is diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubProcessTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubProcessTest.java index cadd730020..8a572e93e5 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubProcessTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubProcessTest.java @@ -61,7 +61,7 @@ public class DurableSubProcessTest extends org.apache.activemq.TestSupport { private Server server; private HouseKeeper houseKeeper; - static final Vector exceptions = new Vector(); + static final Vector exceptions = new Vector<>(); @Test public void testProcess() { @@ -205,7 +205,7 @@ public class DurableSubProcessTest extends org.apache.activemq.TestSupport { ClientType(String... messageTypes) { this.messageTypes = messageTypes; - messageTypeSet = new HashSet(Arrays.asList(messageTypes)); + messageTypeSet = new HashSet<>(Arrays.asList(messageTypes)); StringBuilder sb = new StringBuilder("TYPE in ("); for (int i = 0; i < messageTypes.length; i++) { @@ -246,7 +246,7 @@ public class DurableSubProcessTest extends org.apache.activemq.TestSupport { private int clientRover = 0; - private final CopyOnWriteArrayList clients = new CopyOnWriteArrayList(); + private final CopyOnWriteArrayList clients = new CopyOnWriteArrayList<>(); public ClientManager() { super("ClientManager"); @@ -338,7 +338,7 @@ public class DurableSubProcessTest extends org.apache.activemq.TestSupport { private final ClientType clientType; private final String selector; - private final ConcurrentLinkedQueue waitingList = new ConcurrentLinkedQueue(); + private final ConcurrentLinkedQueue waitingList = new ConcurrentLinkedQueue<>(); public Client(int id, ClientType clientType, Random lifetime, Random online, Random offline) throws JMSException { super("Client" + id); @@ -538,7 +538,7 @@ public class DurableSubProcessTest extends org.apache.activemq.TestSupport { setDaemon(true); } - public final CopyOnWriteArrayList abandonedSubscriptions = new CopyOnWriteArrayList(); + public final CopyOnWriteArrayList abandonedSubscriptions = new CopyOnWriteArrayList<>(); @Override public void run() { @@ -561,7 +561,7 @@ public class DurableSubProcessTest extends org.apache.activemq.TestSupport { LOG.info("Housekeeper sweeping."); int closed = 0; - ArrayList sweeped = new ArrayList(); + ArrayList sweeped = new ArrayList<>(); try { for (String clientId : abandonedSubscriptions) { sweeped.add(clientId); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubProcessWithRestartTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubProcessWithRestartTest.java index e4118ec56e..5c778de2c5 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubProcessWithRestartTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubProcessWithRestartTest.java @@ -79,7 +79,7 @@ public class DurableSubProcessWithRestartTest { private final ReentrantReadWriteLock processLock = new ReentrantReadWriteLock(true); private int restartCount = 0; - static final Vector exceptions = new Vector(); + static final Vector exceptions = new Vector<>(); // this is a nice test but it takes 5mins, may be handy in the future // resulting bug https://issues.apache.org/jira/browse/AMQ-3190 @@ -257,7 +257,7 @@ public class DurableSubProcessWithRestartTest { ClientType(String... messageTypes) { this.messageTypes = messageTypes; - messageTypeSet = new HashSet(Arrays.asList(messageTypes)); + messageTypeSet = new HashSet<>(Arrays.asList(messageTypes)); StringBuilder sb = new StringBuilder("TYPE in ("); for (int i = 0; i < messageTypes.length; i++) { @@ -298,7 +298,7 @@ public class DurableSubProcessWithRestartTest { private int clientRover = 0; - private final CopyOnWriteArrayList clients = new CopyOnWriteArrayList(); + private final CopyOnWriteArrayList clients = new CopyOnWriteArrayList<>(); public ClientManager() { super("ClientManager"); @@ -391,7 +391,7 @@ public class DurableSubProcessWithRestartTest { private final ClientType clientType; private final String selector; - private final ConcurrentLinkedQueue waitingList = new ConcurrentLinkedQueue(); + private final ConcurrentLinkedQueue waitingList = new ConcurrentLinkedQueue<>(); private final HashSet processed = CHECK_REDELIVERY ? new HashSet(10000) : null; public Client(int id, ClientType clientType, Random lifetime, Random online, Random offline) throws JMSException { @@ -601,7 +601,7 @@ public class DurableSubProcessWithRestartTest { setDaemon(true); } - public final CopyOnWriteArrayList abandonedSubscriptions = new CopyOnWriteArrayList(); + public final CopyOnWriteArrayList abandonedSubscriptions = new CopyOnWriteArrayList<>(); @Override public void run() { @@ -631,7 +631,7 @@ public class DurableSubProcessWithRestartTest { LOG.info("Housekeeper sweeping."); int closed = 0; - ArrayList sweeped = new ArrayList(); + ArrayList sweeped = new ArrayList<>(); try { for (String clientId : abandonedSubscriptions) { LOG.info("Sweeping out subscription of " + clientId + "."); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubsOfflineSelectorConcurrentConsumeIndexUseTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubsOfflineSelectorConcurrentConsumeIndexUseTest.java index 48ba447b0d..4ccd3488f4 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubsOfflineSelectorConcurrentConsumeIndexUseTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubsOfflineSelectorConcurrentConsumeIndexUseTest.java @@ -47,7 +47,7 @@ public class DurableSubsOfflineSelectorConcurrentConsumeIndexUseTest extends org public int messageCount = 10000; private BrokerService broker; private ActiveMQTopic topic; - private final List exceptions = new ArrayList(); + private final List exceptions = new ArrayList<>(); @Override protected ActiveMQConnectionFactory createConnectionFactory() throws Exception { diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubsOfflineSelectorIndexUseTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubsOfflineSelectorIndexUseTest.java index bc291bca4f..540cdde094 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubsOfflineSelectorIndexUseTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubsOfflineSelectorIndexUseTest.java @@ -45,7 +45,7 @@ public class DurableSubsOfflineSelectorIndexUseTest extends org.apache.activemq. public int messageCount = 400; private BrokerService broker; private ActiveMQTopic topic; - private List exceptions = new ArrayList(); + private List exceptions = new ArrayList<>(); @Override protected ActiveMQConnectionFactory createConnectionFactory() throws Exception { diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubscriptionOffline1Test.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubscriptionOffline1Test.java index 2f69b4d103..f6cda17bac 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubscriptionOffline1Test.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubscriptionOffline1Test.java @@ -44,7 +44,7 @@ public class DurableSubscriptionOffline1Test extends DurableSubscriptionOfflineT String osName = System.getProperty("os.name"); LOG.debug("Running on [" + osName + "]"); - List persistenceAdapterChoices = new ArrayList(); + List persistenceAdapterChoices = new ArrayList<>(); persistenceAdapterChoices.add(PersistenceAdapterChoice.KahaDB); persistenceAdapterChoices.add(PersistenceAdapterChoice.JDBC); @@ -53,7 +53,7 @@ public class DurableSubscriptionOffline1Test extends DurableSubscriptionOfflineT persistenceAdapterChoices.add(PersistenceAdapterChoice.LevelDB); } - List testParameters = new ArrayList(); + List testParameters = new ArrayList<>(); Boolean[] booleanValues = {Boolean.FALSE, Boolean.TRUE}; List booleans = java.util.Arrays.asList(booleanValues); for (Boolean booleanValue : booleans) { diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubscriptionOffline2Test.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubscriptionOffline2Test.java index a0a4bcd614..d15162f22e 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubscriptionOffline2Test.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubscriptionOffline2Test.java @@ -46,7 +46,7 @@ public class DurableSubscriptionOffline2Test extends DurableSubscriptionOfflineT public static Collection getTestParameters() { Boolean[] f = {Boolean.FALSE}; Boolean[] t = {Boolean.TRUE}; - List booleanChoices = new ArrayList(); + List booleanChoices = new ArrayList<>(); booleanChoices.add(f); booleanChoices.add(t); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubscriptionOffline3Test.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubscriptionOffline3Test.java index 829c66a97a..3aff528ba4 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubscriptionOffline3Test.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubscriptionOffline3Test.java @@ -48,7 +48,7 @@ public class DurableSubscriptionOffline3Test extends DurableSubscriptionOfflineT PersistenceAdapterChoice[] kahaDb = {PersistenceAdapterChoice.KahaDB}; PersistenceAdapterChoice[] jdbc = {PersistenceAdapterChoice.JDBC}; - List choices = new ArrayList(); + List choices = new ArrayList<>(); choices.add(kahaDb); choices.add(jdbc); if (!osName.equalsIgnoreCase("AIX") && !osName.equalsIgnoreCase("SunOS")) { diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubscriptionOffline4Test.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubscriptionOffline4Test.java index e6edee9fe9..adcf8fbdbb 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubscriptionOffline4Test.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubscriptionOffline4Test.java @@ -45,7 +45,7 @@ public class DurableSubscriptionOffline4Test extends DurableSubscriptionOfflineT public static Collection getTestParameters() { Boolean[] f = {Boolean.FALSE}; Boolean[] t = {Boolean.TRUE}; - List booleanChoices = new ArrayList(); + List booleanChoices = new ArrayList<>(); booleanChoices.add(f); booleanChoices.add(t); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubscriptionOfflineTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubscriptionOfflineTest.java index f7689d87cb..ca197a4d86 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubscriptionOfflineTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubscriptionOfflineTest.java @@ -310,7 +310,7 @@ public class DurableSubscriptionOfflineTest extends DurableSubscriptionOfflineTe class CheckForDupsClient implements Runnable { - HashSet ids = new HashSet(); + HashSet ids = new HashSet<>(); final int id; public CheckForDupsClient(int id) { diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubscriptionOfflineTestBase.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubscriptionOfflineTestBase.java index e53f191184..c05edcbe60 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubscriptionOfflineTestBase.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/DurableSubscriptionOfflineTestBase.java @@ -55,7 +55,7 @@ public abstract class DurableSubscriptionOfflineTestBase { public boolean keepDurableSubsActive = true; protected BrokerService broker; protected ActiveMQTopic topic; - protected final List exceptions = new ArrayList(); + protected final List exceptions = new ArrayList<>(); protected ActiveMQConnectionFactory connectionFactory; protected boolean isTopic = true; public PersistenceAdapterChoice defaultPersistenceAdapter = PersistenceAdapterChoice.KahaDB; diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/ExceptionListenerTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/ExceptionListenerTest.java index f542ecb03f..664e0e7469 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/ExceptionListenerTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/ExceptionListenerTest.java @@ -49,7 +49,7 @@ public class ExceptionListenerTest implements ExceptionListener { private static final Logger LOG = LoggerFactory.getLogger(ExceptionListenerTest.class); BrokerService brokerService; URI brokerUri; - LinkedList exceptionsViaListener = new LinkedList(); + LinkedList exceptionsViaListener = new LinkedList<>(); @Before public void startBroker() throws Exception { diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/JdbcDurableSubDupTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/JdbcDurableSubDupTest.java index de7ee38ee2..88adefe821 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/JdbcDurableSubDupTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/JdbcDurableSubDupTest.java @@ -63,7 +63,7 @@ public class JdbcDurableSubDupTest { final int TO_RECEIVE = 5000; BrokerService broker = null; - Vector exceptions = new Vector(); + Vector exceptions = new Vector<>(); final int MAX_MESSAGES = 100000; int[] dupChecker = new int[MAX_MESSAGES]; diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/MessageGroupCloseTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/MessageGroupCloseTest.java index 5a67c46587..7c8e4acd44 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/MessageGroupCloseTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/MessageGroupCloseTest.java @@ -44,10 +44,10 @@ public class MessageGroupCloseTest extends TestCase { private int messagesSent, messagesRecvd1, messagesRecvd2, messageGroupCount, errorCountFirstForConsumer, errorCountWrongConsumerClose, errorCountDuplicateClose; // groupID, count - private HashMap messageGroups1 = new HashMap(); - private HashMap messageGroups2 = new HashMap(); - private HashSet closedGroups1 = new HashSet(); - private HashSet closedGroups2 = new HashSet(); + private HashMap messageGroups1 = new HashMap<>(); + private HashMap messageGroups2 = new HashMap<>(); + private HashSet closedGroups1 = new HashSet<>(); + private HashSet closedGroups2 = new HashSet<>(); // with the prefetch too high, this bug is not realized private static final String connStr = "vm://localhost?broker.persistent=false&broker.useJmx=false&jms.prefetchPolicy.all=1"; diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/MessageGroupDelayedTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/MessageGroupDelayedTest.java index 678631912f..1ed4127596 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/MessageGroupDelayedTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/MessageGroupDelayedTest.java @@ -54,8 +54,8 @@ public class MessageGroupDelayedTest extends JmsTestSupport { BrokerService broker; protected TransportConnector connector; - protected HashMap messageCount = new HashMap(); - protected HashMap> messageGroups = new HashMap>(); + protected HashMap messageCount = new HashMap<>(); + protected HashMap> messageGroups = new HashMap<>(); public static Test suite() { return suite(MessageGroupDelayedTest.class); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/MessageGroupLateArrivalsTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/MessageGroupLateArrivalsTest.java index 8b83e44665..af91f5abe6 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/MessageGroupLateArrivalsTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/MessageGroupLateArrivalsTest.java @@ -60,8 +60,8 @@ public class MessageGroupLateArrivalsTest { BrokerService broker; protected TransportConnector connector; - protected HashMap messageCount = new HashMap(); - protected HashMap> messageGroups = new HashMap>(); + protected HashMap messageCount = new HashMap<>(); + protected HashMap> messageGroups = new HashMap<>(); @Before public void setUp() throws Exception { @@ -149,7 +149,7 @@ public class MessageGroupLateArrivalsTest { doneSignal.await(); - List workers = new ArrayList(messageCount.keySet()); + List workers = new ArrayList<>(messageCount.keySet()); Collections.sort(workers); for (String worker : workers) { log.info("worker " + worker + " received " + messageCount.get(worker) + " messages from groups " + messageGroups.get(worker)); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/MessageGroupReconnectDistributionTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/MessageGroupReconnectDistributionTest.java index 609626622b..7b5c219aa5 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/MessageGroupReconnectDistributionTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/MessageGroupReconnectDistributionTest.java @@ -119,8 +119,8 @@ public class MessageGroupReconnectDistributionTest { final AtomicLong totalConsumed = new AtomicLong(0); ExecutorService executorService = Executors.newFixedThreadPool(numConsumers); - final ArrayList consumedCounters = new ArrayList(numConsumers); - final ArrayList batchCounters = new ArrayList(numConsumers); + final ArrayList consumedCounters = new ArrayList<>(numConsumers); + final ArrayList batchCounters = new ArrayList<>(numConsumers); for (int i = 0; i < numConsumers; i++) { consumedCounters.add(new AtomicLong(0L)); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/MultiBrokersMultiClientsTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/MultiBrokersMultiClientsTest.java index 0888ca2d87..54dc36e686 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/MultiBrokersMultiClientsTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/MultiBrokersMultiClientsTest.java @@ -45,7 +45,7 @@ public class MultiBrokersMultiClientsTest extends JmsMultipleBrokersTestSupport private static final Logger LOG = LoggerFactory.getLogger(MultiBrokersMultiClientsTest.class); protected Map consumerMap; - final Map unhandeledExceptions = new HashMap(); + final Map unhandeledExceptions = new HashMap<>(); public void testTopicAllConnected() throws Exception { bridgeAllBrokers(); @@ -156,7 +156,7 @@ public class MultiBrokersMultiClientsTest extends JmsMultipleBrokersTestSupport createBroker(new URI("broker:()/Broker" + i + "?persistent=false&useJmx=false")); } - consumerMap = new HashMap(); + consumerMap = new HashMap<>(); } @Override diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/MultiBrokersMultiClientsUsingTcpTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/MultiBrokersMultiClientsUsingTcpTest.java index 816589daf8..1e1c860a5c 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/MultiBrokersMultiClientsUsingTcpTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/MultiBrokersMultiClientsUsingTcpTest.java @@ -85,6 +85,6 @@ public class MultiBrokersMultiClientsUsingTcpTest extends MultiBrokersMultiClien i.next().broker.addConnector("tcp://localhost:" + (61616 + j++)); } - bridges = new ArrayList(); + bridges = new ArrayList<>(); } } diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/NetworkBridgeProducerFlowControlTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/NetworkBridgeProducerFlowControlTest.java index a3705f90e5..270b43726d 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/NetworkBridgeProducerFlowControlTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/NetworkBridgeProducerFlowControlTest.java @@ -106,7 +106,7 @@ public class NetworkBridgeProducerFlowControlTest extends JmsMultipleBrokersTest public boolean persistentTestMessages; public boolean networkIsAlwaysSendSync; - private Vector exceptions = new Vector(); + private Vector exceptions = new Vector<>(); public static Test suite() { return suite(NetworkBridgeProducerFlowControlTest.class); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/NoDuplicateOnTopicNetworkTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/NoDuplicateOnTopicNetworkTest.java index 1b8617e9b5..5058e5f98b 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/NoDuplicateOnTopicNetworkTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/NoDuplicateOnTopicNetworkTest.java @@ -238,7 +238,7 @@ public class NoDuplicateOnTopicNetworkTest extends CombinationTestSupport { consumerThread.join(); int duplicateCount = 0; - Map map = new HashMap(); + Map map = new HashMap<>(); for (String msg : consumer.getMessageStrings()) { if (map.containsKey(msg)) { LOG.info("got duplicate: " + msg); @@ -280,7 +280,7 @@ public class NoDuplicateOnTopicNetworkTest extends CombinationTestSupport { public List getMessageStrings() { synchronized (receivedStrings) { - return new ArrayList(receivedStrings); + return new ArrayList<>(receivedStrings); } } diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/NonBlockingConsumerRedeliveryTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/NonBlockingConsumerRedeliveryTest.java index f4775ccc2e..f29680fa4a 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/NonBlockingConsumerRedeliveryTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/NonBlockingConsumerRedeliveryTest.java @@ -60,9 +60,9 @@ public class NonBlockingConsumerRedeliveryTest { @Test public void testMessageDeleiveredWhenNonBlockingEnabled() throws Exception { - final LinkedHashSet received = new LinkedHashSet(); - final LinkedHashSet beforeRollback = new LinkedHashSet(); - final LinkedHashSet afterRollback = new LinkedHashSet(); + final LinkedHashSet received = new LinkedHashSet<>(); + final LinkedHashSet beforeRollback = new LinkedHashSet<>(); + final LinkedHashSet afterRollback = new LinkedHashSet<>(); Connection connection = connectionFactory.createConnection(); Session session = connection.createSession(true, Session.AUTO_ACKNOWLEDGE); @@ -112,9 +112,9 @@ public class NonBlockingConsumerRedeliveryTest { @Test public void testMessageDeleiveredInCorrectOrder() throws Exception { - final LinkedHashSet received = new LinkedHashSet(); - final LinkedHashSet beforeRollback = new LinkedHashSet(); - final LinkedHashSet afterRollback = new LinkedHashSet(); + final LinkedHashSet received = new LinkedHashSet<>(); + final LinkedHashSet beforeRollback = new LinkedHashSet<>(); + final LinkedHashSet afterRollback = new LinkedHashSet<>(); Connection connection = connectionFactory.createConnection(); Session session = connection.createSession(true, Session.AUTO_ACKNOWLEDGE); @@ -178,9 +178,9 @@ public class NonBlockingConsumerRedeliveryTest { @Test public void testMessageDeleiveryDoesntStop() throws Exception { - final LinkedHashSet received = new LinkedHashSet(); - final LinkedHashSet beforeRollback = new LinkedHashSet(); - final LinkedHashSet afterRollback = new LinkedHashSet(); + final LinkedHashSet received = new LinkedHashSet<>(); + final LinkedHashSet beforeRollback = new LinkedHashSet<>(); + final LinkedHashSet afterRollback = new LinkedHashSet<>(); Connection connection = connectionFactory.createConnection(); Session session = connection.createSession(true, Session.AUTO_ACKNOWLEDGE); @@ -229,7 +229,7 @@ public class NonBlockingConsumerRedeliveryTest { @Test public void testNonBlockingMessageDeleiveryIsDelayed() throws Exception { - final LinkedHashSet received = new LinkedHashSet(); + final LinkedHashSet received = new LinkedHashSet<>(); ActiveMQConnection connection = (ActiveMQConnection) connectionFactory.createConnection(); connection.getRedeliveryPolicy().setInitialRedeliveryDelay(TimeUnit.SECONDS.toMillis(6)); @@ -271,7 +271,7 @@ public class NonBlockingConsumerRedeliveryTest { @Test public void testNonBlockingMessageDeleiveryWithRollbacks() throws Exception { - final LinkedHashSet received = new LinkedHashSet(); + final LinkedHashSet received = new LinkedHashSet<>(); ActiveMQConnection connection = (ActiveMQConnection) connectionFactory.createConnection(); final Session session = connection.createSession(true, Session.AUTO_ACKNOWLEDGE); @@ -343,8 +343,8 @@ public class NonBlockingConsumerRedeliveryTest { @Test public void testNonBlockingMessageDeleiveryWithAllRolledBack() throws Exception { - final LinkedHashSet received = new LinkedHashSet(); - final LinkedHashSet dlqed = new LinkedHashSet(); + final LinkedHashSet received = new LinkedHashSet<>(); + final LinkedHashSet dlqed = new LinkedHashSet<>(); ActiveMQConnection connection = (ActiveMQConnection) connectionFactory.createConnection(); connection.getRedeliveryPolicy().setMaximumRedeliveries(5); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/ObjectMessageNotSerializableTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/ObjectMessageNotSerializableTest.java index ab21c0b8c1..67e9101402 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/ObjectMessageNotSerializableTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/ObjectMessageNotSerializableTest.java @@ -44,7 +44,7 @@ public class ObjectMessageNotSerializableTest extends CombinationTestSupport { BrokerService broker; AtomicInteger numReceived = new AtomicInteger(0); - final Vector exceptions = new Vector(); + final Vector exceptions = new Vector<>(); public static Test suite() { return suite(ObjectMessageNotSerializableTest.class); @@ -138,7 +138,7 @@ public class ObjectMessageNotSerializableTest extends CombinationTestSupport { final MyObject obj = new MyObject("A message"); final CountDownLatch consumerStarted = new CountDownLatch(3); - final Vector exceptions = new Vector(); + final Vector exceptions = new Vector<>(); Thread vmConsumerThread = new Thread("Consumer Thread") { @Override public void run() { diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/QueueDuplicatesTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/QueueDuplicatesTest.java index 1c8f7af805..18c19f5cd8 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/QueueDuplicatesTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/QueueDuplicatesTest.java @@ -149,7 +149,7 @@ public class QueueDuplicatesTest extends TestCase { private static class SimpleConsumer implements MessageListener { - private Map msgs = new HashMap(); + private Map msgs = new HashMap<>(); @Override public void onMessage(Message message) { diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/QueueMemoryFullMultiBrokersTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/QueueMemoryFullMultiBrokersTest.java index 316f4f6e9b..e1f1d21112 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/QueueMemoryFullMultiBrokersTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/QueueMemoryFullMultiBrokersTest.java @@ -87,7 +87,7 @@ public class QueueMemoryFullMultiBrokersTest extends JmsMultipleBrokersTestSuppo memoryManager.getMemoryUsage().setLimit(1024 * 50); // 50 MB broker.setSystemUsage(memoryManager); - final List policyEntries = new ArrayList(); + final List policyEntries = new ArrayList<>(); final PolicyEntry entry = new PolicyEntry(); entry.setQueue(">"); entry.setMemoryLimit(1024 * 4); // Set to 2 kb diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/RequestReplyNoAdvisoryNetworkTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/RequestReplyNoAdvisoryNetworkTest.java index 593c9213e2..54781eebf3 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/RequestReplyNoAdvisoryNetworkTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/RequestReplyNoAdvisoryNetworkTest.java @@ -53,7 +53,7 @@ public class RequestReplyNoAdvisoryNetworkTest extends JmsMultipleBrokersTestSup private static final transient Logger LOG = LoggerFactory.getLogger(RequestReplyNoAdvisoryNetworkTest.class); - Vector brokers = new Vector(); + Vector brokers = new Vector<>(); BrokerService a, b; ActiveMQQueue sendQ = new ActiveMQQueue("sendQ"); static final String connectionIdMarker = "ID:marker."; diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/RequestReplyTempDestRemovalAdvisoryRaceTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/RequestReplyTempDestRemovalAdvisoryRaceTest.java index c3a15b3f3b..9211bf2eb5 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/RequestReplyTempDestRemovalAdvisoryRaceTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/RequestReplyTempDestRemovalAdvisoryRaceTest.java @@ -85,8 +85,8 @@ public class RequestReplyTempDestRemovalAdvisoryRaceTest extends JmsMultipleBrok final AtomicLong forwardFailures = new AtomicLong(0); protected final AtomicBoolean shutdown = new AtomicBoolean(false); - HashSet networkConnectors = new HashSet(); - HashSet advisoryConsumerConnections = new HashSet(); + HashSet networkConnectors = new HashSet<>(); + HashSet advisoryConsumerConnections = new HashSet<>(); Appender slowDownAppender; CountDownLatch consumerDemandExists; @@ -117,7 +117,7 @@ public class RequestReplyTempDestRemovalAdvisoryRaceTest extends JmsMultipleBrok waitForBridgeFormation(1); - HashSet bridgesStart = new HashSet(); + HashSet bridgesStart = new HashSet<>(); for (NetworkConnector networkConnector : networkConnectors) { bridgesStart.addAll(networkConnector.activeBridges()); } @@ -150,7 +150,7 @@ public class RequestReplyTempDestRemovalAdvisoryRaceTest extends JmsMultipleBrok LOG.info("shutting down"); shutdown.compareAndSet(false, true); - HashSet bridgesEnd = new HashSet(); + HashSet bridgesEnd = new HashSet<>(); for (NetworkConnector networkConnector : networkConnectors) { bridgesEnd.addAll(networkConnector.activeBridges()); } @@ -203,7 +203,7 @@ public class RequestReplyTempDestRemovalAdvisoryRaceTest extends JmsMultipleBrok waitForBridgeFormation(1); - HashSet bridgesStart = new HashSet(); + HashSet bridgesStart = new HashSet<>(); for (NetworkConnector networkConnector : networkConnectors) { bridgesStart.addAll(networkConnector.activeBridges()); } @@ -235,7 +235,7 @@ public class RequestReplyTempDestRemovalAdvisoryRaceTest extends JmsMultipleBrok LOG.info("shutting down"); shutdown.compareAndSet(false, true); - HashSet bridgesEnd = new HashSet(); + HashSet bridgesEnd = new HashSet<>(); for (NetworkConnector networkConnector : networkConnectors) { bridgesEnd.addAll(networkConnector.activeBridges()); } diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/RequestReplyToTopicViaThreeNetworkHopsTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/RequestReplyToTopicViaThreeNetworkHopsTest.java index 787312ffd5..001142ea06 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/RequestReplyToTopicViaThreeNetworkHopsTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/RequestReplyToTopicViaThreeNetworkHopsTest.java @@ -619,7 +619,7 @@ public class RequestReplyToTopicViaThreeNetworkHopsTest { excl_dest = ActiveMQDestination.createDestination(">", ActiveMQDestination.QUEUE_TYPE); } - excludes = new ArrayList(); + excludes = new ArrayList<>(); excludes.add(excl_dest); nw_conn.setExcludedDestinations(excludes); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/ThreeBrokerQueueNetworkTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/ThreeBrokerQueueNetworkTest.java index a7b020ae27..9c0a20594c 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/ThreeBrokerQueueNetworkTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/ThreeBrokerQueueNetworkTest.java @@ -130,7 +130,7 @@ public class ThreeBrokerQueueNetworkTest extends JmsMultipleBrokersTestSupport { Destination dest = createDestination("TEST.FOO", false); // Send messages for broker A - HashMap props = new HashMap(); + HashMap props = new HashMap<>(); props.put("broker", "BROKER_A"); sendMessages("BrokerB", dest, MESSAGE_COUNT, props); @@ -176,7 +176,7 @@ public class ThreeBrokerQueueNetworkTest extends JmsMultipleBrokersTestSupport { Thread.sleep(2000); //et subscriptions get propagated // Send messages for broker A - HashMap props = new HashMap(); + HashMap props = new HashMap<>(); props.put("broker", "BROKER_A"); sendMessages("BrokerB", dest, MESSAGE_COUNT, props); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/ThreeBrokerQueueNetworkUsingTcpTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/ThreeBrokerQueueNetworkUsingTcpTest.java index c78530c6b9..93baeca68b 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/ThreeBrokerQueueNetworkUsingTcpTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/ThreeBrokerQueueNetworkUsingTcpTest.java @@ -68,6 +68,6 @@ public class ThreeBrokerQueueNetworkUsingTcpTest extends ThreeBrokerQueueNetwork public void setUp() throws Exception { super.setUp(); - bridges = new ArrayList(); + bridges = new ArrayList<>(); } } diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/ThreeBrokerTopicNetworkTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/ThreeBrokerTopicNetworkTest.java index 73a4b107b7..381ae0597d 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/ThreeBrokerTopicNetworkTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/ThreeBrokerTopicNetworkTest.java @@ -109,7 +109,7 @@ public class ThreeBrokerTopicNetworkTest extends JmsMultipleBrokersTestSupport { Thread.sleep(2000); // Send messages // Send messages for broker A - HashMap props = new HashMap(); + HashMap props = new HashMap<>(); props.put("dummy", 33); sendMessages("BrokerA", dest, MESSAGE_COUNT, props); props.put("dummy", 34); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/ThreeBrokerTopicNetworkUsingTcpTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/ThreeBrokerTopicNetworkUsingTcpTest.java index 110b8806d2..848193abdb 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/ThreeBrokerTopicNetworkUsingTcpTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/ThreeBrokerTopicNetworkUsingTcpTest.java @@ -68,6 +68,6 @@ public class ThreeBrokerTopicNetworkUsingTcpTest extends ThreeBrokerTopicNetwork public void setUp() throws Exception { super.setUp(); - bridges = new ArrayList(); + bridges = new ArrayList<>(); } } diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/TopicDurableConnectStatsTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/TopicDurableConnectStatsTest.java index 2384aa6e42..b1e1db669e 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/TopicDurableConnectStatsTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/TopicDurableConnectStatsTest.java @@ -52,7 +52,7 @@ public class TopicDurableConnectStatsTest extends org.apache.activemq.TestSuppor private static final Logger LOG = LoggerFactory.getLogger(TopicDurableConnectStatsTest.class); private BrokerService broker; private ActiveMQTopic topic; - private final Vector exceptions = new Vector(); + private final Vector exceptions = new Vector<>(); private final int messageSize = 4000; protected MBeanServerConnection mbeanServer; protected String domain = "org.apache.activemq"; diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/TransactionRollbackOrderTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/TransactionRollbackOrderTest.java index 242110719b..0978480676 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/TransactionRollbackOrderTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/TransactionRollbackOrderTest.java @@ -57,10 +57,10 @@ public final class TransactionRollbackOrderTest extends TestCase { private Connection connection; private CountDownLatch latch = new CountDownLatch(1); private int numMessages = 5; - private List msgSent = new ArrayList(); - private List msgCommitted = new ArrayList(); - private List msgRolledBack = new ArrayList(); - private List msgRedelivered = new ArrayList(); + private List msgSent = new ArrayList<>(); + private List msgCommitted = new ArrayList<>(); + private List msgRolledBack = new ArrayList<>(); + private List msgRedelivered = new ArrayList<>(); public void testTransaction() throws Exception { diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/TwoBrokerTopicSendReceiveTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/TwoBrokerTopicSendReceiveTest.java index eeee14752c..361f514065 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/TwoBrokerTopicSendReceiveTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/TwoBrokerTopicSendReceiveTest.java @@ -40,7 +40,7 @@ public class TwoBrokerTopicSendReceiveTest extends JmsTopicSendReceiveWithTwoCon protected ActiveMQConnectionFactory sendFactory; protected ActiveMQConnectionFactory receiveFactory; - protected HashMap brokers = new HashMap(); + protected HashMap brokers = new HashMap<>(); @Override protected void setUp() throws Exception { diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/TwoBrokerVirtualTopicForwardingTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/TwoBrokerVirtualTopicForwardingTest.java index 4abe6872de..7c042b991c 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/TwoBrokerVirtualTopicForwardingTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/TwoBrokerVirtualTopicForwardingTest.java @@ -170,7 +170,7 @@ public class TwoBrokerVirtualTopicForwardingTest extends JmsMultipleBrokersTestS NetworkConnector bridge = bridgeBrokers(local, remote); bridge.setDecreaseNetworkConsumerPriority(true); - LinkedList excludedDestinations = new LinkedList(); + LinkedList excludedDestinations = new LinkedList<>(); excludedDestinations.add(new ActiveMQQueue("Consumer.*.VirtualTopic.>")); bridge.setExcludedDestinations(excludedDestinations); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/UnlimitedEnqueueTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/UnlimitedEnqueueTest.java index 876da5c900..cfeef5c708 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/UnlimitedEnqueueTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/UnlimitedEnqueueTest.java @@ -81,7 +81,7 @@ public class UnlimitedEnqueueTest { brokerService.getSystemUsage().getTempUsage().setLimit((numMessages * payLoadSize) + (1000 * payLoadSize)); PolicyMap policyMap = new PolicyMap(); - List entries = new ArrayList(); + List entries = new ArrayList<>(); PolicyEntry policy = new PolicyEntry(); // NB: ensure queue cursor limit is below the default 70% usage that the destination will use diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/VerifyNetworkConsumersDisconnectTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/VerifyNetworkConsumersDisconnectTest.java index 5ba78d0f63..5c9a3bfea7 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/VerifyNetworkConsumersDisconnectTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/usecases/VerifyNetworkConsumersDisconnectTest.java @@ -53,7 +53,7 @@ public class VerifyNetworkConsumersDisconnectTest extends JmsMultipleBrokersTest public static final int TIMEOUT = 30000; protected Map consumerMap; - final Map unhandledExceptions = new HashMap(); + final Map unhandledExceptions = new HashMap<>(); private void assertNoUnhandledExceptions() { for (Entry e : unhandledExceptions.entrySet()) { @@ -220,7 +220,7 @@ public class VerifyNetworkConsumersDisconnectTest extends JmsMultipleBrokersTest QueueViewMBean queueViewMBean = (QueueViewMBean) context.newProxyInstance(brokers.get(brokerName).broker.getAdminView().getQueues()[0], QueueViewMBean.class, false); long currentCount = queueViewMBean.getConsumerCount(); LOG.info("On " + brokerName + " current consumer count for " + queueViewMBean + ", " + currentCount); - LinkedList consumerIds = new LinkedList(); + LinkedList consumerIds = new LinkedList<>(); for (ObjectName objectName : queueViewMBean.getSubscriptions()) { consumerIds.add(objectName.getKeyProperty("consumerId")); } @@ -254,7 +254,7 @@ public class VerifyNetworkConsumersDisconnectTest extends JmsMultipleBrokersTest createBroker(new URI("broker:(tcp://localhost:6161" + i + ")/Broker" + i + "?persistent=false&useJmx=true&brokerId=Broker" + i)); } - consumerMap = new LinkedHashMap(); + consumerMap = new LinkedHashMap<>(); } @Override diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/util/MessageIdList.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/util/MessageIdList.java index 828449fe2e..8b87de57a2 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/util/MessageIdList.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/util/MessageIdList.java @@ -41,7 +41,7 @@ public class MessageIdList extends Assert implements MessageListener { private static final Logger LOG = LoggerFactory.getLogger(MessageIdList.class); - private final List messageIds = new ArrayList(); + private final List messageIds = new ArrayList<>(); private final Object semaphore; private boolean verbose; private MessageListener parent; @@ -86,7 +86,7 @@ public class MessageIdList extends Assert implements MessageListener { */ public List flushMessages() { synchronized (semaphore) { - List answer = new ArrayList(messageIds); + List answer = new ArrayList<>(messageIds); messageIds.clear(); return answer; } @@ -94,7 +94,7 @@ public class MessageIdList extends Assert implements MessageListener { public synchronized List getMessageIds() { synchronized (semaphore) { - return new ArrayList(messageIds); + return new ArrayList<>(messageIds); } } diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/util/ReflectionSupportTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/util/ReflectionSupportTest.java index 43a585fb4a..0f4b902189 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/util/ReflectionSupportTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/util/ReflectionSupportTest.java @@ -31,9 +31,9 @@ import org.apache.activemq.command.ActiveMQTopic; public class ReflectionSupportTest extends TestCase { - List favorites = new ArrayList(); + List favorites = new ArrayList<>(); String favoritesString = "[queue://test, topic://test]"; - List nonFavorites = new ArrayList(); + List nonFavorites = new ArrayList<>(); String nonFavoritesString = "[topic://test1]"; @Override @@ -45,7 +45,7 @@ public class ReflectionSupportTest extends TestCase { public void testSetProperties() throws URISyntaxException { SimplePojo pojo = new SimplePojo(); - HashMap map = new HashMap(); + HashMap map = new HashMap<>(); map.put("age", "27"); map.put("name", "Hiram"); map.put("enabled", "true"); diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/util/SimplePojo.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/util/SimplePojo.java index b0ba089778..a1f9ed353c 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/util/SimplePojo.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/util/SimplePojo.java @@ -28,9 +28,9 @@ public class SimplePojo { int age; boolean enabled; URI uri; - List favorites = new ArrayList(); - List nonFavorites = new ArrayList(); - List others = new ArrayList(); + List favorites = new ArrayList<>(); + List nonFavorites = new ArrayList<>(); + List others = new ArrayList<>(); String[] systems; public int getAge() { diff --git a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/xbean/ManagementContextXBeanConfigTest.java b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/xbean/ManagementContextXBeanConfigTest.java index 734cd1c1bb..e3001a2cbd 100644 --- a/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/xbean/ManagementContextXBeanConfigTest.java +++ b/tests/activemq5-unit-tests/src/test/java/org/apache/activemq/xbean/ManagementContextXBeanConfigTest.java @@ -49,7 +49,7 @@ public class ManagementContextXBeanConfigTest extends TestCase { assertEquals(2011, brokerService.getManagementContext().getConnectorPort()); assertEquals("test.domain", brokerService.getManagementContext().getJmxDomainName()); // Make sure the broker is registered in the right jmx domain. - Hashtable map = new Hashtable(); + Hashtable map = new Hashtable<>(); map.put("type", "Broker"); map.put("brokerName", JMXSupport.encodeObjectNamePart("localhost")); ObjectName on = new ObjectName("test.domain", map); @@ -59,7 +59,7 @@ public class ManagementContextXBeanConfigTest extends TestCase { public void testSuccessAuthentication() throws Exception { JMXServiceURL url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:2011/jmxrmi"); - Map env = new HashMap(); + Map env = new HashMap<>(); env.put(JMXConnector.CREDENTIALS, new String[]{"admin", "activemq"}); JMXConnector connector = JMXConnectorFactory.connect(url, env); assertAuthentication(connector); diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/BridgeServerLocatorConfigurationTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/BridgeServerLocatorConfigurationTest.java index 8f835dea8a..20d3722ce7 100644 --- a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/BridgeServerLocatorConfigurationTest.java +++ b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/BridgeServerLocatorConfigurationTest.java @@ -64,10 +64,10 @@ public class BridgeServerLocatorConfigurationTest extends ActiveMQTestBase { * It the overrides the return value to be the value of the connection ttl. Note that the unused String parameter is required to * ensure that byteman populates the $1 variable, otherwise it will not bind correctly. */ public void testConnectionTTLOnBridge() throws Exception { - Map server0Params = new HashMap(); + Map server0Params = new HashMap<>(); ActiveMQServer serverWithBridge = createClusteredServerWithParams(isNetty(), 0, true, server0Params); - Map server1Params = new HashMap(); + Map server1Params = new HashMap<>(); if (isNetty()) { server1Params.put("port", org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants.DEFAULT_PORT + 1); } @@ -82,28 +82,28 @@ public class BridgeServerLocatorConfigurationTest extends ActiveMQTestBase { final String forwardAddress = "forwardAddress"; final String queueName1 = "queue1"; - Map connectors = new HashMap(); + Map connectors = new HashMap<>(); TransportConfiguration server1tc = new TransportConfiguration(getConnector(), server1Params); connectors.put(server1tc.getName(), server1tc); serverWithBridge.getConfiguration().setConnectorConfigurations(connectors); - ArrayList staticConnectors = new ArrayList(); + ArrayList staticConnectors = new ArrayList<>(); staticConnectors.add(server1tc.getName()); BridgeConfiguration bridgeConfiguration = new BridgeConfiguration().setName(BRIDGE_NAME).setQueueName(queueName0).setForwardingAddress(forwardAddress).setConnectionTTL(BRIDGE_TTL).setRetryInterval(1000).setReconnectAttempts(0).setReconnectAttemptsOnSameNode(0).setConfirmationWindowSize(1024).setStaticConnectors(staticConnectors); - List bridgeConfigs = new ArrayList(); + List bridgeConfigs = new ArrayList<>(); bridgeConfigs.add(bridgeConfiguration); serverWithBridge.getConfiguration().setBridgeConfigurations(bridgeConfigs); CoreQueueConfiguration queueConfig0 = new CoreQueueConfiguration().setAddress(testAddress).setName(queueName0); - List queueConfigs0 = new ArrayList(); + List queueConfigs0 = new ArrayList<>(); queueConfigs0.add(queueConfig0); serverWithBridge.getConfiguration().setQueueConfigurations(queueConfigs0); CoreQueueConfiguration queueConfig1 = new CoreQueueConfiguration().setAddress(forwardAddress).setName(queueName1); - List queueConfigs1 = new ArrayList(); + List queueConfigs1 = new ArrayList<>(); queueConfigs1.add(queueConfig1); server1.getConfiguration().setQueueConfigurations(queueConfigs1); diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/ConcurrentDeliveryCancelTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/ConcurrentDeliveryCancelTest.java index 946be53b51..5b2dd0dac5 100644 --- a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/ConcurrentDeliveryCancelTest.java +++ b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/ConcurrentDeliveryCancelTest.java @@ -138,7 +138,7 @@ public class ConcurrentDeliveryCancelTest extends JMSTestBase { System.out.println("....."); - final List serverSessions = new LinkedList(); + final List serverSessions = new LinkedList<>(); // We will force now the failure simultaneously from several places for (ServerSession srvSess : server.getSessions()) { @@ -150,7 +150,7 @@ public class ConcurrentDeliveryCancelTest extends JMSTestBase { resetLatches(2); // from Transactional reaper - List threads = new LinkedList(); + List threads = new LinkedList<>(); threads.add(new Thread("ConsumerCloser") { @Override @@ -219,7 +219,7 @@ public class ConcurrentDeliveryCancelTest extends JMSTestBase { connection.start(); Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); MessageConsumer consumer = session.createConsumer(queue); - HashMap mapCount = new HashMap(); + HashMap mapCount = new HashMap<>(); while (true) { TextMessage message = (TextMessage) consumer.receiveNoWait(); diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/HierarchicalObjectRepositoryTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/HierarchicalObjectRepositoryTest.java index 361cbc70d4..2c47bf03a4 100644 --- a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/HierarchicalObjectRepositoryTest.java +++ b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/HierarchicalObjectRepositoryTest.java @@ -50,7 +50,7 @@ public class HierarchicalObjectRepositoryTest { latch = new CountDownLatch(1); latch2 = new CountDownLatch(1); executor = Executors.newSingleThreadExecutor(); - repo = new HierarchicalObjectRepository(); + repo = new HierarchicalObjectRepository<>(); addToRepo(repo, A); } diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/MessageCopyTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/MessageCopyTest.java index 2e37e56791..5d7f5cd92a 100644 --- a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/MessageCopyTest.java +++ b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/MessageCopyTest.java @@ -132,7 +132,7 @@ public class MessageCopyTest { } } - ArrayList threads = new ArrayList(); + ArrayList threads = new ArrayList<>(); for (int i = 0; i < T1_number; i++) { T1 t = new T1(); diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/PagingLeakTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/PagingLeakTest.java index 0372878eac..cfd481cb4a 100644 --- a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/PagingLeakTest.java +++ b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/byteman/PagingLeakTest.java @@ -76,7 +76,7 @@ public class PagingLeakTest extends ActiveMQTestBase { public void testValidateLeak() throws Throwable { System.out.println("location::" + getBindingsDir()); - List positions = new ArrayList(); + List positions = new ArrayList<>(); for (int i = 0; i < 300; i++) { positions.add(new PagePositionImpl(3, 3)); @@ -100,7 +100,7 @@ public class PagingLeakTest extends ActiveMQTestBase { // This is just to validate the rules are correctly applied on byteman assertEquals("You have changed something on PagePositionImpl in such way that these byteman rules are no longer working", 0, pagePosInstances.get()); - final ArrayList errors = new ArrayList(); + final ArrayList errors = new ArrayList<>(); // A backup that will be waiting to be activated Configuration config = createDefaultNettyConfig(); diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/jms/bridge/BridgeTestBase.java b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/jms/bridge/BridgeTestBase.java index e4317fba5c..4ed91c069e 100644 --- a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/jms/bridge/BridgeTestBase.java +++ b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/jms/bridge/BridgeTestBase.java @@ -117,7 +117,7 @@ public abstract class BridgeTestBase extends ActiveMQTestBase { jmsServer0.setRegistry(new JndiBindingRegistry(context0)); jmsServer0.start(); - params1 = new HashMap(); + params1 = new HashMap<>(); params1.put(TransportConstants.SERVER_ID_PROP_NAME, 1); Configuration conf1 = createBasicConfig().setJournalDirectory(getJournalDir(1, false)).setBindingsDirectory(getBindingsDir(1, false)).addAcceptorConfiguration(new TransportConfiguration(INVM_ACCEPTOR_FACTORY, params1)); @@ -388,7 +388,7 @@ public abstract class BridgeTestBase extends ActiveMQTestBase { // Consume the messages - Set msgs = new HashSet(); + Set msgs = new HashSet<>(); int count = 0; diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/jms/bridge/ClusteredBridgeTestBase.java b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/jms/bridge/ClusteredBridgeTestBase.java index b1565d863f..fe86bbdd3d 100644 --- a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/jms/bridge/ClusteredBridgeTestBase.java +++ b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/jms/bridge/ClusteredBridgeTestBase.java @@ -66,7 +66,7 @@ public abstract class ClusteredBridgeTestBase extends ActiveMQTestBase { private static int index = 0; - protected Map groups = new HashMap(); + protected Map groups = new HashMap<>(); @Override @Before @@ -137,11 +137,11 @@ public abstract class ClusteredBridgeTestBase extends ActiveMQTestBase { } public void create() throws Exception { - Map params0 = new HashMap(); + Map params0 = new HashMap<>(); params0.put(TransportConstants.SERVER_ID_PROP_NAME, id); liveConnector = new TransportConfiguration(INVM_CONNECTOR_FACTORY, params0, "in-vm-live"); - Map params = new HashMap(); + Map params = new HashMap<>(); params.put(TransportConstants.SERVER_ID_PROP_NAME, id + ID_OFFSET); backupConnector = new TransportConfiguration(INVM_CONNECTOR_FACTORY, params, "in-vm-backup"); diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/jms/bridge/JMSBridgeTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/jms/bridge/JMSBridgeTest.java index 9d13e299a8..aa862b4b9d 100644 --- a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/jms/bridge/JMSBridgeTest.java +++ b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/jms/bridge/JMSBridgeTest.java @@ -717,7 +717,7 @@ public class JMSBridgeTest extends BridgeTestBase { Connection connTarget = null; DefaultSensitiveStringCodec codec = new DefaultSensitiveStringCodec(); - Map prop = new HashMap(); + Map prop = new HashMap<>(); prop.put("key", "bridgekey"); codec.init(prop); @@ -942,7 +942,7 @@ public class JMSBridgeTest extends BridgeTestBase { JMSBridgeTest.log.trace("Sending " + NUM_MESSAGES + " messages"); - List ids1 = new ArrayList(); + List ids1 = new ArrayList<>(); Session sessSource = connSource.createSession(false, Session.AUTO_ACKNOWLEDGE); @@ -983,7 +983,7 @@ public class JMSBridgeTest extends BridgeTestBase { connTarget.start(); - List msgs = new ArrayList(); + List msgs = new ArrayList<>(); for (int i = 0; i < NUM_MESSAGES; i++) { TextMessage tm = (TextMessage) cons.receive(5000); @@ -1021,7 +1021,7 @@ public class JMSBridgeTest extends BridgeTestBase { Iterator iter = msgs.iterator(); - List ids2 = new ArrayList(); + List ids2 = new ArrayList<>(); while (iter.hasNext()) { Message msg = iter.next(); diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/jms/ra/MDBMultipleHandlersServerDisconnectTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/jms/ra/MDBMultipleHandlersServerDisconnectTest.java index a240c12517..41f47b55eb 100644 --- a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/jms/ra/MDBMultipleHandlersServerDisconnectTest.java +++ b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/jms/ra/MDBMultipleHandlersServerDisconnectTest.java @@ -64,7 +64,7 @@ import org.junit.Test; */ public class MDBMultipleHandlersServerDisconnectTest extends ActiveMQRATestBase { - final ConcurrentHashMap mapCounter = new ConcurrentHashMap(); + final ConcurrentHashMap mapCounter = new ConcurrentHashMap<>(); volatile ActiveMQResourceAdapter resourceAdapter; @@ -329,7 +329,7 @@ public class MDBMultipleHandlersServerDisconnectTest extends ActiveMQRATestBase } private List lookupServerSessions(String parameter) { - List serverSessions = new LinkedList(); + List serverSessions = new LinkedList<>(); for (ServerSession session : server.getSessions()) { if (session.getMetaData(parameter) != null) { diff --git a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/protocols/hornetq/HornetQProtocolTest.java b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/protocols/hornetq/HornetQProtocolTest.java index 7a33df13a3..29c7677467 100644 --- a/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/protocols/hornetq/HornetQProtocolTest.java +++ b/tests/extra-tests/src/test/java/org/apache/activemq/artemis/tests/extras/protocols/hornetq/HornetQProtocolTest.java @@ -49,7 +49,7 @@ public class HornetQProtocolTest extends ActiveMQTestBase { @Override @Before public void setUp() throws Exception { - HashMap params = new HashMap(); + HashMap params = new HashMap<>(); params.put(org.hornetq.core.remoting.impl.netty.TransportConstants.PORT_PROP_NAME, "" + 5445); params.put(org.hornetq.core.remoting.impl.netty.TransportConstants.PROTOCOLS_PROP_NAME, "HORNETQ"); TransportConfiguration transportConfig = new TransportConfiguration(NETTY_ACCEPTOR_FACTORY, params); @@ -217,7 +217,7 @@ public class HornetQProtocolTest extends ActiveMQTestBase { } private org.hornetq.api.core.client.ClientSession createHQClientSession() throws Exception { - Map map = new HashMap(); + Map map = new HashMap<>(); map.put("host", "localhost"); map.put("port", 5445); @@ -228,7 +228,7 @@ public class HornetQProtocolTest extends ActiveMQTestBase { } private ClientSession createCoreClientSession() throws Exception { - Map map = new HashMap(); + Map map = new HashMap<>(); map.put("host", "localhost"); map.put("port", 61616); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/SimpleNotificationService.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/SimpleNotificationService.java index 626918af1f..2e94aa5920 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/SimpleNotificationService.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/SimpleNotificationService.java @@ -29,7 +29,7 @@ public class SimpleNotificationService implements NotificationService { // Attributes ---------------------------------------------------- - private final List listeners = new ArrayList(); + private final List listeners = new ArrayList<>(); // Static -------------------------------------------------------- @@ -70,7 +70,7 @@ public class SimpleNotificationService implements NotificationService { public static class Listener implements NotificationListener { - private final List notifications = new ArrayList(); + private final List notifications = new ArrayList<>(); @Override public void onNotification(final Notification notification) { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AutoCreateJmsQueueTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AutoCreateJmsQueueTest.java index 11b8da53c7..4c29d6cba7 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AutoCreateJmsQueueTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/AutoCreateJmsQueueTest.java @@ -103,7 +103,7 @@ public class AutoCreateJmsQueueTest extends JMSTestBase { ((ActiveMQJAASSecurityManager) server.getSecurityManager()).getConfiguration().setDefaultUser("guest"); ((ActiveMQJAASSecurityManager) server.getSecurityManager()).getConfiguration().addRole("guest", "rejectAll"); Role role = new Role("rejectAll", false, false, false, false, false, false, false); - Set roles = new HashSet(); + Set roles = new HashSet<>(); roles.add(role); server.getSecurityRepository().addMatch("#", roles); Connection connection = cf.createConnection(); @@ -187,7 +187,7 @@ public class AutoCreateJmsQueueTest extends JMSTestBase { ((ActiveMQJAASSecurityManager) server.getSecurityManager()).getConfiguration().setDefaultUser("guest"); ((ActiveMQJAASSecurityManager) server.getSecurityManager()).getConfiguration().addRole("guest", "allowAll"); Role role = new Role("allowAll", true, true, true, true, true, true, true); - Set roles = new HashSet(); + Set roles = new HashSet<>(); roles.add(role); server.getSecurityRepository().addMatch("#", roles); } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ConsumerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ConsumerTest.java index cf404c89a5..286864428e 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ConsumerTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ConsumerTest.java @@ -373,7 +373,7 @@ public class ConsumerTest extends ActiveMQTestBase { @Test public void testReceiveAndResend() throws Exception { - final Set sessions = new ConcurrentHashSet(); + final Set sessions = new ConcurrentHashSet<>(); final AtomicInteger errors = new AtomicInteger(0); final SimpleString QUEUE_RESPONSE = SimpleString.toSimpleString("QUEUE_RESPONSE"); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ConsumerWindowSizeTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ConsumerWindowSizeTest.java index f68f5a6476..f1b5a1f78e 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ConsumerWindowSizeTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ConsumerWindowSizeTest.java @@ -102,8 +102,8 @@ public class ConsumerWindowSizeTest extends ActiveMQTestBase { int numConsumers = 5; - ArrayList consumers = new ArrayList(); - ArrayList sessions = new ArrayList(); + ArrayList consumers = new ArrayList<>(); + ArrayList sessions = new ArrayList<>(); for (int i = 0; i < numConsumers; i++) { ClientSession session1 = sf.createSession(); ClientConsumer consumer = session1.createConsumer("testWindow"); @@ -205,8 +205,8 @@ public class ConsumerWindowSizeTest extends ActiveMQTestBase { int numConsumers = 5; - ArrayList consumers = new ArrayList(); - ArrayList sessions = new ArrayList(); + ArrayList consumers = new ArrayList<>(); + ArrayList sessions = new ArrayList<>(); for (int i = 0; i < numConsumers; i++) { ClientSession session1 = sf.createSession(); ClientConsumer consumer = session1.createConsumer("testWindow"); @@ -257,8 +257,8 @@ public class ConsumerWindowSizeTest extends ActiveMQTestBase { int numConsumers = 5; - ArrayList consumers = new ArrayList(); - ArrayList sessions = new ArrayList(); + ArrayList consumers = new ArrayList<>(); + ArrayList sessions = new ArrayList<>(); for (int i = 0; i < numConsumers; i++) { ClientSession session1 = sf.createSession(); ClientConsumer consumer = session1.createConsumer("testWindow"); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/DeadLetterAddressTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/DeadLetterAddressTest.java index 89764ba9cb..48580f5ebd 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/DeadLetterAddressTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/DeadLetterAddressTest.java @@ -268,7 +268,7 @@ public class DeadLetterAddressTest extends ActiveMQTestBase { ClientSessionFactory sessionFactory = createSessionFactory(locator); ClientSession sendSession = sessionFactory.createSession(false, true, true); ClientProducer producer = sendSession.createProducer(qName); - Map origIds = new HashMap(); + Map origIds = new HashMap<>(); for (int i = 0; i < NUM_MESSAGES; i++) { ClientMessage tm = createTextMessage(clientSession, "Message:" + i); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/HangConsumerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/HangConsumerTest.java index c38f8a60b3..121972de68 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/HangConsumerTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/HangConsumerTest.java @@ -431,7 +431,7 @@ public class HangConsumerTest extends ActiveMQTestBase { messagesJournal.start(); - LinkedList infos = new LinkedList(); + LinkedList infos = new LinkedList<>(); messagesJournal.load(infos, null, null); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/JmsNettyNioStressTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/JmsNettyNioStressTest.java index dbd4e2444c..b7ea680e11 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/JmsNettyNioStressTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/JmsNettyNioStressTest.java @@ -82,7 +82,7 @@ public class JmsNettyNioStressTest extends ActiveMQTestBase { public void doTestStressSend(final boolean netty) throws Exception { // first set up the server - Map params = new HashMap(); + Map params = new HashMap<>(); params.put(TransportConstants.PORT_PROP_NAME, 61616); params.put(TransportConstants.HOST_PROP_NAME, "localhost"); params.put(TransportConstants.USE_NIO_PROP_NAME, true); @@ -96,7 +96,7 @@ public class JmsNettyNioStressTest extends ActiveMQTestBase { server.start(); // now the client side - Map connectionParams = new HashMap(); + Map connectionParams = new HashMap<>(); connectionParams.put(TransportConstants.PORT_PROP_NAME, 61616); connectionParams.put(TransportConstants.HOST_PROP_NAME, "localhost"); connectionParams.put(TransportConstants.USE_NIO_PROP_NAME, true); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/JournalCrashTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/JournalCrashTest.java index f9e31d0bf1..91ac760be6 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/JournalCrashTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/JournalCrashTest.java @@ -193,8 +193,8 @@ public class JournalCrashTest extends ActiveMQTestBase { NIOSequentialFileFactory factory = new NIOSequentialFileFactory(new File(getJournalDir()), 100); JournalImpl journal = new JournalImpl(ActiveMQDefaultConfiguration.getDefaultJournalFileSize(), 2, 0, 0, factory, "activemq-data", "amq", 100); - ArrayList records = new ArrayList(); - ArrayList transactions = new ArrayList(); + ArrayList records = new ArrayList<>(); + ArrayList transactions = new ArrayList<>(); journal.start(); journal.load(records, transactions, null); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/LargeMessageTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/LargeMessageTest.java index 00841fed26..d99ba63cfc 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/LargeMessageTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/LargeMessageTest.java @@ -1817,7 +1817,7 @@ public class LargeMessageTest extends LargeMessageTestBase { final int PAGE_SIZE = 10 * 1024; - HashMap map = new HashMap(); + HashMap map = new HashMap<>(); AddressSettings value = new AddressSettings(); map.put(ADDRESS.toString(), value); @@ -1944,7 +1944,7 @@ public class LargeMessageTest extends LargeMessageTestBase { final int PAGE_SIZE = 10 * 1024; - HashMap map = new HashMap(); + HashMap map = new HashMap<>(); AddressSettings value = new AddressSettings(); map.put(ADDRESS.toString(), value); @@ -2238,7 +2238,7 @@ public class LargeMessageTest extends LargeMessageTestBase { final int PAGE_SIZE = 10 * 1024; - HashMap map = new HashMap(); + HashMap map = new HashMap<>(); AddressSettings value = new AddressSettings(); map.put(ADDRESS.toString(), value); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MessageConcurrencyTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MessageConcurrencyTest.java index 362f409b8e..c9b146497d 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MessageConcurrencyTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MessageConcurrencyTest.java @@ -67,9 +67,9 @@ public class MessageConcurrencyTest extends ActiveMQTestBase { ClientSession createSession = sf.createSession(); - Set sendSessions = new HashSet(); + Set sendSessions = new HashSet<>(); - Set senders = new HashSet(); + Set senders = new HashSet<>(); final int numSessions = 100; @@ -131,9 +131,9 @@ public class MessageConcurrencyTest extends ActiveMQTestBase { consumeSession.start(); - Set sendSessions = new HashSet(); + Set sendSessions = new HashSet<>(); - final Set senders = new HashSet(); + final Set senders = new HashSet<>(); final int numSessions = 100; @@ -193,7 +193,7 @@ public class MessageConcurrencyTest extends ActiveMQTestBase { private class Sender extends Thread { - private final BlockingQueue queue = new LinkedBlockingQueue(); + private final BlockingQueue queue = new LinkedBlockingQueue<>(); private final ClientProducer producer; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MessageConsumerRollbackTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MessageConsumerRollbackTest.java index 7de970d80b..de9a4ccbb8 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MessageConsumerRollbackTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MessageConsumerRollbackTest.java @@ -112,7 +112,7 @@ public class MessageConsumerRollbackTest extends ActiveMQTestBase { session.start(); - HashSet values = new HashSet(); + HashSet values = new HashSet<>(); for (int i = 0; i < numberOfMessages; i++) { ClientMessage msg = consumer.receive(1000); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MessageGroupingConnectionFactoryTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MessageGroupingConnectionFactoryTest.java index c4356c79c0..f38ea3189d 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MessageGroupingConnectionFactoryTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MessageGroupingConnectionFactoryTest.java @@ -118,7 +118,7 @@ public class MessageGroupingConnectionFactoryTest extends ActiveMQTestBase { private static class DummyMessageHandler implements MessageHandler { - ArrayList list = new ArrayList(); + ArrayList list = new ArrayList<>(); private final CountDownLatch latch; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MessageGroupingTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MessageGroupingTest.java index 4aaaa0b7c0..3da716df81 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MessageGroupingTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/MessageGroupingTest.java @@ -549,7 +549,7 @@ public class MessageGroupingTest extends ActiveMQTestBase { private static class DummyMessageHandler implements MessageHandler { - ArrayList list = new ArrayList(); + ArrayList list = new ArrayList<>(); private CountDownLatch latch; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/NIOvsOIOTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/NIOvsOIOTest.java index 460b581ae6..54d7ca7381 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/NIOvsOIOTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/NIOvsOIOTest.java @@ -78,7 +78,7 @@ public class NIOvsOIOTest extends ActiveMQTestBase { Sender[] senders = new Sender[numSenders]; - List factories = new ArrayList(); + List factories = new ArrayList<>(); ServerLocator locator = createInVMNonHALocator(); @@ -143,7 +143,7 @@ public class NIOvsOIOTest extends ActiveMQTestBase { private void testPerf(boolean nio) throws Exception { Configuration config = createDefaultInVMConfig(); - Map params = new HashMap(); + Map params = new HashMap<>(); params.put(TransportConstants.USE_NIO_PROP_NAME, nio); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/PagingTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/PagingTest.java index f97546a0d0..94a9dbe24a 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/PagingTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/PagingTest.java @@ -111,7 +111,7 @@ public class PagingTest extends ActiveMQTestBase { final int PAGE_SIZE = 10 * 1024; - HashMap map = new HashMap(); + HashMap map = new HashMap<>(); AddressSettings value = new AddressSettings(); map.put(ADDRESS.toString(), value); @@ -829,7 +829,7 @@ public class PagingTest extends ActiveMQTestBase { Pair, List> journalData = loadMessageJournal(config); - HashSet deletedQueueReferences = new HashSet(); + HashSet deletedQueueReferences = new HashSet<>(); for (RecordInfo info : journalData.getA()) { if (info.getUserRecordType() == JournalRecordIds.ADD_REF) { @@ -961,7 +961,7 @@ public class PagingTest extends ActiveMQTestBase { assertEquals(numberOfMessages, getMessageCount(queue)); - LinkedList xids = new LinkedList(); + LinkedList xids = new LinkedList<>(); int msgReceived = 0; for (int i = 0; i < numberOfTX; i++) { @@ -1492,9 +1492,9 @@ public class PagingTest extends ActiveMQTestBase { } } - ArrayList records = new ArrayList(); + ArrayList records = new ArrayList<>(); - List list = new ArrayList(); + List list = new ArrayList<>(); JournalImpl jrn = new JournalImpl(config.getJournalFileSize(), 2, 0, 0, new NIOSequentialFileFactory(server.getConfiguration().getJournalLocation(), 1), "activemq-data", "amq", 1); jrn.start(); @@ -3128,7 +3128,7 @@ public class PagingTest extends ActiveMQTestBase { public void testDropMessages() throws Exception { clearDataRecreateServerDirs(); - HashMap settings = new HashMap(); + HashMap settings = new HashMap<>(); AddressSettings set = new AddressSettings(); set.setAddressFullMessagePolicy(AddressFullMessagePolicy.DROP); @@ -3238,7 +3238,7 @@ public class PagingTest extends ActiveMQTestBase { public void testDropMessagesExpiring() throws Exception { clearDataRecreateServerDirs(); - HashMap settings = new HashMap(); + HashMap settings = new HashMap<>(); AddressSettings set = new AddressSettings(); set.setAddressFullMessagePolicy(AddressFullMessagePolicy.DROP); @@ -3468,7 +3468,7 @@ public class PagingTest extends ActiveMQTestBase { Configuration configuration = createDefaultInVMConfig(); - Map addresses = new HashMap(); + Map addresses = new HashMap<>(); addresses.put("#", new AddressSettings()); @@ -3552,7 +3552,7 @@ public class PagingTest extends ActiveMQTestBase { Configuration configuration = createDefaultInVMConfig(); - Map addresses = new HashMap(); + Map addresses = new HashMap<>(); addresses.put("#", new AddressSettings()); @@ -4122,7 +4122,7 @@ public class PagingTest extends ActiveMQTestBase { Configuration config = createDefaultInVMConfig().setThreadPoolMaxSize(5).setJournalSyncNonTransactional(false); - Map settings = new HashMap(); + Map settings = new HashMap<>(); AddressSettings dla = new AddressSettings().setMaxDeliveryAttempts(5).setDeadLetterAddress(new SimpleString("DLA")); settings.put(ADDRESS.toString(), dla); @@ -4339,7 +4339,7 @@ public class PagingTest extends ActiveMQTestBase { Configuration config = createDefaultInVMConfig().setMessageExpiryScanPeriod(500).setJournalSyncNonTransactional(false); - Map settings = new HashMap(); + Map settings = new HashMap<>(); AddressSettings dla = new AddressSettings().setMaxDeliveryAttempts(5).setDeadLetterAddress(new SimpleString("DLA")).setExpiryAddress(new SimpleString("DLA")); settings.put(ADDRESS.toString(), dla); @@ -4481,7 +4481,7 @@ public class PagingTest extends ActiveMQTestBase { Configuration config = createDefaultInVMConfig(); - HashMap settings = new HashMap(); + HashMap settings = new HashMap<>(); AddressSettings set = new AddressSettings(); set.setAddressFullMessagePolicy(AddressFullMessagePolicy.FAIL); @@ -4563,7 +4563,7 @@ public class PagingTest extends ActiveMQTestBase { Configuration config = createDefaultInVMConfig(); - HashMap settings = new HashMap(); + HashMap settings = new HashMap<>(); AddressSettings set = new AddressSettings(); set.setAddressFullMessagePolicy(AddressFullMessagePolicy.FAIL); @@ -4637,7 +4637,7 @@ public class PagingTest extends ActiveMQTestBase { Configuration config = createDefaultInVMConfig(); - HashMap settings = new HashMap(); + HashMap settings = new HashMap<>(); AddressSettings set = new AddressSettings(); set.setAddressFullMessagePolicy(AddressFullMessagePolicy.FAIL); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ProducerFlowControlTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ProducerFlowControlTest.java index 093206d50a..033f4c1d26 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ProducerFlowControlTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/ProducerFlowControlTest.java @@ -611,7 +611,7 @@ public class ProducerFlowControlTest extends ActiveMQTestBase { ClientProducerCredits credits = null; - List creditsList = new ArrayList(); + List creditsList = new ArrayList<>(); for (int i = 0; i < ClientProducerCreditManagerImpl.MAX_UNREFERENCED_CREDITS_CACHE_SIZE; i++) { ClientProducer prod = session.createProducer("address" + i); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SessionCloseOnGCTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SessionCloseOnGCTest.java index d5a13d98aa..3f25a4779b 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SessionCloseOnGCTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/client/SessionCloseOnGCTest.java @@ -58,8 +58,8 @@ public class SessionCloseOnGCTest extends ActiveMQTestBase { s1.close(); s2.close(); - WeakReference wrs1 = new WeakReference(s1); - WeakReference wrs2 = new WeakReference(s2); + WeakReference wrs1 = new WeakReference<>(s1); + WeakReference wrs2 = new WeakReference<>(s2); s1 = null; s2 = null; @@ -69,7 +69,7 @@ public class SessionCloseOnGCTest extends ActiveMQTestBase { locator = null; ActiveMQTestBase.checkWeakReferences(wrs1, wrs2); - WeakReference fref = new WeakReference(factory); + WeakReference fref = new WeakReference<>(factory); factory.close(); @@ -90,8 +90,8 @@ public class SessionCloseOnGCTest extends ActiveMQTestBase { s1.close(); s2.close(); - WeakReference wrs1 = new WeakReference(s1); - WeakReference wrs2 = new WeakReference(s2); + WeakReference wrs1 = new WeakReference<>(s1); + WeakReference wrs2 = new WeakReference<>(s2); s1 = null; s2 = null; @@ -101,7 +101,7 @@ public class SessionCloseOnGCTest extends ActiveMQTestBase { locator = null; ActiveMQTestBase.checkWeakReferences(wrs1, wrs2); - WeakReference fref = new WeakReference(factory); + WeakReference fref = new WeakReference<>(factory); factory.close(); @@ -120,8 +120,8 @@ public class SessionCloseOnGCTest extends ActiveMQTestBase { s1.close(); s2.close(); - WeakReference wrs1 = new WeakReference(s1); - WeakReference wrs2 = new WeakReference(s2); + WeakReference wrs1 = new WeakReference<>(s1); + WeakReference wrs2 = new WeakReference<>(s2); s1 = null; s2 = null; @@ -131,7 +131,7 @@ public class SessionCloseOnGCTest extends ActiveMQTestBase { locator = null; ActiveMQTestBase.checkWeakReferences(wrs1, wrs2); - WeakReference fref = new WeakReference(factory); + WeakReference fref = new WeakReference<>(factory); factory = null; @@ -145,8 +145,8 @@ public class SessionCloseOnGCTest extends ActiveMQTestBase { ClientSession s1 = factory.createSession(); ClientSession s2 = factory.createSession(); - WeakReference wrs1 = new WeakReference(s1); - WeakReference wrs2 = new WeakReference(s2); + WeakReference wrs1 = new WeakReference<>(s1); + WeakReference wrs2 = new WeakReference<>(s2); s1 = null; s2 = null; @@ -156,7 +156,7 @@ public class SessionCloseOnGCTest extends ActiveMQTestBase { locator = null; ActiveMQTestBase.checkWeakReferences(wrs1, wrs2); - WeakReference fref = new WeakReference(factory); + WeakReference fref = new WeakReference<>(factory); factory = null; @@ -167,7 +167,7 @@ public class SessionCloseOnGCTest extends ActiveMQTestBase { public void testValidateFactoryGC5() throws Exception { ClientSessionFactory factory = locator.createSessionFactory(); - WeakReference fref = new WeakReference(factory); + WeakReference fref = new WeakReference<>(factory); factory = null; @@ -206,9 +206,9 @@ public class SessionCloseOnGCTest extends ActiveMQTestBase { Assert.assertEquals(1, server.getRemotingService().getConnections().size()); - WeakReference ref1 = new WeakReference(session1); - WeakReference ref2 = new WeakReference(session2); - WeakReference ref3 = new WeakReference(session3); + WeakReference ref1 = new WeakReference<>(session1); + WeakReference ref2 = new WeakReference<>(session2); + WeakReference ref3 = new WeakReference<>(session3); session1 = null; session2 = null; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/NodeManagerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/NodeManagerTest.java index c5f091737b..901bfa30fd 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/NodeManagerTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/NodeManagerTest.java @@ -123,7 +123,7 @@ public class NodeManagerTest extends ActiveMQTestBase { public void performWork(NodeManagerAction... actions) throws Exception { NodeManager nodeManager = new InVMNodeManager(false); - List nodeRunners = new ArrayList(); + List nodeRunners = new ArrayList<>(); Thread[] threads = new Thread[actions.length]; for (NodeManagerAction action : actions) { NodeRunner nodeRunner = new NodeRunner(nodeManager, action); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/RealNodeManagerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/RealNodeManagerTest.java index 1696063266..dc7a62e96e 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/RealNodeManagerTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/RealNodeManagerTest.java @@ -43,7 +43,7 @@ public class RealNodeManagerTest extends NodeManagerTest { @Override public void performWork(NodeManagerAction... actions) throws Exception { - List processes = new ArrayList(); + List processes = new ArrayList<>(); for (NodeManagerAction action : actions) { Process p = SpawnedVMSupport.spawnVM(NodeManagerAction.class.getName(), "-Xms512m", "-Xmx512m", new String[0], true, true, action.getWork()); processes.add(p); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeFailoverTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeFailoverTest.java index 9021e2642a..1e2d02ef62 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeFailoverTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeFailoverTest.java @@ -42,7 +42,7 @@ public class BridgeFailoverTest extends MultiServerTestBase { String TARGET_QUEUE = "noCluster.targetQueue"; bridgeConfiguration.setHA(true); - List connectors = new ArrayList(); + List connectors = new ArrayList<>(); connectors.add("target-4"); connectors.add("backup-4"); bridgeConfiguration.setName("Bridge-for-test"); @@ -108,7 +108,7 @@ public class BridgeFailoverTest extends MultiServerTestBase { String TARGET_QUEUE = "noCluster.targetQueue"; bridgeConfiguration.setHA(true); - List connectors = new ArrayList(); + List connectors = new ArrayList<>(); connectors.add("target-4"); connectors.add("backup-4"); bridgeConfiguration.setName("Bridge-for-test"); @@ -213,7 +213,7 @@ public class BridgeFailoverTest extends MultiServerTestBase { String TARGET_QUEUE = "noCluster.targetQueue"; bridgeConfiguration.setHA(true); - List connectors = new ArrayList(); + List connectors = new ArrayList<>(); connectors.add("target-4"); connectors.add("backup-4"); bridgeConfiguration.setName("Bridge-for-test"); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeReconnectTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeReconnectTest.java index c74c5fe1df..e937b26ff0 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeReconnectTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeReconnectTest.java @@ -87,15 +87,15 @@ public class BridgeReconnectTest extends BridgeTestBase { @Before public void setUp() throws Exception { super.setUp(); - server0Params = new HashMap(); - server1Params = new HashMap(); - server2Params = new HashMap(); - connectors = new HashMap(); + server0Params = new HashMap<>(); + server1Params = new HashMap<>(); + server2Params = new HashMap<>(); + connectors = new HashMap<>(); server1 = createActiveMQServer(1, isNetty(), server1Params); server1tc = new TransportConfiguration(getConnector(), server1Params, "server1tc"); connectors.put(server1tc.getName(), server1tc); - staticConnectors = new ArrayList(); + staticConnectors = new ArrayList<>(); staticConnectors.add(server1tc.getName()); } @@ -136,18 +136,18 @@ public class BridgeReconnectTest extends BridgeTestBase { BridgeConfiguration bridgeConfiguration = createBridgeConfig(); bridgeConfiguration.setQueueName(queueName); - List bridgeConfigs = new ArrayList(); + List bridgeConfigs = new ArrayList<>(); bridgeConfigs.add(bridgeConfiguration); server0.getConfiguration().setBridgeConfigurations(bridgeConfigs); server2.getConfiguration().setBridgeConfigurations(bridgeConfigs); CoreQueueConfiguration queueConfig0 = new CoreQueueConfiguration().setAddress(testAddress).setName(queueName); - List queueConfigs0 = new ArrayList(); + List queueConfigs0 = new ArrayList<>(); queueConfigs0.add(queueConfig0); server1.getConfiguration().setQueueConfigurations(queueConfigs0); CoreQueueConfiguration queueConfig1 = new CoreQueueConfiguration().setAddress(forwardAddress).setName(queueName); - List queueConfigs1 = new ArrayList(); + List queueConfigs1 = new ArrayList<>(); queueConfigs1.add(queueConfig1); server0.getConfiguration().setQueueConfigurations(queueConfigs1); server2.getConfiguration().setQueueConfigurations(queueConfigs1); @@ -187,17 +187,17 @@ public class BridgeReconnectTest extends BridgeTestBase { BridgeConfiguration bridgeConfiguration = createBridgeConfig(); - List bridgeConfigs = new ArrayList(); + List bridgeConfigs = new ArrayList<>(); bridgeConfigs.add(bridgeConfiguration); server0.getConfiguration().setBridgeConfigurations(bridgeConfigs); CoreQueueConfiguration queueConfig0 = new CoreQueueConfiguration().setAddress(testAddress).setName(queueName); - List queueConfigs0 = new ArrayList(); + List queueConfigs0 = new ArrayList<>(); queueConfigs0.add(queueConfig0); server0.getConfiguration().setQueueConfigurations(queueConfigs0); CoreQueueConfiguration queueConfig1 = new CoreQueueConfiguration().setAddress(forwardAddress).setName(queueName); - List queueConfigs1 = new ArrayList(); + List queueConfigs1 = new ArrayList<>(); queueConfigs1.add(queueConfig1); server1.getConfiguration().setQueueConfigurations(queueConfigs1); server2.getConfiguration().setQueueConfigurations(queueConfigs1); @@ -268,17 +268,17 @@ public class BridgeReconnectTest extends BridgeTestBase { BridgeConfiguration bridgeConfiguration = createBridgeConfig(); - List bridgeConfigs = new ArrayList(); + List bridgeConfigs = new ArrayList<>(); bridgeConfigs.add(bridgeConfiguration); server0.getConfiguration().setBridgeConfigurations(bridgeConfigs); CoreQueueConfiguration queueConfig0 = new CoreQueueConfiguration().setAddress(testAddress).setName(queueName); - List queueConfigs0 = new ArrayList(); + List queueConfigs0 = new ArrayList<>(); queueConfigs0.add(queueConfig0); server0.getConfiguration().setQueueConfigurations(queueConfigs0); CoreQueueConfiguration queueConfig1 = new CoreQueueConfiguration().setAddress(forwardAddress).setName(queueName); - List queueConfigs1 = new ArrayList(); + List queueConfigs1 = new ArrayList<>(); queueConfigs1.add(queueConfig1); server1.getConfiguration().setQueueConfigurations(queueConfigs1); server2.getConfiguration().setQueueConfigurations(queueConfigs1); @@ -333,17 +333,17 @@ public class BridgeReconnectTest extends BridgeTestBase { BridgeConfiguration bridgeConfiguration = createBridgeConfig(); - List bridgeConfigs = new ArrayList(); + List bridgeConfigs = new ArrayList<>(); bridgeConfigs.add(bridgeConfiguration); server0.getConfiguration().setBridgeConfigurations(bridgeConfigs); CoreQueueConfiguration queueConfig0 = new CoreQueueConfiguration().setAddress(testAddress).setName(queueName); - List queueConfigs0 = new ArrayList(); + List queueConfigs0 = new ArrayList<>(); queueConfigs0.add(queueConfig0); server0.getConfiguration().setQueueConfigurations(queueConfigs0); CoreQueueConfiguration queueConfig1 = new CoreQueueConfiguration().setAddress(forwardAddress).setName(queueName); - List queueConfigs1 = new ArrayList(); + List queueConfigs1 = new ArrayList<>(); queueConfigs1.add(queueConfig1); server1.getConfiguration().setQueueConfigurations(queueConfigs1); @@ -421,17 +421,17 @@ public class BridgeReconnectTest extends BridgeTestBase { BridgeConfiguration bridgeConfiguration = new BridgeConfiguration().setName(bridgeName).setQueueName(queueName).setForwardingAddress(forwardAddress).setClientFailureCheckPeriod(clientFailureCheckPeriod).setRetryInterval(retryInterval).setRetryIntervalMultiplier(retryIntervalMultiplier).setReconnectAttempts(reconnectAttempts).setReconnectAttemptsOnSameNode(0).setConfirmationWindowSize(confirmationWindowSize).setStaticConnectors(staticConnectors).setPassword(CLUSTER_PASSWORD); - List bridgeConfigs = new ArrayList(); + List bridgeConfigs = new ArrayList<>(); bridgeConfigs.add(bridgeConfiguration); server0.getConfiguration().setBridgeConfigurations(bridgeConfigs); CoreQueueConfiguration queueConfig0 = new CoreQueueConfiguration().setAddress(testAddress).setName(queueName); - List queueConfigs0 = new ArrayList(); + List queueConfigs0 = new ArrayList<>(); queueConfigs0.add(queueConfig0); server0.getConfiguration().setQueueConfigurations(queueConfigs0); CoreQueueConfiguration queueConfig1 = new CoreQueueConfiguration().setAddress(forwardAddress).setName(queueName); - List queueConfigs1 = new ArrayList(); + List queueConfigs1 = new ArrayList<>(); queueConfigs1.add(queueConfig1); server1.getConfiguration().setQueueConfigurations(queueConfigs1); startServers(); @@ -526,17 +526,17 @@ public class BridgeReconnectTest extends BridgeTestBase { BridgeConfiguration bridgeConfiguration = createBridgeConfig(); - List bridgeConfigs = new ArrayList(); + List bridgeConfigs = new ArrayList<>(); bridgeConfigs.add(bridgeConfiguration); server0.getConfiguration().setBridgeConfigurations(bridgeConfigs); CoreQueueConfiguration queueConfig0 = new CoreQueueConfiguration().setAddress(testAddress).setName(queueName); - List queueConfigs0 = new ArrayList(); + List queueConfigs0 = new ArrayList<>(); queueConfigs0.add(queueConfig0); server0.getConfiguration().setQueueConfigurations(queueConfigs0); CoreQueueConfiguration queueConfig1 = new CoreQueueConfiguration().setAddress(forwardAddress).setName(queueName); - List queueConfigs1 = new ArrayList(); + List queueConfigs1 = new ArrayList<>(); queueConfigs1.add(queueConfig1); server1.getConfiguration().setQueueConfigurations(queueConfigs1); @@ -628,17 +628,17 @@ public class BridgeReconnectTest extends BridgeTestBase { BridgeConfiguration bridgeConfiguration = createBridgeConfig(); - List bridgeConfigs = new ArrayList(); + List bridgeConfigs = new ArrayList<>(); bridgeConfigs.add(bridgeConfiguration); server0.getConfiguration().setBridgeConfigurations(bridgeConfigs); CoreQueueConfiguration queueConfig0 = new CoreQueueConfiguration().setAddress(testAddress).setName(queueName); - List queueConfigs0 = new ArrayList(); + List queueConfigs0 = new ArrayList<>(); queueConfigs0.add(queueConfig0); server0.getConfiguration().setQueueConfigurations(queueConfigs0); CoreQueueConfiguration queueConfig1 = new CoreQueueConfiguration().setAddress(forwardAddress).setName(queueName); - List queueConfigs1 = new ArrayList(); + List queueConfigs1 = new ArrayList<>(); queueConfigs1.add(queueConfig1); server1.getConfiguration().setQueueConfigurations(queueConfigs1); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeStartTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeStartTest.java index bfc134dcd6..99ece872a3 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeStartTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeStartTest.java @@ -73,10 +73,10 @@ public class BridgeStartTest extends ActiveMQTestBase { @Test public void testStartStop() throws Exception { - Map server0Params = new HashMap(); + Map server0Params = new HashMap<>(); ActiveMQServer server0 = createClusteredServerWithParams(isNetty(), 0, true, server0Params); - Map server1Params = new HashMap(); + Map server1Params = new HashMap<>(); if (isNetty()) { server1Params.put("port", org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants.DEFAULT_PORT + 1); } @@ -91,31 +91,31 @@ public class BridgeStartTest extends ActiveMQTestBase { final String forwardAddress = "forwardAddress"; final String queueName1 = "queue1"; - Map connectors = new HashMap(); + Map connectors = new HashMap<>(); TransportConfiguration server0tc = new TransportConfiguration(getConnector(), server0Params); TransportConfiguration server1tc = new TransportConfiguration(getConnector(), server1Params); connectors.put(server1tc.getName(), server1tc); server0.getConfiguration().setConnectorConfigurations(connectors); - ArrayList staticConnectors = new ArrayList(); + ArrayList staticConnectors = new ArrayList<>(); staticConnectors.add(server1tc.getName()); final String bridgeName = "bridge1"; BridgeConfiguration bridgeConfiguration = new BridgeConfiguration().setName(bridgeName).setQueueName(queueName0).setForwardingAddress(forwardAddress).setRetryInterval(1000).setReconnectAttempts(0).setReconnectAttemptsOnSameNode(0).setConfirmationWindowSize(1024).setStaticConnectors(staticConnectors); - List bridgeConfigs = new ArrayList(); + List bridgeConfigs = new ArrayList<>(); bridgeConfigs.add(bridgeConfiguration); server0.getConfiguration().setBridgeConfigurations(bridgeConfigs); CoreQueueConfiguration queueConfig0 = new CoreQueueConfiguration().setAddress(testAddress).setName(queueName0); - List queueConfigs0 = new ArrayList(); + List queueConfigs0 = new ArrayList<>(); queueConfigs0.add(queueConfig0); server0.getConfiguration().setQueueConfigurations(queueConfigs0); CoreQueueConfiguration queueConfig1 = new CoreQueueConfiguration().setAddress(forwardAddress).setName(queueName1); - List queueConfigs1 = new ArrayList(); + List queueConfigs1 = new ArrayList<>(); queueConfigs1.add(queueConfig1); server1.getConfiguration().setQueueConfigurations(queueConfigs1); @@ -220,10 +220,10 @@ public class BridgeStartTest extends ActiveMQTestBase { // shutdown, messages will get resent when it is started, so the dup id cache needs // to be persisted - Map server0Params = new HashMap(); + Map server0Params = new HashMap<>(); ActiveMQServer server0 = createClusteredServerWithParams(isNetty(), 0, true, server0Params); - Map server1Params = new HashMap(); + Map server1Params = new HashMap<>(); if (isNetty()) { server1Params.put("port", org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants.DEFAULT_PORT + 1); } @@ -237,31 +237,31 @@ public class BridgeStartTest extends ActiveMQTestBase { final String forwardAddress = "forwardAddress"; final String queueName1 = "queue1"; - Map connectors = new HashMap(); + Map connectors = new HashMap<>(); TransportConfiguration server0tc = new TransportConfiguration(getConnector(), server0Params); TransportConfiguration server1tc = new TransportConfiguration(getConnector(), server1Params); connectors.put(server1tc.getName(), server1tc); server0.getConfiguration().setConnectorConfigurations(connectors); - ArrayList staticConnectors = new ArrayList(); + ArrayList staticConnectors = new ArrayList<>(); staticConnectors.add(server1tc.getName()); final String bridgeName = "bridge1"; BridgeConfiguration bridgeConfiguration = new BridgeConfiguration().setName(bridgeName).setQueueName(queueName0).setForwardingAddress(forwardAddress).setRetryInterval(500).setReconnectAttempts(-1).setReconnectAttemptsOnSameNode(0).setConfirmationWindowSize(1024).setStaticConnectors(staticConnectors); - List bridgeConfigs = new ArrayList(); + List bridgeConfigs = new ArrayList<>(); bridgeConfigs.add(bridgeConfiguration); server0.getConfiguration().setBridgeConfigurations(bridgeConfigs); CoreQueueConfiguration queueConfig0 = new CoreQueueConfiguration().setAddress(testAddress).setName(queueName0); - List queueConfigs0 = new ArrayList(); + List queueConfigs0 = new ArrayList<>(); queueConfigs0.add(queueConfig0); server0.getConfiguration().setQueueConfigurations(queueConfigs0); CoreQueueConfiguration queueConfig1 = new CoreQueueConfiguration().setAddress(forwardAddress).setName(queueName1); - List queueConfigs1 = new ArrayList(); + List queueConfigs1 = new ArrayList<>(); queueConfigs1.add(queueConfig1); server1.getConfiguration().setQueueConfigurations(queueConfigs1); ServerLocator locator = null; @@ -406,10 +406,10 @@ public class BridgeStartTest extends ActiveMQTestBase { @Test public void testTargetServerNotAvailableNoReconnectTries() throws Exception { - Map server0Params = new HashMap(); + Map server0Params = new HashMap<>(); ActiveMQServer server0 = createClusteredServerWithParams(isNetty(), 0, false, server0Params); - Map server1Params = new HashMap(); + Map server1Params = new HashMap<>(); if (isNetty()) { server1Params.put("port", org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants.DEFAULT_PORT + 1); } @@ -424,31 +424,31 @@ public class BridgeStartTest extends ActiveMQTestBase { final String queueName1 = "queue1"; ServerLocator locator = null; try { - Map connectors = new HashMap(); + Map connectors = new HashMap<>(); TransportConfiguration server0tc = new TransportConfiguration(getConnector(), server0Params); TransportConfiguration server1tc = new TransportConfiguration(getConnector(), server1Params); connectors.put(server1tc.getName(), server1tc); server0.getConfiguration().setConnectorConfigurations(connectors); - ArrayList staticConnectors = new ArrayList(); + ArrayList staticConnectors = new ArrayList<>(); staticConnectors.add(server1tc.getName()); final String bridgeName = "bridge1"; BridgeConfiguration bridgeConfiguration = new BridgeConfiguration().setName(bridgeName).setQueueName(queueName0).setForwardingAddress(forwardAddress).setRetryInterval(1000).setReconnectAttempts(0).setReconnectAttemptsOnSameNode(0).setUseDuplicateDetection(false).setConfirmationWindowSize(1024).setStaticConnectors(staticConnectors); - List bridgeConfigs = new ArrayList(); + List bridgeConfigs = new ArrayList<>(); bridgeConfigs.add(bridgeConfiguration); server0.getConfiguration().setBridgeConfigurations(bridgeConfigs); CoreQueueConfiguration queueConfig0 = new CoreQueueConfiguration().setAddress(testAddress).setName(queueName0); - List queueConfigs0 = new ArrayList(); + List queueConfigs0 = new ArrayList<>(); queueConfigs0.add(queueConfig0); server0.getConfiguration().setQueueConfigurations(queueConfigs0); CoreQueueConfiguration queueConfig1 = new CoreQueueConfiguration().setAddress(forwardAddress).setName(queueName1); - List queueConfigs1 = new ArrayList(); + List queueConfigs1 = new ArrayList<>(); queueConfigs1.add(queueConfig1); server1.getConfiguration().setQueueConfigurations(queueConfigs1); @@ -538,10 +538,10 @@ public class BridgeStartTest extends ActiveMQTestBase { @Test public void testManualStopStart() throws Exception { - Map server0Params = new HashMap(); + Map server0Params = new HashMap<>(); ActiveMQServer server0 = createClusteredServerWithParams(isNetty(), 0, false, server0Params); - Map server1Params = new HashMap(); + Map server1Params = new HashMap<>(); if (isNetty()) { server1Params.put("port", org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants.DEFAULT_PORT + 1); } @@ -556,31 +556,31 @@ public class BridgeStartTest extends ActiveMQTestBase { final String queueName1 = "queue1"; ServerLocator locator = null; try { - Map connectors = new HashMap(); + Map connectors = new HashMap<>(); TransportConfiguration server0tc = new TransportConfiguration(getConnector(), server0Params); TransportConfiguration server1tc = new TransportConfiguration(getConnector(), server1Params); connectors.put(server1tc.getName(), server1tc); server0.getConfiguration().setConnectorConfigurations(connectors); - ArrayList staticConnectors = new ArrayList(); + ArrayList staticConnectors = new ArrayList<>(); staticConnectors.add(server1tc.getName()); final String bridgeName = "bridge1"; BridgeConfiguration bridgeConfiguration = new BridgeConfiguration().setName(bridgeName).setQueueName(queueName0).setForwardingAddress(forwardAddress).setRetryInterval(1000).setReconnectAttempts(1).setReconnectAttemptsOnSameNode(0).setConfirmationWindowSize(1024).setStaticConnectors(staticConnectors); - List bridgeConfigs = new ArrayList(); + List bridgeConfigs = new ArrayList<>(); bridgeConfigs.add(bridgeConfiguration); server0.getConfiguration().setBridgeConfigurations(bridgeConfigs); CoreQueueConfiguration queueConfig0 = new CoreQueueConfiguration().setAddress(testAddress).setName(queueName0); - List queueConfigs0 = new ArrayList(); + List queueConfigs0 = new ArrayList<>(); queueConfigs0.add(queueConfig0); server0.getConfiguration().setQueueConfigurations(queueConfigs0); CoreQueueConfiguration queueConfig1 = new CoreQueueConfiguration().setAddress(forwardAddress).setName(queueName1); - List queueConfigs1 = new ArrayList(); + List queueConfigs1 = new ArrayList<>(); queueConfigs1.add(queueConfig1); server1.getConfiguration().setQueueConfigurations(queueConfigs1); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeTest.java index f0da131eda..a3c5c6ef79 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeTest.java @@ -140,10 +140,10 @@ public class BridgeTest extends ActiveMQTestBase { @Test public void testLargeMessageBridge() throws Exception { long time = System.currentTimeMillis(); - Map server0Params = new HashMap(); + Map server0Params = new HashMap<>(); server0 = createClusteredServerWithParams(isNetty(), 0, true, server0Params); - Map server1Params = new HashMap(); + Map server1Params = new HashMap<>(); addTargetParameters(server1Params); server1 = createClusteredServerWithParams(isNetty(), 1, true, server1Params); @@ -156,7 +156,7 @@ public class BridgeTest extends ActiveMQTestBase { TransportConfiguration server1tc = new TransportConfiguration(getConnector(), server1Params); - HashMap connectors = new HashMap(); + HashMap connectors = new HashMap<>(); connectors.put(server1tc.getName(), server1tc); server0.getConfiguration().setConnectorConfigurations(connectors); @@ -164,21 +164,21 @@ public class BridgeTest extends ActiveMQTestBase { final int numMessages = 10; - ArrayList connectorConfig = new ArrayList(); + ArrayList connectorConfig = new ArrayList<>(); connectorConfig.add(server1tc.getName()); BridgeConfiguration bridgeConfiguration = new BridgeConfiguration().setName("bridge1").setQueueName(queueName0).setForwardingAddress(forwardAddress).setRetryInterval(1000).setReconnectAttemptsOnSameNode(-1).setUseDuplicateDetection(false).setConfirmationWindowSize(numMessages * messageSize / 2).setStaticConnectors(connectorConfig); - List bridgeConfigs = new ArrayList(); + List bridgeConfigs = new ArrayList<>(); bridgeConfigs.add(bridgeConfiguration); server0.getConfiguration().setBridgeConfigurations(bridgeConfigs); CoreQueueConfiguration queueConfig0 = new CoreQueueConfiguration().setAddress(testAddress).setName(queueName0); - List queueConfigs0 = new ArrayList(); + List queueConfigs0 = new ArrayList<>(); queueConfigs0.add(queueConfig0); server0.getConfiguration().setQueueConfigurations(queueConfigs0); CoreQueueConfiguration queueConfig1 = new CoreQueueConfiguration().setAddress(forwardAddress).setName(queueName1); - List queueConfigs1 = new ArrayList(); + List queueConfigs1 = new ArrayList<>(); queueConfigs1.add(queueConfig1); server1.getConfiguration().setQueueConfigurations(queueConfigs1); @@ -245,10 +245,10 @@ public class BridgeTest extends ActiveMQTestBase { public void internaltestSimpleBridge(final boolean largeMessage, final boolean useFiles) throws Exception { - Map server0Params = new HashMap(); + Map server0Params = new HashMap<>(); server0 = createClusteredServerWithParams(isNetty(), 0, useFiles, server0Params); - Map server1Params = new HashMap(); + Map server1Params = new HashMap<>(); addTargetParameters(server1Params); server1 = createClusteredServerWithParams(isNetty(), 1, useFiles, server1Params); @@ -262,7 +262,7 @@ public class BridgeTest extends ActiveMQTestBase { TransportConfiguration server1tc = new TransportConfiguration(getConnector(), server1Params); - HashMap connectors = new HashMap(); + HashMap connectors = new HashMap<>(); connectors.put(server1tc.getName(), server1tc); server0.getConfiguration().setConnectorConfigurations(connectors); @@ -270,21 +270,21 @@ public class BridgeTest extends ActiveMQTestBase { final int numMessages = 10; - ArrayList connectorConfig = new ArrayList(); + ArrayList connectorConfig = new ArrayList<>(); connectorConfig.add(server1tc.getName()); BridgeConfiguration bridgeConfiguration = new BridgeConfiguration().setName("bridge1").setQueueName(queueName0).setForwardingAddress(forwardAddress).setRetryInterval(1000).setReconnectAttemptsOnSameNode(-1).setUseDuplicateDetection(false).setConfirmationWindowSize(numMessages * messageSize / 2).setStaticConnectors(connectorConfig); - List bridgeConfigs = new ArrayList(); + List bridgeConfigs = new ArrayList<>(); bridgeConfigs.add(bridgeConfiguration); server0.getConfiguration().setBridgeConfigurations(bridgeConfigs); CoreQueueConfiguration queueConfig0 = new CoreQueueConfiguration().setAddress(testAddress).setName(queueName0); - List queueConfigs0 = new ArrayList(); + List queueConfigs0 = new ArrayList<>(); queueConfigs0.add(queueConfig0); server0.getConfiguration().setQueueConfigurations(queueConfigs0); CoreQueueConfiguration queueConfig1 = new CoreQueueConfiguration().setAddress(forwardAddress).setName(queueName1); - List queueConfigs1 = new ArrayList(); + List queueConfigs1 = new ArrayList<>(); queueConfigs1.add(queueConfig1); server1.getConfiguration().setQueueConfigurations(queueConfigs1); @@ -397,10 +397,10 @@ public class BridgeTest extends ActiveMQTestBase { MyInterceptor myInterceptor = new MyInterceptor(3); - Map server0Params = new HashMap(); + Map server0Params = new HashMap<>(); server0 = createClusteredServerWithParams(isNetty(), 0, true, server0Params); - Map server1Params = new HashMap(); + Map server1Params = new HashMap<>(); addTargetParameters(server1Params); server1 = createClusteredServerWithParams(isNetty(), 1, true, server1Params); @@ -412,7 +412,7 @@ public class BridgeTest extends ActiveMQTestBase { TransportConfiguration server0tc = new TransportConfiguration(getConnector(), server0Params); TransportConfiguration server1tc = new TransportConfiguration(getConnector(), server1Params); - HashMap connectors = new HashMap(); + HashMap connectors = new HashMap<>(); connectors.put(server1tc.getName(), server1tc); server0.getConfiguration().setConnectorConfigurations(connectors); @@ -420,21 +420,21 @@ public class BridgeTest extends ActiveMQTestBase { final int numMessages = 1; - ArrayList connectorConfig = new ArrayList(); + ArrayList connectorConfig = new ArrayList<>(); connectorConfig.add(server1tc.getName()); BridgeConfiguration bridgeConfiguration = new BridgeConfiguration().setName("bridge1").setQueueName(queueName0).setForwardingAddress(forwardAddress).setRetryInterval(100).setReconnectAttempts(-1).setReconnectAttemptsOnSameNode(-1).setUseDuplicateDetection(false).setConfirmationWindowSize(numMessages * messageSize / 2).setStaticConnectors(connectorConfig).setCallTimeout(500); - List bridgeConfigs = new ArrayList(); + List bridgeConfigs = new ArrayList<>(); bridgeConfigs.add(bridgeConfiguration); server0.getConfiguration().setBridgeConfigurations(bridgeConfigs); CoreQueueConfiguration queueConfig0 = new CoreQueueConfiguration().setAddress(testAddress).setName(queueName0); - List queueConfigs0 = new ArrayList(); + List queueConfigs0 = new ArrayList<>(); queueConfigs0.add(queueConfig0); server0.getConfiguration().setQueueConfigurations(queueConfigs0); CoreQueueConfiguration queueConfig1 = new CoreQueueConfiguration().setAddress(forwardAddress).setName(queueName1); - List queueConfigs1 = new ArrayList(); + List queueConfigs1 = new ArrayList<>(); queueConfigs1.add(queueConfig1); server1.getConfiguration().setQueueConfigurations(queueConfigs1); @@ -555,10 +555,10 @@ public class BridgeTest extends ActiveMQTestBase { final int numMessages = 10; - Map server0Params = new HashMap(); + Map server0Params = new HashMap<>(); server0 = createClusteredServerWithParams(isNetty(), 0, useFiles, server0Params); - Map server1Params = new HashMap(); + Map server1Params = new HashMap<>(); addTargetParameters(server1Params); server1 = createClusteredServerWithParams(isNetty(), 1, useFiles, server1Params); @@ -567,7 +567,7 @@ public class BridgeTest extends ActiveMQTestBase { final String forwardAddress = "forwardAddress"; final String queueName1 = "queue1"; - Map connectors = new HashMap(); + Map connectors = new HashMap<>(); TransportConfiguration server0tc = new TransportConfiguration(getConnector(), server0Params); TransportConfiguration server1tc = new TransportConfiguration(getConnector(), server1Params); connectors.put(server1tc.getName(), server1tc); @@ -576,21 +576,21 @@ public class BridgeTest extends ActiveMQTestBase { final String filterString = "animal='goat'"; - ArrayList staticConnectors = new ArrayList(); + ArrayList staticConnectors = new ArrayList<>(); staticConnectors.add(server1tc.getName()); BridgeConfiguration bridgeConfiguration = new BridgeConfiguration().setName("bridge1").setQueueName(queueName0).setForwardingAddress(forwardAddress).setFilterString(filterString).setRetryInterval(1000).setReconnectAttemptsOnSameNode(-1).setUseDuplicateDetection(false).setConfirmationWindowSize(0).setStaticConnectors(staticConnectors); - List bridgeConfigs = new ArrayList(); + List bridgeConfigs = new ArrayList<>(); bridgeConfigs.add(bridgeConfiguration); server0.getConfiguration().setBridgeConfigurations(bridgeConfigs); CoreQueueConfiguration queueConfig0 = new CoreQueueConfiguration().setAddress(testAddress).setName(queueName0); - List queueConfigs0 = new ArrayList(); + List queueConfigs0 = new ArrayList<>(); queueConfigs0.add(queueConfig0); server0.getConfiguration().setQueueConfigurations(queueConfigs0); CoreQueueConfiguration queueConfig1 = new CoreQueueConfiguration().setAddress(forwardAddress).setName(queueName1); - List queueConfigs1 = new ArrayList(); + List queueConfigs1 = new ArrayList<>(); queueConfigs1.add(queueConfig1); server1.getConfiguration().setQueueConfigurations(queueConfigs1); @@ -691,10 +691,10 @@ public class BridgeTest extends ActiveMQTestBase { // Created to verify JBPAPP-6057 @Test public void testStartLater() throws Exception { - Map server0Params = new HashMap(); + Map server0Params = new HashMap<>(); server0 = createClusteredServerWithParams(isNetty(), 0, true, server0Params); - Map server1Params = new HashMap(); + Map server1Params = new HashMap<>(); addTargetParameters(server1Params); server1 = createClusteredServerWithParams(isNetty(), 1, true, server1Params); @@ -703,23 +703,23 @@ public class BridgeTest extends ActiveMQTestBase { final String forwardAddress = "jms.queue.forwardAddress"; final String queueName1 = "forwardAddress"; - Map connectors = new HashMap(); + Map connectors = new HashMap<>(); TransportConfiguration server0tc = new TransportConfiguration(getConnector(), server0Params); TransportConfiguration server1tc = new TransportConfiguration(getConnector(), server1Params); connectors.put(server1tc.getName(), server1tc); server0.getConfiguration().setConnectorConfigurations(connectors); - ArrayList staticConnectors = new ArrayList(); + ArrayList staticConnectors = new ArrayList<>(); staticConnectors.add(server1tc.getName()); BridgeConfiguration bridgeConfiguration = new BridgeConfiguration().setName("bridge1").setQueueName(queueName0).setForwardingAddress(forwardAddress).setRetryInterval(100).setReconnectAttemptsOnSameNode(-1).setUseDuplicateDetection(false).setConfirmationWindowSize(1024).setStaticConnectors(staticConnectors); - List bridgeConfigs = new ArrayList(); + List bridgeConfigs = new ArrayList<>(); bridgeConfigs.add(bridgeConfiguration); server0.getConfiguration().setBridgeConfigurations(bridgeConfigs); CoreQueueConfiguration queueConfig0 = new CoreQueueConfiguration().setAddress(testAddress).setName(queueName0); - List queueConfigs0 = new ArrayList(); + List queueConfigs0 = new ArrayList<>(); queueConfigs0.add(queueConfig0); server0.getConfiguration().setQueueConfigurations(queueConfigs0); @@ -799,10 +799,10 @@ public class BridgeTest extends ActiveMQTestBase { @Test public void testWithDuplicates() throws Exception { - Map server0Params = new HashMap(); + Map server0Params = new HashMap<>(); server0 = createClusteredServerWithParams(isNetty(), 0, true, server0Params); - Map server1Params = new HashMap(); + Map server1Params = new HashMap<>(); addTargetParameters(server1Params); server1 = createClusteredServerWithParams(isNetty(), 1, true, server1Params); @@ -811,23 +811,23 @@ public class BridgeTest extends ActiveMQTestBase { final String forwardAddress = "jms.queue.forwardAddress"; final String queueName1 = "forwardAddress"; - Map connectors = new HashMap(); + Map connectors = new HashMap<>(); TransportConfiguration server0tc = new TransportConfiguration(getConnector(), server0Params); TransportConfiguration server1tc = new TransportConfiguration(getConnector(), server1Params); connectors.put(server1tc.getName(), server1tc); server0.getConfiguration().setConnectorConfigurations(connectors); - ArrayList staticConnectors = new ArrayList(); + ArrayList staticConnectors = new ArrayList<>(); staticConnectors.add(server1tc.getName()); BridgeConfiguration bridgeConfiguration = new BridgeConfiguration().setName("bridge1").setQueueName(queueName0).setForwardingAddress(forwardAddress).setRetryInterval(100).setReconnectAttemptsOnSameNode(-1).setConfirmationWindowSize(0).setStaticConnectors(staticConnectors); - List bridgeConfigs = new ArrayList(); + List bridgeConfigs = new ArrayList<>(); bridgeConfigs.add(bridgeConfiguration); server0.getConfiguration().setBridgeConfigurations(bridgeConfigs); CoreQueueConfiguration queueConfig0 = new CoreQueueConfiguration().setAddress(testAddress).setName(queueName0); - List queueConfigs0 = new ArrayList(); + List queueConfigs0 = new ArrayList<>(); queueConfigs0.add(queueConfig0); server0.getConfiguration().setQueueConfigurations(queueConfigs0); @@ -948,10 +948,10 @@ public class BridgeTest extends ActiveMQTestBase { } public void internaltestWithTransformer(final boolean useFiles) throws Exception { - Map server0Params = new HashMap(); + Map server0Params = new HashMap<>(); server0 = createClusteredServerWithParams(isNetty(), 0, false, server0Params); - Map server1Params = new HashMap(); + Map server1Params = new HashMap<>(); addTargetParameters(server1Params); server1 = createClusteredServerWithParams(isNetty(), 1, false, server1Params); @@ -960,29 +960,29 @@ public class BridgeTest extends ActiveMQTestBase { final String forwardAddress = "forwardAddress"; final String queueName1 = "queue1"; - Map connectors = new HashMap(); + Map connectors = new HashMap<>(); TransportConfiguration server0tc = new TransportConfiguration(getConnector(), server0Params); TransportConfiguration server1tc = new TransportConfiguration(getConnector(), server1Params); connectors.put(server1tc.getName(), server1tc); server0.getConfiguration().setConnectorConfigurations(connectors); - ArrayList staticConnectors = new ArrayList(); + ArrayList staticConnectors = new ArrayList<>(); staticConnectors.add(server1tc.getName()); BridgeConfiguration bridgeConfiguration = new BridgeConfiguration().setName("bridge1").setQueueName(queueName0).setForwardingAddress(forwardAddress).setTransformerClassName(SimpleTransformer.class.getName()).setRetryInterval(1000).setReconnectAttemptsOnSameNode(-1).setUseDuplicateDetection(false).setConfirmationWindowSize(1024).setStaticConnectors(staticConnectors); - List bridgeConfigs = new ArrayList(); + List bridgeConfigs = new ArrayList<>(); bridgeConfigs.add(bridgeConfiguration); server0.getConfiguration().setBridgeConfigurations(bridgeConfigs); CoreQueueConfiguration queueConfig0 = new CoreQueueConfiguration().setAddress(testAddress).setName(queueName0); - List queueConfigs0 = new ArrayList(); + List queueConfigs0 = new ArrayList<>(); queueConfigs0.add(queueConfig0); server0.getConfiguration().setQueueConfigurations(queueConfigs0); CoreQueueConfiguration queueConfig1 = new CoreQueueConfiguration().setAddress(forwardAddress).setName(queueName1); - List queueConfigs1 = new ArrayList(); + List queueConfigs1 = new ArrayList<>(); queueConfigs1.add(queueConfig1); server1.getConfiguration().setQueueConfigurations(queueConfigs1); @@ -1052,11 +1052,11 @@ public class BridgeTest extends ActiveMQTestBase { @Test public void testSawtoothLoad() throws Exception { - Map server0Params = new HashMap(); + Map server0Params = new HashMap<>(); ActiveMQServer server0 = createClusteredServerWithParams(isNetty(), 0, true, server0Params); server0.getConfiguration().setThreadPoolMaxSize(10); - Map server1Params = new HashMap(); + Map server1Params = new HashMap<>(); addTargetParameters(server1Params); ActiveMQServer server1 = createClusteredServerWithParams(isNetty(), 1, true, server1Params); server1.getConfiguration().setThreadPoolMaxSize(10); @@ -1066,29 +1066,29 @@ public class BridgeTest extends ActiveMQTestBase { final String forwardAddress = "forwardAddress"; final String queueName1 = "queue1"; - Map connectors = new HashMap(); + Map connectors = new HashMap<>(); final TransportConfiguration server0tc = new TransportConfiguration(getConnector(), server0Params); final TransportConfiguration server1tc = new TransportConfiguration(getConnector(), server1Params); connectors.put(server1tc.getName(), server1tc); server0.getConfiguration().setConnectorConfigurations(connectors); - ArrayList staticConnectors = new ArrayList(); + ArrayList staticConnectors = new ArrayList<>(); staticConnectors.add(server1tc.getName()); BridgeConfiguration bridgeConfiguration = new BridgeConfiguration().setName("bridge1").setQueueName(queueName0).setForwardingAddress(forwardAddress).setRetryInterval(1000).setReconnectAttemptsOnSameNode(-1).setUseDuplicateDetection(false).setConfirmationWindowSize(0).setStaticConnectors(staticConnectors); - List bridgeConfigs = new ArrayList(); + List bridgeConfigs = new ArrayList<>(); bridgeConfigs.add(bridgeConfiguration); server0.getConfiguration().setBridgeConfigurations(bridgeConfigs); CoreQueueConfiguration queueConfig0 = new CoreQueueConfiguration().setAddress(testAddress).setName(queueName0); - List queueConfigs0 = new ArrayList(); + List queueConfigs0 = new ArrayList<>(); queueConfigs0.add(queueConfig0); server0.getConfiguration().setQueueConfigurations(queueConfigs0); CoreQueueConfiguration queueConfig1 = new CoreQueueConfiguration().setAddress(forwardAddress).setName(queueName1); - List queueConfigs1 = new ArrayList(); + List queueConfigs1 = new ArrayList<>(); queueConfigs1.add(queueConfig1); server1.getConfiguration().setQueueConfigurations(queueConfigs1); @@ -1210,7 +1210,7 @@ public class BridgeTest extends ActiveMQTestBase { } for (int repeat = 0; repeat < totalrepeats; repeat++) { - ArrayList threads = new ArrayList(); + ArrayList threads = new ArrayList<>(); threads.add(new ConsumerThread()); threads.add(new ProducerThread(numMessages / 2)); @@ -1257,10 +1257,10 @@ public class BridgeTest extends ActiveMQTestBase { final int PAGE_SIZE = 1 * 1024; try { - Map server0Params = new HashMap(); + Map server0Params = new HashMap<>(); server0 = createClusteredServerWithParams(isNetty(), 0, true, PAGE_SIZE, PAGE_MAX, server0Params); - Map server1Params = new HashMap(); + Map server1Params = new HashMap<>(); addTargetParameters(server1Params); server1 = createClusteredServerWithParams(isNetty(), 1, true, PAGE_SIZE, PAGE_MAX, server1Params); server1.getConfiguration().setJournalBufferTimeout_AIO(10).setJournalBufferTimeout_NIO(10); @@ -1270,7 +1270,7 @@ public class BridgeTest extends ActiveMQTestBase { final String forwardAddress = "forwardAddress"; final String queueName1 = "queue1"; - Map connectors = new HashMap(); + Map connectors = new HashMap<>(); TransportConfiguration server0tc = new TransportConfiguration(getConnector(), server0Params); TransportConfiguration server1tc = new TransportConfiguration(getConnector(), server1Params); @@ -1280,7 +1280,7 @@ public class BridgeTest extends ActiveMQTestBase { server0.getConfiguration().setIDCacheSize(20000).setJournalBufferTimeout_NIO(10).setJournalBufferTimeout_AIO(10); - ArrayList staticConnectors = new ArrayList(); + ArrayList staticConnectors = new ArrayList<>(); staticConnectors.add(server1tc.getName()); BridgeConfiguration bridgeConfiguration = new BridgeConfiguration().setName("bridge1").setQueueName(queueName0).setForwardingAddress(forwardAddress).setRetryInterval(1).setReconnectAttemptsOnSameNode(-1).setUseDuplicateDetection(false).setConfirmationWindowSize(1).setStaticConnectors(staticConnectors); @@ -1289,21 +1289,21 @@ public class BridgeTest extends ActiveMQTestBase { bridgeConfiguration.setUseDuplicateDetection(true); - List bridgeConfigs = new ArrayList(); + List bridgeConfigs = new ArrayList<>(); bridgeConfigs.add(bridgeConfiguration); server0.getConfiguration().setBridgeConfigurations(bridgeConfigs); CoreQueueConfiguration queueConfig0 = new CoreQueueConfiguration().setAddress(testAddress).setName(queueName0); - List queueConfigs0 = new ArrayList(); + List queueConfigs0 = new ArrayList<>(); queueConfigs0.add(queueConfig0); server0.getConfiguration().setQueueConfigurations(queueConfigs0); CoreQueueConfiguration queueConfig1 = new CoreQueueConfiguration().setAddress(forwardAddress).setName(queueName1); - List queueConfigs1 = new ArrayList(); + List queueConfigs1 = new ArrayList<>(); queueConfigs1.add(queueConfig1); server1.getConfiguration().setQueueConfigurations(queueConfigs1); - List interceptorToStop = new ArrayList(); + List interceptorToStop = new ArrayList<>(); interceptorToStop.add(StopInterceptor.class.getName()); server1.getConfiguration().setIncomingInterceptorClassNames(interceptorToStop); @@ -1354,7 +1354,7 @@ public class BridgeTest extends ActiveMQTestBase { // Restarting the server server0.start(); - HashMap receivedMsg = new HashMap(); + HashMap receivedMsg = new HashMap<>(); for (int i = 0; i < numMessages; i++) { ClientMessage message = consumer1.receive(5000); @@ -1498,10 +1498,10 @@ public class BridgeTest extends ActiveMQTestBase { ServerLocator locator = null; try { - Map server0Params = new HashMap(); + Map server0Params = new HashMap<>(); server0 = createClusteredServerWithParams(isNetty(), 0, true, PAGE_SIZE, PAGE_MAX, server0Params); - Map server1Params = new HashMap(); + Map server1Params = new HashMap<>(); addTargetParameters(server1Params); server1 = createClusteredServerWithParams(isNetty(), 1, true, server1Params); @@ -1510,7 +1510,7 @@ public class BridgeTest extends ActiveMQTestBase { final String forwardAddress = "forwardAddress"; final String queueName1 = "queue1"; - Map connectors = new HashMap(); + Map connectors = new HashMap<>(); TransportConfiguration server0tc = new TransportConfiguration(getConnector(), server0Params); TransportConfiguration server1tc = new TransportConfiguration(getConnector(), server1Params); @@ -1518,22 +1518,22 @@ public class BridgeTest extends ActiveMQTestBase { server0.getConfiguration().setConnectorConfigurations(connectors); - ArrayList staticConnectors = new ArrayList(); + ArrayList staticConnectors = new ArrayList<>(); staticConnectors.add(server1tc.getName()); BridgeConfiguration bridgeConfiguration = new BridgeConfiguration().setName("bridge1").setQueueName(queueName0).setForwardingAddress(forwardAddress).setRetryInterval(1000).setReconnectAttemptsOnSameNode(-1).setUseDuplicateDetection(false).setConfirmationWindowSize(1024).setStaticConnectors(staticConnectors); - List bridgeConfigs = new ArrayList(); + List bridgeConfigs = new ArrayList<>(); bridgeConfigs.add(bridgeConfiguration); server0.getConfiguration().setBridgeConfigurations(bridgeConfigs); CoreQueueConfiguration queueConfig0 = new CoreQueueConfiguration().setAddress(testAddress).setName(queueName0); - List queueConfigs0 = new ArrayList(); + List queueConfigs0 = new ArrayList<>(); queueConfigs0.add(queueConfig0); server0.getConfiguration().setQueueConfigurations(queueConfigs0); CoreQueueConfiguration queueConfig1 = new CoreQueueConfiguration().setAddress(forwardAddress).setName(queueName1); - List queueConfigs1 = new ArrayList(); + List queueConfigs1 = new ArrayList<>(); queueConfigs1.add(queueConfig1); server1.getConfiguration().setQueueConfigurations(queueConfigs1); @@ -1622,10 +1622,10 @@ public class BridgeTest extends ActiveMQTestBase { @Test public void testNullForwardingAddress() throws Exception { - Map server0Params = new HashMap(); + Map server0Params = new HashMap<>(); server0 = createClusteredServerWithParams(isNetty(), 0, false, server0Params); - Map server1Params = new HashMap(); + Map server1Params = new HashMap<>(); addTargetParameters(server1Params); server1 = createClusteredServerWithParams(isNetty(), 1, false, server1Params); @@ -1633,7 +1633,7 @@ public class BridgeTest extends ActiveMQTestBase { final String queueName0 = "queue0"; final String queueName1 = "queue1"; - Map connectors = new HashMap(); + Map connectors = new HashMap<>(); TransportConfiguration server0tc = new TransportConfiguration(getConnector(), server0Params); TransportConfiguration server1tc = new TransportConfiguration(getConnector(), server1Params); @@ -1645,23 +1645,23 @@ public class BridgeTest extends ActiveMQTestBase { final int numMessages = 10; - ArrayList staticConnectors = new ArrayList(); + ArrayList staticConnectors = new ArrayList<>(); staticConnectors.add(server1tc.getName()); // do not set forwarding address (defaults to null) to use messages' original address BridgeConfiguration bridgeConfiguration = new BridgeConfiguration().setName("bridge1").setQueueName(queueName0).setRetryInterval(1000).setReconnectAttemptsOnSameNode(-1).setUseDuplicateDetection(false).setConfirmationWindowSize(numMessages * messageSize / 2).setStaticConnectors(staticConnectors); - List bridgeConfigs = new ArrayList(); + List bridgeConfigs = new ArrayList<>(); bridgeConfigs.add(bridgeConfiguration); server0.getConfiguration().setBridgeConfigurations(bridgeConfigs); CoreQueueConfiguration queueConfig0 = new CoreQueueConfiguration().setAddress(testAddress).setName(queueName0); - List queueConfigs0 = new ArrayList(); + List queueConfigs0 = new ArrayList<>(); queueConfigs0.add(queueConfig0); server0.getConfiguration().setQueueConfigurations(queueConfigs0); // on server #1, we bind queueName1 to same address testAddress CoreQueueConfiguration queueConfig1 = new CoreQueueConfiguration().setAddress(testAddress).setName(queueName1); - List queueConfigs1 = new ArrayList(); + List queueConfigs1 = new ArrayList<>(); queueConfigs1.add(queueConfig1); server1.getConfiguration().setQueueConfigurations(queueConfigs1); @@ -1757,15 +1757,15 @@ public class BridgeTest extends ActiveMQTestBase { SequentialFileFactory messagesFF = new NIOSequentialFileFactory(serverToInvestigate.getConfiguration().getJournalLocation(), 1); JournalImpl messagesJournal = new JournalImpl(serverToInvestigate.getConfiguration().getJournalFileSize(), serverToInvestigate.getConfiguration().getJournalMinFiles(), 0, 0, messagesFF, "activemq-data", "amq", 1); - List records = new LinkedList(); + List records = new LinkedList<>(); - List preparedTransactions = new LinkedList(); + List preparedTransactions = new LinkedList<>(); messagesJournal.start(); messagesJournal.load(records, preparedTransactions, null); // These are more immutable integers - Map messageRefCounts = new HashMap(); + Map messageRefCounts = new HashMap<>(); for (RecordInfo info : records) { Object o = DescribeJournal.newObjectEncoding(info); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeWithDiscoveryGroupStartTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeWithDiscoveryGroupStartTest.java index e65ec9962a..b09d355dad 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeWithDiscoveryGroupStartTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/bridge/BridgeWithDiscoveryGroupStartTest.java @@ -70,10 +70,10 @@ public class BridgeWithDiscoveryGroupStartTest extends ActiveMQTestBase { @Test public void testStartStop() throws Exception { - Map server0Params = new HashMap(); + Map server0Params = new HashMap<>(); ActiveMQServer server0 = createClusteredServerWithParams(isNetty(), 0, true, server0Params); - Map server1Params = new HashMap(); + Map server1Params = new HashMap<>(); if (isNetty()) { server1Params.put("port", TransportConstants.DEFAULT_PORT + 1); } @@ -83,7 +83,7 @@ public class BridgeWithDiscoveryGroupStartTest extends ActiveMQTestBase { ActiveMQServer server1 = createClusteredServerWithParams(isNetty(), 1, true, server1Params); ServerLocator locator = null; try { - Map connectors = new HashMap(); + Map connectors = new HashMap<>(); TransportConfiguration server0tc = new TransportConfiguration(getConnector(), server0Params); TransportConfiguration server1tc = new TransportConfiguration(getConnector(), server1Params); connectors.put(server1tc.getName(), server1tc); @@ -98,7 +98,7 @@ public class BridgeWithDiscoveryGroupStartTest extends ActiveMQTestBase { final String groupAddress = getUDPDiscoveryAddress(); final int port = getUDPDiscoveryPort(); - ArrayList list = new ArrayList(); + ArrayList list = new ArrayList<>(); list.add(server1tc.getName()); UDPBroadcastEndpointFactory endpoint = new UDPBroadcastEndpointFactory().setGroupAddress(groupAddress).setGroupPort(port); @@ -113,21 +113,21 @@ public class BridgeWithDiscoveryGroupStartTest extends ActiveMQTestBase { final String bridgeName = "bridge1"; - ArrayList staticConnectors = new ArrayList(); + ArrayList staticConnectors = new ArrayList<>(); staticConnectors.add(server1tc.getName()); BridgeConfiguration bridgeConfiguration = new BridgeConfiguration().setName(bridgeName).setQueueName(queueName0).setForwardingAddress(forwardAddress).setRetryInterval(1000).setReconnectAttempts(0).setReconnectAttemptsOnSameNode(0).setConfirmationWindowSize(1024).setStaticConnectors(staticConnectors); - List bridgeConfigs = new ArrayList(); + List bridgeConfigs = new ArrayList<>(); bridgeConfigs.add(bridgeConfiguration); server0.getConfiguration().setBridgeConfigurations(bridgeConfigs); CoreQueueConfiguration queueConfig0 = new CoreQueueConfiguration().setAddress(testAddress).setName(queueName0); - List queueConfigs0 = new ArrayList(); + List queueConfigs0 = new ArrayList<>(); queueConfigs0.add(queueConfig0); server0.getConfiguration().setQueueConfigurations(queueConfigs0); CoreQueueConfiguration queueConfig1 = new CoreQueueConfiguration().setAddress(forwardAddress).setName(queueName1); - List queueConfigs1 = new ArrayList(); + List queueConfigs1 = new ArrayList<>(); queueConfigs1.add(queueConfig1); server1.getConfiguration().setQueueConfigurations(queueConfigs1); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusterTestBase.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusterTestBase.java index d6b836b069..7c3be5e58f 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusterTestBase.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusterTestBase.java @@ -825,7 +825,7 @@ public abstract class ClusterTestBase extends ActiveMQTestBase { final int msgStart, final int msgEnd, final int... consumerIDs) throws Exception { - HashMap groupIdsReceived = new HashMap(); + HashMap groupIdsReceived = new HashMap<>(); for (int i = 0; i < consumerIDs.length; i++) { ConsumerHolder holder = consumers[consumerIDs[i]]; @@ -1096,7 +1096,7 @@ public abstract class ClusterTestBase extends ActiveMQTestBase { // First get one from each consumer to determine the order, then we sort them in this order - List sorted = new ArrayList(); + List sorted = new ArrayList<>(); for (int consumerID : consumerIDs) { ConsumerHolder holder = consumers[consumerID]; @@ -1167,9 +1167,9 @@ public abstract class ClusterTestBase extends ActiveMQTestBase { protected void verifyReceiveRoundRobinInSomeOrderWithCounts(final boolean ack, final int[] messageCounts, final int... consumerIDs) throws Exception { - List> receivedCounts = new ArrayList>(); + List> receivedCounts = new ArrayList<>(); - Set counts = new HashSet(); + Set counts = new HashSet<>(); for (int consumerID : consumerIDs) { ConsumerHolder holder = consumers[consumerID]; @@ -1178,7 +1178,7 @@ public abstract class ClusterTestBase extends ActiveMQTestBase { throw new IllegalArgumentException("No consumer at " + consumerID); } - LinkedList list = new LinkedList(); + LinkedList list = new LinkedList<>(); receivedCounts.add(list); @@ -1275,7 +1275,7 @@ public abstract class ClusterTestBase extends ActiveMQTestBase { throw new IllegalArgumentException("No consumer at " + consumerID); } - List ints = new ArrayList(); + List ints = new ArrayList<>(); ClientMessage message = null; @@ -1539,7 +1539,7 @@ public abstract class ClusterTestBase extends ActiveMQTestBase { TransportConfiguration connector = createTransportConfiguration(netty, false, params); - List connectorPairs = new ArrayList(); + List connectorPairs = new ArrayList<>(); connectorPairs.add(connector.getName()); UDPBroadcastEndpointFactory endpoint = new UDPBroadcastEndpointFactory().setGroupAddress(groupAddress).setGroupPort(port); @@ -1587,7 +1587,7 @@ public abstract class ClusterTestBase extends ActiveMQTestBase { TransportConfiguration connector = createTransportConfiguration(netty, false, params); - List connectorPairs = new ArrayList(); + List connectorPairs = new ArrayList<>(); connectorPairs.add(connector.getName()); UDPBroadcastEndpointFactory endpoint = new UDPBroadcastEndpointFactory().setGroupAddress(groupAddress).setGroupPort(port); @@ -1647,7 +1647,7 @@ public abstract class ClusterTestBase extends ActiveMQTestBase { if (nodeTo != -1) { TransportConfiguration serverTotc = createTransportConfiguration(netty, false, generateParams(nodeTo, netty)); serverFrom.getConfiguration().getConnectorConfigurations().put(serverTotc.getName(), serverTotc); - pairs = new ArrayList(); + pairs = new ArrayList<>(); pairs.add(serverTotc.getName()); } Configuration config = serverFrom.getConfiguration(); @@ -1681,7 +1681,7 @@ public abstract class ClusterTestBase extends ActiveMQTestBase { if (nodeTo != -1) { TransportConfiguration serverTotc = createTransportConfiguration(netty, false, generateParams(nodeTo, netty)); serverFrom.getConfiguration().getConnectorConfigurations().put(serverTotc.getName(), serverTotc); - pairs = new ArrayList(); + pairs = new ArrayList<>(); pairs.add(serverTotc.getName()); } Configuration config = serverFrom.getConfiguration(); @@ -1707,7 +1707,7 @@ public abstract class ClusterTestBase extends ActiveMQTestBase { TransportConfiguration connectorFrom = createTransportConfiguration(netty, false, generateParams(nodeFrom, netty)); serverFrom.getConfiguration().getConnectorConfigurations().put(connectorFrom.getName(), connectorFrom); - List pairs = new ArrayList(); + List pairs = new ArrayList<>(); for (int element : nodesTo) { TransportConfiguration serverTotc = createTransportConfiguration(netty, false, generateParams(element, netty)); serverFrom.getConfiguration().getConnectorConfigurations().put(serverTotc.getName(), serverTotc); @@ -1737,7 +1737,7 @@ public abstract class ClusterTestBase extends ActiveMQTestBase { TransportConfiguration connectorFrom = createTransportConfiguration(netty, false, generateParams(nodeFrom, netty)); serverFrom.getConfiguration().getConnectorConfigurations().put(connectorFrom.getName(), connectorFrom); - List pairs = new ArrayList(); + List pairs = new ArrayList<>(); for (int element : nodesTo) { TransportConfiguration serverTotc = createTransportConfiguration(netty, false, generateParams(element, netty)); serverFrom.getConfiguration().getConnectorConfigurations().put(serverTotc.getName(), serverTotc); @@ -1775,7 +1775,7 @@ public abstract class ClusterTestBase extends ActiveMQTestBase { TransportConfiguration connectorFrom = createTransportConfiguration(netty, false, generateParams(nodeFrom, netty)); serverFrom.getConfiguration().getConnectorConfigurations().put(name, connectorFrom); - List pairs = new ArrayList(); + List pairs = new ArrayList<>(); for (int element : nodesTo) { TransportConfiguration serverTotc = createTransportConfiguration(netty, false, generateParams(element, netty)); serverFrom.getConfiguration().getConnectorConfigurations().put(serverTotc.getName(), serverTotc); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusteredGroupingTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusteredGroupingTest.java index 9472202aa6..f2f3f3c80f 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusteredGroupingTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/ClusteredGroupingTest.java @@ -526,7 +526,7 @@ public class ClusteredGroupingTest extends ClusterTestBase { final ClientSession session = addClientSession(sf1.createSession(false, false, false)); final ClientProducer producer = addClientProducer(session.createProducer(ADDRESS)); - List groups = new ArrayList(); + List groups = new ArrayList<>(); final AtomicInteger totalMessageProduced = new AtomicInteger(0); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/MessageRedistributionTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/MessageRedistributionTest.java index 7d36cc2033..2b00104e9f 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/MessageRedistributionTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/MessageRedistributionTest.java @@ -489,7 +489,7 @@ public class MessageRedistributionTest extends ClusterTestBase { session0.start(); - ArrayList xids = new ArrayList(); + ArrayList xids = new ArrayList<>(); for (int i = 0; i < 100; i++) { Xid xid = newXID(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/MessageRedistributionWithDiscoveryTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/MessageRedistributionWithDiscoveryTest.java index 32c2c3203a..97308809aa 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/MessageRedistributionWithDiscoveryTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/distribution/MessageRedistributionWithDiscoveryTest.java @@ -102,7 +102,7 @@ public class MessageRedistributionWithDiscoveryTest extends ClusterTestBase { session0.start(); - ArrayList xids = new ArrayList(); + ArrayList xids = new ArrayList<>(); for (int i = 0; i < 100; i++) { Xid xid = newXID(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/AsynchronousFailoverTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/AsynchronousFailoverTest.java index 770c538406..f7a6d257ee 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/AsynchronousFailoverTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/AsynchronousFailoverTest.java @@ -102,7 +102,7 @@ public class AsynchronousFailoverTest extends FailoverTestBase { volatile boolean failed; - ArrayList errors = new ArrayList(); + ArrayList errors = new ArrayList<>(); boolean isFailed() { return failed; @@ -287,7 +287,7 @@ public class AsynchronousFailoverTest extends FailoverTestBase { session.start(); - List counts = new ArrayList(1000); + List counts = new ArrayList<>(1000); int lastCount = -1; boolean counterGap = false; while (true) { @@ -408,7 +408,7 @@ public class AsynchronousFailoverTest extends FailoverTestBase { ClientConsumer consumer = null; do { - ArrayList msgs = new ArrayList(); + ArrayList msgs = new ArrayList<>(); try { if (consumer == null) { consumer = session.createConsumer(FailoverTestBase.ADDRESS); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/BackupSyncJournalTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/BackupSyncJournalTest.java index be5870ecc2..56cb74ca4f 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/BackupSyncJournalTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/BackupSyncJournalTest.java @@ -336,7 +336,7 @@ public class BackupSyncJournalTest extends FailoverTestBase { } private Set> getFileIds(JournalImpl journal) { - Set> results = new HashSet>(); + Set> results = new HashSet<>(); for (JournalFile jf : journal.getDataFiles()) { results.add(getPair(jf)); } @@ -349,7 +349,7 @@ public class BackupSyncJournalTest extends FailoverTestBase { * @return */ private Pair getPair(JournalFile jf) { - return new Pair(jf.getFileID(), jf.getPosCount()); + return new Pair<>(jf.getFileID(), jf.getPosCount()); } static JournalImpl getMessageJournalFromServer(TestableServer server) { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/BackupSyncLargeMessageTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/BackupSyncLargeMessageTest.java index 7f70d302ad..2e5ec8a3be 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/BackupSyncLargeMessageTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/BackupSyncLargeMessageTest.java @@ -161,7 +161,7 @@ public class BackupSyncLargeMessageTest extends BackupSyncJournalTest { } private Set getAllMessageFileIds(File dir) { - Set idsOnBkp = new TreeSet(); + Set idsOnBkp = new TreeSet<>(); String[] fileList = dir.list(); if (fileList != null) { for (String filename : fileList) { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/BackupSyncPagingTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/BackupSyncPagingTest.java index 052544b0c3..c69b67f8bb 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/BackupSyncPagingTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/BackupSyncPagingTest.java @@ -43,7 +43,7 @@ public class BackupSyncPagingTest extends BackupSyncJournalTest { final Configuration configuration, final NodeManager nodeManager, int id) { - Map conf = new HashMap(); + Map conf = new HashMap<>(); AddressSettings as = new AddressSettings().setMaxSizeBytes(PAGE_MAX).setPageSizeBytes(PAGE_SIZE).setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE); conf.put(ADDRESS.toString(), as); return createInVMFailoverServer(realFiles, configuration, PAGE_SIZE, PAGE_MAX, conf, nodeManager, id); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/ClusterWithBackupFailoverTestBase.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/ClusterWithBackupFailoverTestBase.java index d3b106fb4c..a71adeb407 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/ClusterWithBackupFailoverTestBase.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/ClusterWithBackupFailoverTestBase.java @@ -286,7 +286,7 @@ public abstract class ClusterWithBackupFailoverTestBase extends ClusterTestBase } private ClientSession[] exploreSessions(final int node) { - HashSet sessions = new HashSet(); + HashSet sessions = new HashSet<>(); for (ConsumerHolder holder : consumers) { if (holder != null && holder.getNode() == node && holder.getSession() != null) { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailoverListenerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailoverListenerTest.java index 2088748c78..dca12ee51b 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailoverListenerTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailoverListenerTest.java @@ -249,7 +249,7 @@ public class FailoverListenerTest extends FailoverTestBase { public class SessionFactoryFailoverListener implements FailoverEventListener { - private final ArrayList failoverTypeEvent = new ArrayList(); + private final ArrayList failoverTypeEvent = new ArrayList<>(); private final CountDownLatch failureLatch; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailoverOnFlowControlTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailoverOnFlowControlTest.java index a83f5a01df..2fcd6e128e 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailoverOnFlowControlTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailoverOnFlowControlTest.java @@ -44,7 +44,7 @@ public class FailoverOnFlowControlTest extends FailoverTestBase { @Test public void testOverflowSend() throws Exception { ServerLocator locator = getServerLocator().setBlockOnNonDurableSend(true).setBlockOnDurableSend(true).setReconnectAttempts(-1).setProducerWindowSize(1000).setRetryInterval(123); - final ArrayList sessionList = new ArrayList(); + final ArrayList sessionList = new ArrayList<>(); Interceptor interceptorClient = new Interceptor() { AtomicInteger count = new AtomicInteger(0); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailoverTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailoverTest.java index 305432195d..9e53c01739 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailoverTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailoverTest.java @@ -197,7 +197,7 @@ public class FailoverTest extends FailoverTestBase { final ClientConsumer consumer = session.createConsumer(FailoverTestBase.ADDRESS); session.start(); - final Map received = new HashMap(); + final Map received = new HashMap<>(); consumer.setMessageHandler(new MessageHandler() { @@ -260,7 +260,7 @@ public class FailoverTest extends FailoverTestBase { final ClientConsumer consumer = session.createConsumer(FailoverTestBase.ADDRESS); session.start(); - final Map received = new HashMap(); + final Map received = new HashMap<>(); Thread t = new Thread() { @Override @@ -1427,12 +1427,12 @@ public class FailoverTest extends FailoverTestBase { final int numConsumersPerSession = 5; - Map> sessionConsumerMap = new HashMap>(); + Map> sessionConsumerMap = new HashMap<>(); for (int i = 0; i < numSessions; i++) { ClientSession session = createSession(sf, true, true); - List consumers = new ArrayList(); + List consumers = new ArrayList<>(); for (int j = 0; j < numConsumersPerSession; j++) { SimpleString queueName = new SimpleString("queue" + i + "-" + j); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailoverTestBase.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailoverTestBase.java index bb711abbad..67123df2c8 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailoverTestBase.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/FailoverTestBase.java @@ -296,8 +296,8 @@ public abstract class FailoverTestBase extends ActiveMQTestBase { public static final class LatchClusterTopologyListener implements ClusterTopologyListener { final CountDownLatch latch; - List liveNode = new ArrayList(); - List backupNode = new ArrayList(); + List liveNode = new ArrayList<>(); + List backupNode = new ArrayList<>(); public LatchClusterTopologyListener(CountDownLatch latch) { this.latch = latch; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/MultipleLivesMultipleBackupsFailoverTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/MultipleLivesMultipleBackupsFailoverTest.java index a6ab97bace..edc8b118ee 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/MultipleLivesMultipleBackupsFailoverTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/MultipleLivesMultipleBackupsFailoverTest.java @@ -39,7 +39,7 @@ import java.util.Map; */ public class MultipleLivesMultipleBackupsFailoverTest extends MultipleBackupsFailoverTestBase { - protected Map servers = new HashMap(); + protected Map servers = new HashMap<>(); private ServerLocator locator2; private ServerLocator locator; private final boolean sharedStore = true; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/MultipleServerFailoverTestBase.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/MultipleServerFailoverTestBase.java index 156400b0f2..39261729dd 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/MultipleServerFailoverTestBase.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/MultipleServerFailoverTestBase.java @@ -48,13 +48,13 @@ public abstract class MultipleServerFailoverTestBase extends ActiveMQTestBase { // Attributes ---------------------------------------------------- - protected List liveServers = new ArrayList(); + protected List liveServers = new ArrayList<>(); - protected List backupServers = new ArrayList(); + protected List backupServers = new ArrayList<>(); - protected List backupConfigs = new ArrayList(); + protected List backupConfigs = new ArrayList<>(); - protected List liveConfigs = new ArrayList(); + protected List liveConfigs = new ArrayList<>(); protected List nodeManagers; @@ -72,10 +72,10 @@ public abstract class MultipleServerFailoverTestBase extends ActiveMQTestBase { @Before public void setUp() throws Exception { super.setUp(); - liveServers = new ArrayList(); - backupServers = new ArrayList(); - backupConfigs = new ArrayList(); - liveConfigs = new ArrayList(); + liveServers = new ArrayList<>(); + backupServers = new ArrayList<>(); + backupConfigs = new ArrayList<>(); + liveConfigs = new ArrayList<>(); for (int i = 0; i < getLiveServerCount(); i++) { HAPolicyConfiguration haPolicyConfiguration = null; @@ -104,7 +104,7 @@ public abstract class MultipleServerFailoverTestBase extends ActiveMQTestBase { TransportConfiguration livetc = getConnectorTransportConfiguration(true, i); configuration.addConnectorConfiguration(livetc.getName(), livetc); - List connectors = new ArrayList(); + List connectors = new ArrayList<>(); for (int j = 0; j < getLiveServerCount(); j++) { if (j != i) { TransportConfiguration staticTc = getConnectorTransportConfiguration(true, j); @@ -149,7 +149,7 @@ public abstract class MultipleServerFailoverTestBase extends ActiveMQTestBase { TransportConfiguration backuptc = getConnectorTransportConfiguration(false, i); configuration.addConnectorConfiguration(backuptc.getName(), backuptc); - List connectors = new ArrayList(); + List connectors = new ArrayList<>(); for (int j = 0; j < getBackupServerCount(); j++) { TransportConfiguration staticTc = getConnectorTransportConfiguration(true, j); configuration.addConnectorConfiguration(staticTc.getName(), staticTc); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/NettyFailoverTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/NettyFailoverTest.java index 775a7d905a..2c1ccfdb90 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/NettyFailoverTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/NettyFailoverTest.java @@ -46,7 +46,7 @@ public class NettyFailoverTest extends FailoverTest { @Test public void testFailoverWithHostAlias() throws Exception { - Map params = new HashMap(); + Map params = new HashMap<>(); params.put(TransportConstants.HOST_PROP_NAME, "127.0.0.1"); TransportConfiguration tc = createTransportConfiguration(true, false, params); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/QuorumFailOverTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/QuorumFailOverTest.java index cdba3f795d..955e34c960 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/QuorumFailOverTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/QuorumFailOverTest.java @@ -102,7 +102,7 @@ public class QuorumFailOverTest extends StaticClusterWithBackupFailoverTest { private static class TopologyListener implements ClusterTopologyListener { final String prefix; - final Map> nodes = new ConcurrentHashMap>(); + final Map> nodes = new ConcurrentHashMap<>(); public TopologyListener(String string) { prefix = string; @@ -110,7 +110,7 @@ public class QuorumFailOverTest extends StaticClusterWithBackupFailoverTest { @Override public void nodeUP(TopologyMember topologyMember, boolean last) { - Pair connectorPair = new Pair(topologyMember.getLive(), topologyMember.getBackup()); + Pair connectorPair = new Pair<>(topologyMember.getLive(), topologyMember.getBackup()); nodes.put(topologyMember.getBackupGroupName(), connectorPair); } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/ReplicatedMultipleServerFailoverExtraBackupsTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/ReplicatedMultipleServerFailoverExtraBackupsTest.java index 6dfec7131f..c1f3942746 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/ReplicatedMultipleServerFailoverExtraBackupsTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/ReplicatedMultipleServerFailoverExtraBackupsTest.java @@ -105,7 +105,7 @@ public class ReplicatedMultipleServerFailoverExtraBackupsTest extends Replicated waitForDistribution(ADDRESS, backupServers.get(0).getServer(), 100); waitForDistribution(ADDRESS, backupServers.get(1).getServer(), 100); - List toCrash = new ArrayList(); + List toCrash = new ArrayList<>(); for (TestableServer backupServer : backupServers) { if (!backupServer.getServer().getHAPolicy().isBackup()) { toCrash.add(backupServer); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/SecurityFailoverTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/SecurityFailoverTest.java index 256418966b..121a650a72 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/SecurityFailoverTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/SecurityFailoverTest.java @@ -104,7 +104,7 @@ public class SecurityFailoverTest extends FailoverTest { ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getServer().getSecurityManager(); securityManager.getConfiguration().addUser("a", "b"); Role role = new Role("arole", true, true, true, true, true, true, true); - Set roles = new HashSet(); + Set roles = new HashSet<>(); roles.add(role); server.getServer().getSecurityRepository().addMatch("#", roles); securityManager.getConfiguration().addRole("a", "arole"); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/SingleLiveMultipleBackupsFailoverTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/SingleLiveMultipleBackupsFailoverTest.java index 066da1690b..069eb32ae5 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/SingleLiveMultipleBackupsFailoverTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/failover/SingleLiveMultipleBackupsFailoverTest.java @@ -39,7 +39,7 @@ import java.util.Map; */ public class SingleLiveMultipleBackupsFailoverTest extends MultipleBackupsFailoverTestBase { - protected Map servers = new HashMap(); + protected Map servers = new HashMap<>(); protected ServerLocatorImpl locator; private NodeManager nodeManager; final boolean sharedStore = true; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/MultiThreadRandomReattachTestBase.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/MultiThreadRandomReattachTestBase.java index ce2e7b1fcd..5b04a1418a 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/MultiThreadRandomReattachTestBase.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/MultiThreadRandomReattachTestBase.java @@ -297,8 +297,8 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt final int numSessions = 10; - Set consumers = new HashSet(); - Set sessions = new HashSet(); + Set consumers = new HashSet<>(); + Set sessions = new HashSet<>(); for (int i = 0; i < numSessions; i++) { SimpleString subName = new SimpleString(threadNum + "sub" + i); @@ -323,7 +323,7 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt sendMessages(sessSend, producer, numMessages, threadNum); - Set handlers = new HashSet(); + Set handlers = new HashSet<>(); for (ClientConsumer consumer : consumers) { MyHandler handler = new MyHandler(threadNum, numMessages); @@ -375,8 +375,8 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt final int numSessions = 10; - Set consumers = new HashSet(); - Set sessions = new HashSet(); + Set consumers = new HashSet<>(); + Set sessions = new HashSet<>(); for (int i = 0; i < numSessions; i++) { SimpleString subName = new SimpleString(threadNum + "sub" + i); @@ -403,7 +403,7 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt session.start(); } - Set handlers = new HashSet(); + Set handlers = new HashSet<>(); for (ClientConsumer consumer : consumers) { MyHandler handler = new MyHandler(threadNum, numMessages); @@ -457,8 +457,8 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt final int numSessions = 10; - Set consumers = new HashSet(); - Set sessions = new HashSet(); + Set consumers = new HashSet<>(); + Set sessions = new HashSet<>(); for (int i = 0; i < numSessions; i++) { SimpleString subName = new SimpleString(threadNum + "sub" + i); @@ -489,7 +489,7 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt sessSend.commit(); - Set handlers = new HashSet(); + Set handlers = new HashSet<>(); for (ClientConsumer consumer : consumers) { MyHandler handler = new MyHandler(threadNum, numMessages); @@ -557,8 +557,8 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt final int numSessions = 10; - Set consumers = new HashSet(); - Set sessions = new HashSet(); + Set consumers = new HashSet<>(); + Set sessions = new HashSet<>(); for (int i = 0; i < numSessions; i++) { SimpleString subName = new SimpleString(threadNum + " sub" + i); @@ -592,7 +592,7 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt session.start(); } - Set handlers = new HashSet(); + Set handlers = new HashSet<>(); for (ClientConsumer consumer : consumers) { MyHandler handler = new MyHandler(threadNum, numMessages); @@ -684,8 +684,8 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt final int numSessions = 10; - Set consumers = new HashSet(); - Set sessions = new HashSet(); + Set consumers = new HashSet<>(); + Set sessions = new HashSet<>(); for (int i = 0; i < numSessions; i++) { SimpleString subName = new SimpleString(threadNum + "sub" + i); @@ -741,8 +741,8 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt final int numSessions = 10; - Set consumers = new HashSet(); - Set sessions = new HashSet(); + Set consumers = new HashSet<>(); + Set sessions = new HashSet<>(); for (int i = 0; i < numSessions; i++) { SimpleString subName = new SimpleString(threadNum + "sub" + i); @@ -800,8 +800,8 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt final int numSessions = 10; - Set consumers = new HashSet(); - Set sessions = new HashSet(); + Set consumers = new HashSet<>(); + Set sessions = new HashSet<>(); for (int i = 0; i < numSessions; i++) { SimpleString subName = new SimpleString(threadNum + "sub" + i); @@ -873,8 +873,8 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt final int numSessions = 10; - Set consumers = new HashSet(); - Set sessions = new HashSet(); + Set consumers = new HashSet<>(); + Set sessions = new HashSet<>(); for (int i = 0; i < numSessions; i++) { SimpleString subName = new SimpleString(threadNum + "sub" + i); @@ -1159,14 +1159,14 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt final int numMessages, final int threadNum) throws Exception { // We make sure the messages arrive in the order they were sent from a particular producer - Map> counts = new HashMap>(); + Map> counts = new HashMap<>(); for (int i = 0; i < numMessages; i++) { for (ClientConsumer consumer : consumers) { Map consumerCounts = counts.get(consumer); if (consumerCounts == null) { - consumerCounts = new HashMap(); + consumerCounts = new HashMap<>(); counts.put(consumer, consumerCounts); } @@ -1206,7 +1206,7 @@ public abstract class MultiThreadRandomReattachTestBase extends MultiThreadReatt CountDownLatch latch = new CountDownLatch(1); - private final Map counts = new HashMap(); + private final Map counts = new HashMap<>(); volatile String failure; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/MultiThreadReattachSupportTestBase.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/MultiThreadReattachSupportTestBase.java index 3a41924868..e36475acff 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/MultiThreadReattachSupportTestBase.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/MultiThreadReattachSupportTestBase.java @@ -117,7 +117,7 @@ public abstract class MultiThreadReattachSupportTestBase extends ActiveMQTestBas } do { - List threads = new ArrayList(); + List threads = new ArrayList<>(); for (int i = 0; i < numThreads; i++) { Runner runner = new Runner(runnable, i); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/OrderReattachTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/OrderReattachTest.java index f38b7031b1..f0aac93771 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/OrderReattachTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/OrderReattachTest.java @@ -73,7 +73,7 @@ public class OrderReattachTest extends ActiveMQTestBase { final ClientSession session = sf.createSession(false, true, true); - final LinkedBlockingDeque failureQueue = new LinkedBlockingDeque(); + final LinkedBlockingDeque failureQueue = new LinkedBlockingDeque<>(); final CountDownLatch ready = new CountDownLatch(1); @@ -158,8 +158,8 @@ public class OrderReattachTest extends ActiveMQTestBase { final int numSessions = 10; - Set consumers = new HashSet(); - Set sessions = new HashSet(); + Set consumers = new HashSet<>(); + Set sessions = new HashSet<>(); for (int i = 0; i < numSessions; i++) { SimpleString subName = new SimpleString("sub" + i); @@ -229,7 +229,7 @@ public class OrderReattachTest extends ActiveMQTestBase { } } - Set handlers = new HashSet(); + Set handlers = new HashSet<>(); for (ClientConsumer consumer : consumers) { MyHandler handler = new MyHandler(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/RandomReattachTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/RandomReattachTest.java index 4332a80b37..8d1fe3248d 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/RandomReattachTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/reattach/RandomReattachTest.java @@ -232,8 +232,8 @@ public class RandomReattachTest extends ActiveMQTestBase { final int numSessions = 10; - Set consumers = new HashSet(); - Set sessions = new HashSet(); + Set consumers = new HashSet<>(); + Set sessions = new HashSet<>(); for (int i = 0; i < numSessions; i++) { SimpleString subName = new SimpleString("sub" + i); @@ -290,7 +290,7 @@ public class RandomReattachTest extends ActiveMQTestBase { } } - Set handlers = new HashSet(); + Set handlers = new HashSet<>(); for (ClientConsumer consumer : consumers) { MyHandler handler = new MyHandler(); @@ -335,8 +335,8 @@ public class RandomReattachTest extends ActiveMQTestBase { final int numSessions = 50; - Set consumers = new HashSet(); - Set sessions = new HashSet(); + Set consumers = new HashSet<>(); + Set sessions = new HashSet<>(); for (int i = 0; i < numSessions; i++) { SimpleString subName = new SimpleString("sub" + i); @@ -388,7 +388,7 @@ public class RandomReattachTest extends ActiveMQTestBase { } } - Set handlers = new HashSet(); + Set handlers = new HashSet<>(); for (ClientConsumer consumer : consumers) { MyHandler handler = new MyHandler(); @@ -435,8 +435,8 @@ public class RandomReattachTest extends ActiveMQTestBase { final int numSessions = 1; - Set consumers = new HashSet(); - Set sessions = new HashSet(); + Set consumers = new HashSet<>(); + Set sessions = new HashSet<>(); for (int i = 0; i < numSessions; i++) { SimpleString subName = new SimpleString("sub" + i); @@ -504,7 +504,7 @@ public class RandomReattachTest extends ActiveMQTestBase { } } - Set handlers = new HashSet(); + Set handlers = new HashSet<>(); for (ClientConsumer consumer : consumers) { MyHandler handler = new MyHandler(); @@ -576,8 +576,8 @@ public class RandomReattachTest extends ActiveMQTestBase { final int numSessions = 10; - Set consumers = new HashSet(); - Set sessions = new HashSet(); + Set consumers = new HashSet<>(); + Set sessions = new HashSet<>(); for (int i = 0; i < numSessions; i++) { SimpleString subName = new SimpleString("sub" + i); @@ -639,7 +639,7 @@ public class RandomReattachTest extends ActiveMQTestBase { } } - Set handlers = new HashSet(); + Set handlers = new HashSet<>(); for (ClientConsumer consumer : consumers) { MyHandler handler = new MyHandler(); @@ -713,8 +713,8 @@ public class RandomReattachTest extends ActiveMQTestBase { final int numSessions = 10; - Set consumers = new HashSet(); - Set sessions = new HashSet(); + Set consumers = new HashSet<>(); + Set sessions = new HashSet<>(); for (int i = 0; i < numSessions; i++) { SimpleString subName = new SimpleString("sub" + i); @@ -789,8 +789,8 @@ public class RandomReattachTest extends ActiveMQTestBase { final int numSessions = 10; - Set consumers = new HashSet(); - Set sessions = new HashSet(); + Set consumers = new HashSet<>(); + Set sessions = new HashSet<>(); for (int i = 0; i < numSessions; i++) { SimpleString subName = new SimpleString("sub" + i); @@ -873,8 +873,8 @@ public class RandomReattachTest extends ActiveMQTestBase { final int numSessions = 10; - Set consumers = new HashSet(); - Set sessions = new HashSet(); + Set consumers = new HashSet<>(); + Set sessions = new HashSet<>(); for (int i = 0; i < numSessions; i++) { SimpleString subName = new SimpleString("sub" + i); @@ -985,8 +985,8 @@ public class RandomReattachTest extends ActiveMQTestBase { final int numSessions = 10; - Set consumers = new HashSet(); - Set sessions = new HashSet(); + Set consumers = new HashSet<>(); + Set sessions = new HashSet<>(); for (int i = 0; i < numSessions; i++) { SimpleString subName = new SimpleString("sub" + i); @@ -1304,7 +1304,7 @@ public class RandomReattachTest extends ActiveMQTestBase { } } - private final ArrayList errors = new ArrayList(); + private final ArrayList errors = new ArrayList<>(); /* (non-Javadoc) * @see MessageHandler#onMessage(ClientMessage) diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/topology/IsolatedTopologyTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/topology/IsolatedTopologyTest.java index 85f6d32d92..e45679ad8d 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/topology/IsolatedTopologyTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/topology/IsolatedTopologyTest.java @@ -81,24 +81,24 @@ public class IsolatedTopologyTest extends ActiveMQTestBase { } private ActiveMQServer createServer1() throws Exception { - Map params = new HashMap(); + Map params = new HashMap<>(); params.put(TransportConstants.CLUSTER_CONNECTION, "cc1"); params.put(org.apache.activemq.artemis.core.remoting.impl.invm.TransportConstants.SERVER_ID_PROP_NAME, "1"); TransportConfiguration acceptor1VM1 = new TransportConfiguration(ActiveMQTestBase.INVM_ACCEPTOR_FACTORY, params, "acceptor-cc1"); - params = new HashMap(); + params = new HashMap<>(); params.put(TransportConstants.CLUSTER_CONNECTION, "cc2"); params.put(org.apache.activemq.artemis.core.remoting.impl.invm.TransportConstants.SERVER_ID_PROP_NAME, "2"); TransportConfiguration acceptor2VM1 = new TransportConfiguration(ActiveMQTestBase.INVM_ACCEPTOR_FACTORY, params, "acceptor-cc2"); - List connectTo = new ArrayList(); + List connectTo = new ArrayList<>(); connectTo.add("other-cc1"); ClusterConnectionConfiguration server1CC1 = new ClusterConnectionConfiguration().setName("cc1").setAddress("jms").setConnectorName("local-cc1").setRetryInterval(250).setConfirmationWindowSize(1024).setMessageLoadBalancingType(MessageLoadBalancingType.ON_DEMAND).setStaticConnectors(connectTo); - ArrayList connectTo2 = new ArrayList(); + ArrayList connectTo2 = new ArrayList<>(); connectTo2.add("other-cc2"); ClusterConnectionConfiguration server1CC2 = new ClusterConnectionConfiguration().setName("cc2").setAddress("jms").setConnectorName("local-cc2").setRetryInterval(250).setConfirmationWindowSize(1024).setMessageLoadBalancingType(MessageLoadBalancingType.ON_DEMAND).setStaticConnectors(connectTo2); @@ -113,24 +113,24 @@ public class IsolatedTopologyTest extends ActiveMQTestBase { private ActiveMQServer createServer2() throws Exception { - Map params = new HashMap(); + Map params = new HashMap<>(); params.put(TransportConstants.CLUSTER_CONNECTION, "cc1"); params.put(org.apache.activemq.artemis.core.remoting.impl.invm.TransportConstants.SERVER_ID_PROP_NAME, "3"); TransportConfiguration acceptor1VM1 = new TransportConfiguration(ActiveMQTestBase.INVM_ACCEPTOR_FACTORY, params, "acceptor-cc1"); - params = new HashMap(); + params = new HashMap<>(); params.put(TransportConstants.CLUSTER_CONNECTION, "cc2"); params.put(org.apache.activemq.artemis.core.remoting.impl.invm.TransportConstants.SERVER_ID_PROP_NAME, "4"); TransportConfiguration acceptor2VM1 = new TransportConfiguration(ActiveMQTestBase.INVM_ACCEPTOR_FACTORY, params, "acceptor-cc2"); - List connectTo = new ArrayList(); + List connectTo = new ArrayList<>(); connectTo.add("other-cc1"); ClusterConnectionConfiguration server1CC1 = new ClusterConnectionConfiguration().setName("cc1").setAddress("jms").setConnectorName("local-cc1").setRetryInterval(250).setConfirmationWindowSize(1024).setMessageLoadBalancingType(MessageLoadBalancingType.ON_DEMAND).setStaticConnectors(connectTo); - List connectTo2 = new ArrayList(); + List connectTo2 = new ArrayList<>(); connectTo2.add("other-cc2"); ClusterConnectionConfiguration server1CC2 = new ClusterConnectionConfiguration().setName("cc2").setAddress("jms").setConnectorName("local-cc2").setRetryInterval(250).setConfirmationWindowSize(1024).setMessageLoadBalancingType(MessageLoadBalancingType.ON_DEMAND).setStaticConnectors(connectTo2); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/topology/NonHATopologyTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/topology/NonHATopologyTest.java index 4bad2595a7..b6eed8a0eb 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/topology/NonHATopologyTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/topology/NonHATopologyTest.java @@ -64,7 +64,7 @@ public class NonHATopologyTest extends ActiveMQTestBase { server.getConfiguration().getAcceptorConfigurations().add(new TransportConfiguration(NETTY_ACCEPTOR_FACTORY)); server.getConfiguration().getConnectorConfigurations().put("netty", new TransportConfiguration(NETTY_CONNECTOR_FACTORY)); - ArrayList list = new ArrayList(); + ArrayList list = new ArrayList<>(); list.add("netty"); Configuration config = server.getConfiguration(); config.getClusterConfigurations().add(new ClusterConnectionConfiguration().setName("tst").setAddress("jms").setConnectorName("netty").setRetryInterval(1000).setConfirmationWindowSize(1000).setMessageLoadBalancingType(MessageLoadBalancingType.ON_DEMAND).setStaticConnectors(list).setAllowDirectConnectionsOnly(true)); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/util/MultiServerTestBase.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/util/MultiServerTestBase.java index 536b0ca1fc..8ca823ce02 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/util/MultiServerTestBase.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/cluster/util/MultiServerTestBase.java @@ -160,7 +160,7 @@ public class MultiServerTestBase extends ActiveMQTestBase { Configuration configuration = createBasicConfig(node).setJournalMaxIO_AIO(1000).setThreadPoolMaxSize(10).clearAcceptorConfigurations().addAcceptorConfiguration(serverConfigAcceptor).addConnectorConfiguration("thisConnector", thisConnector).setHAPolicyConfiguration(sharedStorage ? new SharedStoreMasterPolicyConfiguration() : new ReplicatedPolicyConfiguration()); - List targetServersOnConnection = new ArrayList(); + List targetServersOnConnection = new ArrayList<>(); for (int targetNode = 0; targetNode < getNumberOfServers(); targetNode++) { if (targetNode == node) { @@ -196,7 +196,7 @@ public class MultiServerTestBase extends ActiveMQTestBase { addServer(server); - return new Pair(server, nodeManager); + return new Pair<>(server, nodeManager); } protected ActiveMQServer setupBackupServer(final int node, @@ -207,7 +207,7 @@ public class MultiServerTestBase extends ActiveMQTestBase { Configuration configuration = createBasicConfig(useSharedStorage() ? liveNode : node).clearAcceptorConfigurations().addAcceptorConfiguration(serverConfigAcceptor).addConnectorConfiguration("thisConnector", thisConnector).setHAPolicyConfiguration(useSharedStorage() ? new SharedStoreSlavePolicyConfiguration() : new ReplicaPolicyConfiguration()); - List targetServersOnConnection = new ArrayList(); + List targetServersOnConnection = new ArrayList<>(); for (int targetNode = 0; targetNode < getNumberOfServers(); targetNode++) { // if (targetNode == node) diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/discovery/DiscoveryBaseTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/discovery/DiscoveryBaseTest.java index 137d252bf9..44bb31a613 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/discovery/DiscoveryBaseTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/discovery/DiscoveryBaseTest.java @@ -77,7 +77,7 @@ public class DiscoveryBaseTest extends ActiveMQTestBase { protected TransportConfiguration generateTC(String debug) { String className = "org.foo.bar." + debug + "|" + UUIDGenerator.getInstance().generateStringUUID() + ""; String name = UUIDGenerator.getInstance().generateStringUUID(); - Map params = new HashMap(); + Map params = new HashMap<>(); params.put(UUIDGenerator.getInstance().generateStringUUID(), 123); params.put(UUIDGenerator.getInstance().generateStringUUID(), UUIDGenerator.getInstance().generateStringUUID()); params.put(UUIDGenerator.getInstance().generateStringUUID(), true); @@ -99,7 +99,7 @@ public class DiscoveryBaseTest extends ActiveMQTestBase { List actual) { assertNotNull(actual); - List sortedExpected = new ArrayList(expected); + List sortedExpected = new ArrayList<>(expected); Collections.sort(sortedExpected, new Comparator() { @Override @@ -107,7 +107,7 @@ public class DiscoveryBaseTest extends ActiveMQTestBase { return o2.toString().compareTo(o1.toString()); } }); - List sortedActual = new ArrayList(actual); + List sortedActual = new ArrayList<>(actual); Collections.sort(sortedActual, new Comparator() { @Override public int compare(DiscoveryEntry o1, DiscoveryEntry o2) { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/http/CoreClientOverHttpTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/http/CoreClientOverHttpTest.java index 071389f84b..119be8740e 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/http/CoreClientOverHttpTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/http/CoreClientOverHttpTest.java @@ -52,7 +52,7 @@ public class CoreClientOverHttpTest extends ActiveMQTestBase { @Before public void setUp() throws Exception { super.setUp(); - HashMap params = new HashMap(); + HashMap params = new HashMap<>(); params.put(TransportConstants.HTTP_ENABLED_PROP_NAME, true); conf = createDefaultInVMConfig().clearAcceptorConfigurations().addAcceptorConfiguration(new TransportConfiguration(NETTY_ACCEPTOR_FACTORY, params)); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/ActiveMQConnectionFactoryTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/ActiveMQConnectionFactoryTest.java index c4ddd2c4bf..93f03bfd9c 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/ActiveMQConnectionFactoryTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/ActiveMQConnectionFactoryTest.java @@ -509,9 +509,9 @@ public class ActiveMQConnectionFactoryTest extends ActiveMQTestBase { private void startServer() throws Exception { liveTC = new TransportConfiguration(INVM_CONNECTOR_FACTORY); - Map connectors = new HashMap(); + Map connectors = new HashMap<>(); connectors.put(liveTC.getName(), liveTC); - List connectorNames = new ArrayList(); + List connectorNames = new ArrayList<>(); connectorNames.add(liveTC.getName()); Configuration liveConf = createBasicConfig().addAcceptorConfiguration(new TransportConfiguration(INVM_ACCEPTOR_FACTORY)).setConnectorConfigurations(connectors).setHAPolicyConfiguration(new SharedStoreMasterPolicyConfiguration()); @@ -524,7 +524,7 @@ public class ActiveMQConnectionFactoryTest extends ActiveMQTestBase { BroadcastGroupConfiguration bcConfig1 = new BroadcastGroupConfiguration().setName(bcGroupName).setBroadcastPeriod(broadcastPeriod).setConnectorInfos(connectorNames).setEndpointFactory(new UDPBroadcastEndpointFactory().setGroupAddress(groupAddress).setGroupPort(groupPort).setLocalBindPort(localBindPort)); - List bcConfigs1 = new ArrayList(); + List bcConfigs1 = new ArrayList<>(); bcConfigs1.add(bcConfig1); liveConf.setBroadcastGroupConfigurations(bcConfigs1); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/FloodServerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/FloodServerTest.java index 36ae11f013..9ef5f6dd34 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/FloodServerTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/FloodServerTest.java @@ -102,7 +102,7 @@ public class FloodServerTest extends ActiveMQTestBase { int reconnectAttempts = -1; long callTimeout = 30000; - List connectorConfigs = new ArrayList(); + List connectorConfigs = new ArrayList<>(); connectorConfigs.add(new TransportConfiguration(NettyConnectorFactory.class.getName())); serverManager.createConnectionFactory("ManualReconnectionToSingleServerTest", false, JMSFactoryType.CF, registerConnectors(server, connectorConfigs), null, 1000, ActiveMQClient.DEFAULT_CONNECTION_TTL, callTimeout, ActiveMQClient.DEFAULT_CALL_FAILOVER_TIMEOUT, ActiveMQClient.DEFAULT_CACHE_LARGE_MESSAGE_CLIENT, ActiveMQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE, ActiveMQClient.DEFAULT_COMPRESS_LARGE_MESSAGES, ActiveMQClient.DEFAULT_CONSUMER_WINDOW_SIZE, ActiveMQClient.DEFAULT_CONSUMER_MAX_RATE, ActiveMQClient.DEFAULT_CONFIRMATION_WINDOW_SIZE, ActiveMQClient.DEFAULT_PRODUCER_WINDOW_SIZE, ActiveMQClient.DEFAULT_PRODUCER_MAX_RATE, false, false, false, ActiveMQClient.DEFAULT_AUTO_GROUP, false, ActiveMQClient.DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME, ActiveMQClient.DEFAULT_ACK_BATCH_SIZE, ActiveMQClient.DEFAULT_ACK_BATCH_SIZE, ActiveMQClient.DEFAULT_USE_GLOBAL_POOLS, ActiveMQClient.DEFAULT_SCHEDULED_THREAD_POOL_MAX_SIZE, ActiveMQClient.DEFAULT_THREAD_POOL_MAX_SIZE, retryInterval, retryIntervalMultiplier, 1000, reconnectAttempts, ActiveMQClient.DEFAULT_FAILOVER_ON_INITIAL_CONNECTION, null, "/cf"); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/ManualReconnectionToSingleServerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/ManualReconnectionToSingleServerTest.java index a8a44e0db9..aff6e01f94 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/ManualReconnectionToSingleServerTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/ManualReconnectionToSingleServerTest.java @@ -149,7 +149,7 @@ public class ManualReconnectionToSingleServerTest extends ActiveMQTestBase { configuration.getQueueConfigurations().add(new JMSQueueConfigurationImpl().setName(QUEUE_NAME).setBindings(QUEUE_NAME)); - ArrayList configs = new ArrayList(); + ArrayList configs = new ArrayList<>(); configs.add(new TransportConfiguration(NETTY_CONNECTOR_FACTORY)); ConnectionFactoryConfiguration cfConfig = new ConnectionFactoryConfigurationImpl().setName("cf").setConnectorNames(registerConnectors(server, configs)).setBindings("/cf").setRetryInterval(1000).setReconnectAttempts(-1); configuration.getConnectionFactoryConfigurations().add(cfConfig); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/SimpleJNDIClientTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/SimpleJNDIClientTest.java index e0e74a4e0e..c4df3f2cc0 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/SimpleJNDIClientTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/SimpleJNDIClientTest.java @@ -393,9 +393,9 @@ public class SimpleJNDIClientTest extends ActiveMQTestBase { private void startServer() throws Exception { liveTC = new TransportConfiguration(INVM_CONNECTOR_FACTORY); - Map connectors = new HashMap(); + Map connectors = new HashMap<>(); connectors.put(liveTC.getName(), liveTC); - List connectorNames = new ArrayList(); + List connectorNames = new ArrayList<>(); connectorNames.add(liveTC.getName()); Map params = new HashMap(); @@ -411,7 +411,7 @@ public class SimpleJNDIClientTest extends ActiveMQTestBase { BroadcastGroupConfiguration bcConfig1 = new BroadcastGroupConfiguration().setName(bcGroupName).setBroadcastPeriod(broadcastPeriod).setConnectorInfos(connectorNames).setEndpointFactory(new UDPBroadcastEndpointFactory().setGroupAddress(groupAddress).setGroupPort(groupPort).setLocalBindPort(localBindPort)); - List bcConfigs1 = new ArrayList(); + List bcConfigs1 = new ArrayList<>(); bcConfigs1.add(bcConfig1); liveConf.setBroadcastGroupConfigurations(bcConfigs1); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/ReSendMessageTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/ReSendMessageTest.java index d2a2b81494..aad5d5337e 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/ReSendMessageTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/ReSendMessageTest.java @@ -62,7 +62,7 @@ public class ReSendMessageTest extends JMSTestBase { conn.start(); Session sess = conn.createSession(true, Session.SESSION_TRANSACTED); - ArrayList msgs = new ArrayList(); + ArrayList msgs = new ArrayList<>(); for (int i = 0; i < 10; i++) { BytesMessage bm = sess.createBytesMessage(); @@ -96,7 +96,7 @@ public class ReSendMessageTest extends JMSTestBase { conn.start(); Session sess = conn.createSession(true, Session.SESSION_TRANSACTED); - ArrayList msgs = new ArrayList(); + ArrayList msgs = new ArrayList<>(); for (int i = 0; i < 1; i++) { MapMessage mm = sess.createMapMessage(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/SessionClosedOnRemotingConnectionFailureTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/SessionClosedOnRemotingConnectionFailureTest.java index 515858dfd5..4f664f117a 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/SessionClosedOnRemotingConnectionFailureTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/SessionClosedOnRemotingConnectionFailureTest.java @@ -59,7 +59,7 @@ public class SessionClosedOnRemotingConnectionFailureTest extends JMSTestBase { @Test public void testSessionClosedOnRemotingConnectionFailure() throws Exception { - List connectorConfigs = new ArrayList(); + List connectorConfigs = new ArrayList<>(); connectorConfigs.add(new TransportConfiguration(INVM_CONNECTOR_FACTORY)); jmsServer.createConnectionFactory("cffoo", false, JMSFactoryType.CF, registerConnectors(server, connectorConfigs), null, ActiveMQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD, ActiveMQClient.DEFAULT_CONNECTION_TTL, ActiveMQClient.DEFAULT_CALL_TIMEOUT, ActiveMQClient.DEFAULT_CALL_FAILOVER_TIMEOUT, ActiveMQClient.DEFAULT_CACHE_LARGE_MESSAGE_CLIENT, ActiveMQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE, ActiveMQClient.DEFAULT_COMPRESS_LARGE_MESSAGES, ActiveMQClient.DEFAULT_CONSUMER_WINDOW_SIZE, ActiveMQClient.DEFAULT_CONSUMER_MAX_RATE, ActiveMQClient.DEFAULT_CONFIRMATION_WINDOW_SIZE, ActiveMQClient.DEFAULT_PRODUCER_WINDOW_SIZE, ActiveMQClient.DEFAULT_PRODUCER_MAX_RATE, ActiveMQClient.DEFAULT_BLOCK_ON_ACKNOWLEDGE, ActiveMQClient.DEFAULT_BLOCK_ON_DURABLE_SEND, ActiveMQClient.DEFAULT_BLOCK_ON_NON_DURABLE_SEND, ActiveMQClient.DEFAULT_AUTO_GROUP, ActiveMQClient.DEFAULT_PRE_ACKNOWLEDGE, ActiveMQClient.DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME, ActiveMQClient.DEFAULT_ACK_BATCH_SIZE, ActiveMQClient.DEFAULT_ACK_BATCH_SIZE, ActiveMQClient.DEFAULT_USE_GLOBAL_POOLS, ActiveMQClient.DEFAULT_SCHEDULED_THREAD_POOL_MAX_SIZE, ActiveMQClient.DEFAULT_THREAD_POOL_MAX_SIZE, ActiveMQClient.DEFAULT_RETRY_INTERVAL, ActiveMQClient.DEFAULT_RETRY_INTERVAL_MULTIPLIER, ActiveMQClient.DEFAULT_MAX_RETRY_INTERVAL, 0, ActiveMQClient.DEFAULT_FAILOVER_ON_INITIAL_CONNECTION, null, "/cffoo"); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/StoreConfigTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/StoreConfigTest.java index a6b85dfdcf..131cb0e621 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/StoreConfigTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/client/StoreConfigTest.java @@ -47,7 +47,7 @@ public class StoreConfigTest extends JMSTestBase { server.getConfiguration().getConnectorConfigurations().put("np", new TransportConfiguration(INVM_CONNECTOR_FACTORY)); - List transportConfigurations = new ArrayList(); + List transportConfigurations = new ArrayList<>(); transportConfigurations.add("tst"); ConnectionFactoryConfigurationImpl factCFG = (ConnectionFactoryConfigurationImpl) new ConnectionFactoryConfigurationImpl().setName("tst").setConnectorNames(transportConfigurations); @@ -111,7 +111,7 @@ public class StoreConfigTest extends JMSTestBase { server.getConfiguration().getConnectorConfigurations().put("np", new TransportConfiguration(INVM_CONNECTOR_FACTORY)); - List transportConfigurations = new ArrayList(); + List transportConfigurations = new ArrayList<>(); transportConfigurations.add("tst"); ConnectionFactoryConfigurationImpl factCFG = (ConnectionFactoryConfigurationImpl) new ConnectionFactoryConfigurationImpl().setName("tst").setConnectorNames(transportConfigurations); @@ -213,7 +213,7 @@ public class StoreConfigTest extends JMSTestBase { // server.getConfiguration().getConnectorConfigurations().put("np", new TransportConfiguration(INVM_CONNECTOR_FACTORY)); - List transportConfigurations = new ArrayList(); + List transportConfigurations = new ArrayList<>(); transportConfigurations.add("tst"); ConnectionFactoryConfigurationImpl factCFG = (ConnectionFactoryConfigurationImpl) new ConnectionFactoryConfigurationImpl().setName("tst").setConnectorNames(transportConfigurations); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/cluster/JMSFailoverListenerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/cluster/JMSFailoverListenerTest.java index d2139e9896..dd64621c8f 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/cluster/JMSFailoverListenerTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/cluster/JMSFailoverListenerTest.java @@ -90,7 +90,7 @@ public class JMSFailoverListenerTest extends ActiveMQTestBase { protected ActiveMQServer backupServer; - protected Map backupParams = new HashMap(); + protected Map backupParams = new HashMap<>(); private TransportConfiguration backuptc; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/cluster/JMSFailoverTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/cluster/JMSFailoverTest.java index 2c1edb6f7a..e6f98080f4 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/cluster/JMSFailoverTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/cluster/JMSFailoverTest.java @@ -98,7 +98,7 @@ public class JMSFailoverTest extends ActiveMQTestBase { protected ActiveMQServer backupServer; - protected Map backupParams = new HashMap(); + protected Map backupParams = new HashMap<>(); private TransportConfiguration backuptc; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/connection/CloseConnectionOnGCTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/connection/CloseConnectionOnGCTest.java index 5cc0baa17d..b6ef8c8103 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/connection/CloseConnectionOnGCTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/connection/CloseConnectionOnGCTest.java @@ -61,7 +61,7 @@ public class CloseConnectionOnGCTest extends JMSTestBase { Connection conn = cf.createConnection(); - WeakReference wr = new WeakReference(conn); + WeakReference wr = new WeakReference<>(conn); Assert.assertEquals(1, server.getRemotingService().getConnections().size()); final CountDownLatch latch = new CountDownLatch(1); @@ -87,9 +87,9 @@ public class CloseConnectionOnGCTest extends JMSTestBase { Connection conn2 = cf.createConnection(); Connection conn3 = cf.createConnection(); - WeakReference wr1 = new WeakReference(conn1); - WeakReference wr2 = new WeakReference(conn2); - WeakReference wr3 = new WeakReference(conn3); + WeakReference wr1 = new WeakReference<>(conn1); + WeakReference wr2 = new WeakReference<>(conn2); + WeakReference wr3 = new WeakReference<>(conn3); Assert.assertEquals(3, server.getRemotingService().getConnections().size()); @@ -122,9 +122,9 @@ public class CloseConnectionOnGCTest extends JMSTestBase { Connection conn2 = cf.createConnection(); Connection conn3 = cf.createConnection(); - WeakReference wr1 = new WeakReference(conn1); - WeakReference wr2 = new WeakReference(conn2); - WeakReference wr3 = new WeakReference(conn3); + WeakReference wr1 = new WeakReference<>(conn1); + WeakReference wr2 = new WeakReference<>(conn2); + WeakReference wr3 = new WeakReference<>(conn3); Session sess1 = conn1.createSession(false, Session.AUTO_ACKNOWLEDGE); Session sess2 = conn1.createSession(false, Session.AUTO_ACKNOWLEDGE); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/connection/ConnectionFactorySerializationTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/connection/ConnectionFactorySerializationTest.java index b800dd0280..2098ee6cac 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/connection/ConnectionFactorySerializationTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/connection/ConnectionFactorySerializationTest.java @@ -153,7 +153,7 @@ public class ConnectionFactorySerializationTest extends JMSTestBase { private void createDiscoveryFactoryUDP() throws Exception { // Deploy a connection factory with discovery - List bindings = new ArrayList(); + List bindings = new ArrayList<>(); bindings.add("MyConnectionFactory"); final String groupAddress = "1.2.3.4"; final int port = 1234; @@ -170,7 +170,7 @@ public class ConnectionFactorySerializationTest extends JMSTestBase { private void createDiscoveryFactoryJGroupsFile() throws Exception { // Deploy a connection factory with discovery - List bindings = new ArrayList(); + List bindings = new ArrayList<>(); bindings.add("MyConnectionFactory"); JGroupsFileBroadcastEndpointFactory config = new JGroupsFileBroadcastEndpointFactory().setChannelName("myChannel").setFile("/META-INF/myfile.xml"); @@ -184,7 +184,7 @@ public class ConnectionFactorySerializationTest extends JMSTestBase { private void createDiscoveryFactoryJGroupsProperties() throws Exception { // Deploy a connection factory with discovery - List bindings = new ArrayList(); + List bindings = new ArrayList<>(); bindings.add("MyConnectionFactory"); JGroupsPropertiesBroadcastEndpointFactory config = new JGroupsPropertiesBroadcastEndpointFactory().setChannelName("myChannel").setProperties("param=1,param2=2"); @@ -222,7 +222,7 @@ public class ConnectionFactorySerializationTest extends JMSTestBase { jmsServer.getActiveMQServer().getConfiguration().getConnectorConfigurations().put(main2.getName(), main2); - ArrayList connectorNames = new ArrayList(); + ArrayList connectorNames = new ArrayList<>(); connectorNames.add(main.getName()); connectorNames.add(main2.getName()); ConnectionFactoryConfiguration configuration = new ConnectionFactoryConfigurationImpl().setName("MyConnectionFactory").setHA(b).setConnectorNames(connectorNames).setClientID("clientID").setClientFailureCheckPeriod(-1).setConnectionTTL(-2).setFactoryType(JMSFactoryType.CF).setCallTimeout(-3).setCallFailoverTimeout(-4).setCacheLargeMessagesClient(b).setMinLargeMessageSize(-5).setConsumerWindowSize(-6).setConsumerMaxRate(-7).setConfirmationWindowSize(-8).setProducerWindowSize(-9).setProducerMaxRate(-10).setBlockOnAcknowledge(b).setBlockOnDurableSend(b).setBlockOnNonDurableSend(b).setAutoGroup(b).setPreAcknowledge(b).setLoadBalancingPolicyClassName("foobar").setTransactionBatchSize(-11).setDupsOKBatchSize(-12).setUseGlobalPools(b).setScheduledThreadPoolMaxSize(-13).setThreadPoolMaxSize(-14).setRetryInterval(-15).setRetryIntervalMultiplier(-16).setMaxRetryInterval(-17).setReconnectAttempts(-18).setFailoverOnInitialConnection(b).setGroupID("groupID"); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/connection/InvalidConnectorTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/connection/InvalidConnectorTest.java index 46c2d767e1..d1b4588b0a 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/connection/InvalidConnectorTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/connection/InvalidConnectorTest.java @@ -34,10 +34,10 @@ public class InvalidConnectorTest extends JMSTestBase { @Test public void testInvalidConnector() throws Exception { - Map params = new HashMap(); + Map params = new HashMap<>(); params.put(TransportConstants.HOST_PROP_NAME, "0.0.0.0"); - List connectorConfigs = new ArrayList(); + List connectorConfigs = new ArrayList<>(); connectorConfigs.add(new TransportConfiguration(NETTY_CONNECTOR_FACTORY, params)); int retryInterval = 1000; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/jms2client/JmsProducerCompletionListenerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/jms2client/JmsProducerCompletionListenerTest.java index 5d11e45cc7..debcb03004 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/jms2client/JmsProducerCompletionListenerTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/jms2client/JmsProducerCompletionListenerTest.java @@ -113,7 +113,7 @@ public class JmsProducerCompletionListenerTest extends JMSTestBase { @Test public void testInvalidCallFromListener() throws InterruptedException { JMSConsumer consumer = context.createConsumer(queue); - List listeners = new ArrayList(); + List listeners = new ArrayList<>(); for (int i = 0; i < 3; i++) { InvalidCompletionListener cl = new InvalidCompletionListener(context, i); listeners.add(cl); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/server/JMSServerStartStopTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/server/JMSServerStartStopTest.java index f8b3b806c1..c18b4310ab 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/server/JMSServerStartStopTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/server/JMSServerStartStopTest.java @@ -54,7 +54,7 @@ public class JMSServerStartStopTest extends ActiveMQTestBase { private Connection conn; private ActiveMQConnectionFactory jbcf; - private final Set connectionFactories = new HashSet(); + private final Set connectionFactories = new HashSet<>(); @Override @Before diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/server/config/JMSConfigurationTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/server/config/JMSConfigurationTest.java index bb659c6900..03e64e6c4f 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/server/config/JMSConfigurationTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/server/config/JMSConfigurationTest.java @@ -54,7 +54,7 @@ public class JMSConfigurationTest extends ActiveMQTestBase { JMSConfiguration jmsConfiguration = new JMSConfigurationImpl(); TransportConfiguration connectorConfig = new TransportConfiguration(InVMConnectorFactory.class.getName()); - List transportConfigs = new ArrayList(); + List transportConfigs = new ArrayList<>(); transportConfigs.add(connectorConfig); ConnectionFactoryConfiguration cfConfig = new ConnectionFactoryConfigurationImpl().setName(RandomUtil.randomString()).setConnectorNames(registerConnectors(coreServer, transportConfigs)).setBindings("/cf/binding1", "/cf/binding2"); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/server/management/ConnectionFactoryControlTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/server/management/ConnectionFactoryControlTest.java index 4873c92884..7436ce1f9c 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/server/management/ConnectionFactoryControlTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/server/management/ConnectionFactoryControlTest.java @@ -95,7 +95,7 @@ public class ConnectionFactoryControlTest extends ManagementTestBase { JMSUtil.JMXListener listener = new JMSUtil.JMXListener(); this.mbeanServer.addNotificationListener(ObjectNameBuilder.DEFAULT.getJMSServerObjectName(), listener, null, null); - List connectors = new ArrayList(); + List connectors = new ArrayList<>(); connectors.add("invm"); this.jmsServerManager.createConnectionFactory("NewCF", false, JMSFactoryType.CF, connectors, "/NewConnectionFactory"); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/server/management/JMSQueueControlTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/server/management/JMSQueueControlTest.java index ac9b28eee0..6cad5d4af5 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/server/management/JMSQueueControlTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/server/management/JMSQueueControlTest.java @@ -1374,7 +1374,7 @@ public class JMSQueueControlTest extends ManagementTestBase { JMSUtil.JMXListener listener = new JMSUtil.JMXListener(); this.mbeanServer.addNotificationListener(ObjectNameBuilder.DEFAULT.getJMSServerObjectName(), listener, null, null); - List connectors = new ArrayList(); + List connectors = new ArrayList<>(); connectors.add("invm"); String testQueueName = "newQueue"; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/server/management/JMSServerControlTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/server/management/JMSServerControlTest.java index bf06eb6d88..659d7857d8 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/server/management/JMSServerControlTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/server/management/JMSServerControlTest.java @@ -1027,11 +1027,11 @@ public class JMSServerControlTest extends ManagementTestBase { class FakeJMSStorageManager implements JMSStorageManager { - Map destinationMap = new HashMap(); + Map destinationMap = new HashMap<>(); - Map connectionFactoryMap = new HashMap(); + Map connectionFactoryMap = new HashMap<>(); - ConcurrentHashMap> persistedJNDIMap = new ConcurrentHashMap>(); + ConcurrentHashMap> persistedJNDIMap = new ConcurrentHashMap<>(); JMSStorageManager delegate; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/server/management/TopicControlTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/server/management/TopicControlTest.java index f46578e54f..11d2b43350 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/server/management/TopicControlTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/jms/server/management/TopicControlTest.java @@ -516,7 +516,7 @@ public class TopicControlTest extends ManagementTestBase { JMSUtil.JMXListener listener = new JMSUtil.JMXListener(); this.mbeanServer.addNotificationListener(ObjectNameBuilder.DEFAULT.getJMSServerObjectName(), listener, null, null); - List connectors = new ArrayList(); + List connectors = new ArrayList<>(); connectors.add("invm"); String testTopicName = "newTopic"; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/journal/NIOJournalCompactTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/journal/NIOJournalCompactTest.java index 99679e0185..b91b89fd22 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/journal/NIOJournalCompactTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/journal/NIOJournalCompactTest.java @@ -67,31 +67,31 @@ public class NIOJournalCompactTest extends JournalImplTestBase { @Test public void testControlFile() throws Exception { - ArrayList dataFiles = new ArrayList(); + ArrayList dataFiles = new ArrayList<>(); for (int i = 0; i < 5; i++) { SequentialFile file = fileFactory.createSequentialFile("file-" + i + ".tst"); dataFiles.add(new JournalFileImpl(file, 0, JournalImpl.FORMAT_VERSION)); } - ArrayList newFiles = new ArrayList(); + ArrayList newFiles = new ArrayList<>(); for (int i = 0; i < 3; i++) { SequentialFile file = fileFactory.createSequentialFile("file-" + i + ".tst.new"); newFiles.add(new JournalFileImpl(file, 0, JournalImpl.FORMAT_VERSION)); } - ArrayList> renames = new ArrayList>(); - renames.add(new Pair("a", "b")); - renames.add(new Pair("c", "d")); + ArrayList> renames = new ArrayList<>(); + renames.add(new Pair<>("a", "b")); + renames.add(new Pair<>("c", "d")); AbstractJournalUpdateTask.writeControlFile(fileFactory, dataFiles, newFiles, renames); - ArrayList strDataFiles = new ArrayList(); + ArrayList strDataFiles = new ArrayList<>(); - ArrayList strNewFiles = new ArrayList(); + ArrayList strNewFiles = new ArrayList<>(); - ArrayList> renamesRead = new ArrayList>(); + ArrayList> renamesRead = new ArrayList<>(); Assert.assertNotNull(JournalCompactor.readControlFile(fileFactory, strDataFiles, strNewFiles, renamesRead)); @@ -234,9 +234,9 @@ public class NIOJournalCompactTest extends JournalImplTestBase { journal.stop(); - List records1 = new ArrayList(); + List records1 = new ArrayList<>(); - List preparedRecords = new ArrayList(); + List preparedRecords = new ArrayList<>(); journal.start(); @@ -480,9 +480,9 @@ public class NIOJournalCompactTest extends JournalImplTestBase { setup(2, 60 * 1024, false); - ArrayList liveIDs = new ArrayList(); + ArrayList liveIDs = new ArrayList<>(); - ArrayList> transactedRecords = new ArrayList>(); + ArrayList> transactedRecords = new ArrayList<>(); final CountDownLatch latchDone = new CountDownLatch(1); final CountDownLatch latchWait = new CountDownLatch(1); @@ -566,7 +566,7 @@ public class NIOJournalCompactTest extends JournalImplTestBase { if (preXA) { prepare(transactionID, new SimpleEncoding(10, (byte) 0)); } - transactedRecords.add(new Pair(transactionID++, recordID)); + transactedRecords.add(new Pair<>(transactionID++, recordID)); } } @@ -1090,7 +1090,7 @@ public class NIOJournalCompactTest extends JournalImplTestBase { // add and remove some data to force reclaiming { - ArrayList ids = new ArrayList(); + ArrayList ids = new ArrayList<>(); for (int i = 0; i < NUMBER_OF_RECORDS; i++) { long id = idGenerator.generateID(); ids.add(id); @@ -1165,9 +1165,9 @@ public class NIOJournalCompactTest extends JournalImplTestBase { startJournal(); loadAndCheck(); - ArrayList listToDelete = new ArrayList(); + ArrayList listToDelete = new ArrayList<>(); - ArrayList expectedSizes = new ArrayList(); + ArrayList expectedSizes = new ArrayList<>(); for (int i = 0; i < 10; i++) { long id = idGenerator.generateID(); @@ -1241,7 +1241,7 @@ public class NIOJournalCompactTest extends JournalImplTestBase { journal.forceMoveNextFile(); - ArrayList listToDelete = new ArrayList(); + ArrayList listToDelete = new ArrayList<>(); for (int i = 0; i < 10; i++) { if (i == 5) { commit(tx); @@ -1287,7 +1287,7 @@ public class NIOJournalCompactTest extends JournalImplTestBase { journal.forceMoveNextFile(); - ArrayList listToDelete = new ArrayList(); + ArrayList listToDelete = new ArrayList<>(); for (int i = 0; i < 10; i++) { long id = idGenerator.generateID(); listToDelete.add(id); @@ -1330,7 +1330,7 @@ public class NIOJournalCompactTest extends JournalImplTestBase { journal.forceMoveNextFile(); - ArrayList listToDelete = new ArrayList(); + ArrayList listToDelete = new ArrayList<>(); for (int i = 0; i < 10; i++) { long id = idGenerator.generateID(); listToDelete.add(id); @@ -1380,7 +1380,7 @@ public class NIOJournalCompactTest extends JournalImplTestBase { journal.forceMoveNextFile(); - ArrayList listToDelete = new ArrayList(); + ArrayList listToDelete = new ArrayList<>(); for (int i = 0; i < 10; i++) { long id = idGenerator.generateID(); listToDelete.add(id); @@ -1436,7 +1436,7 @@ public class NIOJournalCompactTest extends JournalImplTestBase { journal.forceMoveNextFile(); - ArrayList listToDelete = new ArrayList(); + ArrayList listToDelete = new ArrayList<>(); for (int i = 0; i < 10; i++) { long id = idGenerator.generateID(); listToDelete.add(id); @@ -1545,9 +1545,9 @@ public class NIOJournalCompactTest extends JournalImplTestBase { startJournal(); loadAndCheck(); - ArrayList listToDelete = new ArrayList(); + ArrayList listToDelete = new ArrayList<>(); - ArrayList expectedSizes = new ArrayList(); + ArrayList expectedSizes = new ArrayList<>(); for (int i = 0; i < 10; i++) { long tx = idGenerator.generateID(); @@ -1639,7 +1639,7 @@ public class NIOJournalCompactTest extends JournalImplTestBase { storage.loadInternalOnly(); ((JournalImpl) storage.getMessageJournal()).setAutoReclaim(false); - final LinkedList survivingMsgs = new LinkedList(); + final LinkedList survivingMsgs = new LinkedList<>(); Runnable producerRunnable = new Runnable() { @Override diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/AddressControlTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/AddressControlTest.java index 0983ffa9c1..284d61df86 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/AddressControlTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/AddressControlTest.java @@ -125,7 +125,7 @@ public class AddressControlTest extends ManagementTestBase { Object[] roles = addressControl.getRoles(); Assert.assertEquals(0, roles.length); - Set newRoles = new HashSet(); + Set newRoles = new HashSet<>(); newRoles.add(role); server.getSecurityRepository().addMatch(address.toString(), newRoles); @@ -158,7 +158,7 @@ public class AddressControlTest extends ManagementTestBase { RoleInfo[] roles = RoleInfo.from(jsonString); Assert.assertEquals(0, roles.length); - Set newRoles = new HashSet(); + Set newRoles = new HashSet<>(); newRoles.add(role); server.getSecurityRepository().addMatch(address.toString(), newRoles); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/AddressControlUsingCoreTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/AddressControlUsingCoreTest.java index 3b415f0dd7..57181bf41d 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/AddressControlUsingCoreTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/AddressControlUsingCoreTest.java @@ -132,7 +132,7 @@ public class AddressControlUsingCoreTest extends ManagementTestBase { } Assert.assertEquals(0, roles.length); - Set newRoles = new HashSet(); + Set newRoles = new HashSet<>(); newRoles.add(role); server.getSecurityRepository().addMatch(address.toString(), newRoles); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/BridgeControlTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/BridgeControlTest.java index 43d7048804..d1eb9eaee5 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/BridgeControlTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/BridgeControlTest.java @@ -117,7 +117,7 @@ public class BridgeControlTest extends ManagementTestBase { public void setUp() throws Exception { super.setUp(); - Map acceptorParams = new HashMap(); + Map acceptorParams = new HashMap<>(); acceptorParams.put(TransportConstants.SERVER_ID_PROP_NAME, 1); TransportConfiguration acceptorConfig = new TransportConfiguration(InVMAcceptorFactory.class.getName(), acceptorParams, RandomUtil.randomString()); @@ -125,7 +125,7 @@ public class BridgeControlTest extends ManagementTestBase { CoreQueueConfiguration sourceQueueConfig = new CoreQueueConfiguration().setAddress(RandomUtil.randomString()).setName(RandomUtil.randomString()).setDurable(false); CoreQueueConfiguration targetQueueConfig = new CoreQueueConfiguration().setAddress(RandomUtil.randomString()).setName(RandomUtil.randomString()).setDurable(false); - List connectors = new ArrayList(); + List connectors = new ArrayList<>(); connectors.add(connectorConfig.getName()); Configuration conf_1 = createBasicConfig().addAcceptorConfiguration(acceptorConfig).addQueueConfiguration(targetQueueConfig); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/BridgeControlUsingCoreTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/BridgeControlUsingCoreTest.java index 025b1e9428..e917e0ad49 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/BridgeControlUsingCoreTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/BridgeControlUsingCoreTest.java @@ -104,7 +104,7 @@ public class BridgeControlUsingCoreTest extends ManagementTestBase { public void setUp() throws Exception { super.setUp(); - Map acceptorParams = new HashMap(); + Map acceptorParams = new HashMap<>(); acceptorParams.put(TransportConstants.SERVER_ID_PROP_NAME, 1); TransportConfiguration acceptorConfig = new TransportConfiguration(InVMAcceptorFactory.class.getName(), acceptorParams, RandomUtil.randomString()); @@ -112,7 +112,7 @@ public class BridgeControlUsingCoreTest extends ManagementTestBase { CoreQueueConfiguration sourceQueueConfig = new CoreQueueConfiguration().setAddress(RandomUtil.randomString()).setName(RandomUtil.randomString()).setDurable(false); CoreQueueConfiguration targetQueueConfig = new CoreQueueConfiguration().setAddress(RandomUtil.randomString()).setName(RandomUtil.randomString()).setDurable(false); - List connectors = new ArrayList(); + List connectors = new ArrayList<>(); connectors.add(connectorConfig.getName()); bridgeConfig = new BridgeConfiguration().setName(RandomUtil.randomString()).setQueueName(sourceQueueConfig.getName()).setForwardingAddress(targetQueueConfig.getAddress()).setRetryInterval(RandomUtil.randomPositiveLong()).setRetryIntervalMultiplier(RandomUtil.randomDouble()).setInitialConnectAttempts(RandomUtil.randomPositiveInt()).setReconnectAttempts(RandomUtil.randomPositiveInt()).setReconnectAttemptsOnSameNode(RandomUtil.randomPositiveInt()).setUseDuplicateDetection(RandomUtil.randomBoolean()).setConfirmationWindowSize(RandomUtil.randomPositiveInt()).setStaticConnectors(connectors); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/BroadcastGroupControlTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/BroadcastGroupControlTest.java index bc1fb651c4..e6759eb749 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/BroadcastGroupControlTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/BroadcastGroupControlTest.java @@ -83,7 +83,7 @@ public class BroadcastGroupControlTest extends ManagementTestBase { super.setUp(); TransportConfiguration connectorConfiguration = new TransportConfiguration(NETTY_CONNECTOR_FACTORY); - List connectorInfos = new ArrayList(); + List connectorInfos = new ArrayList<>(); connectorInfos.add(connectorConfiguration.getName()); broadcastGroupConfig = new BroadcastGroupConfiguration().setName(RandomUtil.randomString()).setBroadcastPeriod(RandomUtil.randomPositiveInt()).setConnectorInfos(connectorInfos).setEndpointFactory(new UDPBroadcastEndpointFactory().setGroupAddress("231.7.7.7").setGroupPort(1199).setLocalBindPort(1198)); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ClusterConnectionControl2Test.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ClusterConnectionControl2Test.java index 10027b0760..12fc1ab0f0 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ClusterConnectionControl2Test.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ClusterConnectionControl2Test.java @@ -103,7 +103,7 @@ public class ClusterConnectionControl2Test extends ManagementTestBase { String groupAddress = "231.7.7.7"; int groupPort = 9876; - Map acceptorParams_1 = new HashMap(); + Map acceptorParams_1 = new HashMap<>(); acceptorParams_1.put(TransportConstants.PORT_PROP_NAME, port_1); TransportConfiguration acceptorConfig_0 = new TransportConfiguration(ActiveMQTestBase.NETTY_ACCEPTOR_FACTORY); @@ -113,7 +113,7 @@ public class ClusterConnectionControl2Test extends ManagementTestBase { TransportConfiguration connectorConfig_0 = new TransportConfiguration(ActiveMQTestBase.NETTY_CONNECTOR_FACTORY); CoreQueueConfiguration queueConfig = new CoreQueueConfiguration().setAddress(RandomUtil.randomString()).setName(RandomUtil.randomString()).setDurable(false); - List connectorInfos = new ArrayList(); + List connectorInfos = new ArrayList<>(); connectorInfos.add("netty"); BroadcastGroupConfiguration broadcastGroupConfig = new BroadcastGroupConfiguration().setName(discoveryName).setBroadcastPeriod(250).setConnectorInfos(connectorInfos).setEndpointFactory(new UDPBroadcastEndpointFactory().setGroupAddress(groupAddress).setGroupPort(groupPort)); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ClusterConnectionControlTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ClusterConnectionControlTest.java index 1fb9c4367c..d32b054804 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ClusterConnectionControlTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ClusterConnectionControlTest.java @@ -187,14 +187,14 @@ public class ClusterConnectionControlTest extends ManagementTestBase { public void setUp() throws Exception { super.setUp(); - Map acceptorParams = new HashMap(); + Map acceptorParams = new HashMap<>(); acceptorParams.put(TransportConstants.SERVER_ID_PROP_NAME, 1); TransportConfiguration acceptorConfig = new TransportConfiguration(InVMAcceptorFactory.class.getName(), acceptorParams, RandomUtil.randomString()); TransportConfiguration connectorConfig = new TransportConfiguration(InVMConnectorFactory.class.getName(), acceptorParams, RandomUtil.randomString()); CoreQueueConfiguration queueConfig = new CoreQueueConfiguration().setAddress(RandomUtil.randomString()).setName(RandomUtil.randomString()).setDurable(false); - List connectors = new ArrayList(); + List connectors = new ArrayList<>(); connectors.add(connectorConfig.getName()); String discoveryGroupName = RandomUtil.randomString(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/JMXDomainTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/JMXDomainTest.java index 86a9d02426..2a357b0e4a 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/JMXDomainTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/JMXDomainTest.java @@ -40,7 +40,7 @@ public class JMXDomainTest extends ManagementTestBase { String jmxDomain_1 = ActiveMQDefaultConfiguration.getDefaultJmxDomain() + ".1"; - Map params = new HashMap(); + Map params = new HashMap<>(); params.put(TransportConstants.SERVER_ID_PROP_NAME, 1); Configuration config_1 = createBasicConfig().addAcceptorConfiguration(new TransportConfiguration(InVMAcceptorFactory.class.getName(), params)).setJMXDomain(jmxDomain_1); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementActivationTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementActivationTest.java index 5a538ff5b3..480f5367b6 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementActivationTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementActivationTest.java @@ -69,7 +69,7 @@ public class ManagementActivationTest extends FailoverTestBase { @Test public void testCreateConnectionFactory() throws Exception { - List connectorNames = new ArrayList(); + List connectorNames = new ArrayList<>(); connectorNames.add(connectorName); ConnectionFactoryConfiguration config = new ConnectionFactoryConfigurationImpl().setName("test").setConnectorNames(connectorNames).setBindings("/myConnectionFactory"); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementHelperTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementHelperTest.java index 16839e0372..d6bd6a43cc 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementHelperTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementHelperTest.java @@ -74,7 +74,7 @@ public class ManagementHelperTest extends Assert { double d = RandomUtil.randomDouble(); boolean b = RandomUtil.randomBoolean(); long l = RandomUtil.randomLong(); - Map map = new HashMap(); + Map map = new HashMap<>(); String key1 = RandomUtil.randomString(); int value1 = RandomUtil.randomInt(); String key2 = RandomUtil.randomString(); @@ -91,7 +91,7 @@ public class ManagementHelperTest extends Assert { map.put(key4, value4); map.put(key5, value5); - Map map2 = new HashMap(); + Map map2 = new HashMap<>(); String key2_1 = RandomUtil.randomString(); int value2_1 = RandomUtil.randomInt(); String key2_2 = RandomUtil.randomString(); @@ -108,7 +108,7 @@ public class ManagementHelperTest extends Assert { map2.put(key2_4, value2_4); map2.put(key2_5, value2_5); - Map map3 = new HashMap(); + Map map3 = new HashMap<>(); String key3_1 = RandomUtil.randomString(); int value3_1 = RandomUtil.randomInt(); String key3_2 = RandomUtil.randomString(); @@ -185,7 +185,7 @@ public class ManagementHelperTest extends Assert { String resource = RandomUtil.randomString(); String operationName = RandomUtil.randomString(); - Map map = new HashMap(); + Map map = new HashMap<>(); String key1 = RandomUtil.randomString(); String[] val1 = new String[]{"a", "b", "c"}; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementWithStompTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementWithStompTest.java index 1816d00ae8..96b6dc398c 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementWithStompTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/ManagementWithStompTest.java @@ -160,7 +160,7 @@ public class ManagementWithStompTest extends ManagementTestBase { public void setUp() throws Exception { super.setUp(); - Map params = new HashMap(); + Map params = new HashMap<>(); params.put(TransportConstants.PROTOCOLS_PROP_NAME, StompProtocolManagerFactory.STOMP_PROTOCOL_NAME); params.put(TransportConstants.PORT_PROP_NAME, TransportConstants.DEFAULT_STOMP_PORT); TransportConfiguration stompTransport = new TransportConfiguration(NettyAcceptorFactory.class.getName(), params); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/SecurityNotificationTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/SecurityNotificationTest.java index 98ee6f7d64..b3e20c9787 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/SecurityNotificationTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/management/SecurityNotificationTest.java @@ -90,7 +90,7 @@ public class SecurityNotificationTest extends ActiveMQTestBase { // guest can not create queue Role role = new Role("roleCanNotCreateQueue", true, true, false, true, false, true, true); - Set roles = new HashSet(); + Set roles = new HashSet<>(); roles.add(role); server.getSecurityRepository().addMatch(address.toString(), roles); ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager(); @@ -139,7 +139,7 @@ public class SecurityNotificationTest extends ActiveMQTestBase { securityManager.getConfiguration().setDefaultUser("guest"); Role role = new Role("notif", true, true, true, true, true, true, true); - Set roles = new HashSet(); + Set roles = new HashSet<>(); roles.add(role); server.getSecurityRepository().addMatch(ActiveMQDefaultConfiguration.getDefaultManagementNotificationAddress().toString(), roles); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/MQTTTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/MQTTTest.java index 66270142a2..f15af10bdd 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/MQTTTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/MQTTTest.java @@ -293,7 +293,7 @@ public class MQTTTest extends MQTTTestSupport { String RETAINED = "retained"; publisher.publish("foo", RETAINED.getBytes(), AT_LEAST_ONCE, true); - List messages = new ArrayList(); + List messages = new ArrayList<>(); for (int i = 0; i < 10; i++) { messages.add("TEST MESSAGE:" + i); } @@ -629,7 +629,7 @@ public class MQTTTest extends MQTTTestSupport { mqtt.setKeepAlive((short) 2); mqtt.setCleanSession(true); - final List publishList = new ArrayList(); + final List publishList = new ArrayList<>(); mqtt.setTracer(new Tracer() { @Override public void onReceive(MQTTFrame frame) { @@ -715,7 +715,7 @@ public class MQTTTest extends MQTTTestSupport { final MQTT mqtt = createMQTTConnection("resend", false); mqtt.setKeepAlive((short) 5); - final List publishList = new ArrayList(); + final List publishList = new ArrayList<>(); mqtt.setTracer(new Tracer() { @Override public void onReceive(MQTTFrame frame) { @@ -785,7 +785,7 @@ public class MQTTTest extends MQTTTestSupport { final MQTT mqtt = createMQTTConnection("nonclean-packetid", false); mqtt.setKeepAlive((short) 15); - final Map publishMap = new ConcurrentHashMap(); + final Map publishMap = new ConcurrentHashMap<>(); mqtt.setTracer(new Tracer() { @Override public void onReceive(MQTTFrame frame) { @@ -860,7 +860,7 @@ public class MQTTTest extends MQTTTestSupport { // If there is a good reason for this we should follow ActiveMQ. public void testPacketIdGeneratorCleanSession() throws Exception { final String[] cleanClientIds = new String[]{"", "clean-packetid", null}; - final Map publishMap = new ConcurrentHashMap(); + final Map publishMap = new ConcurrentHashMap<>(); MQTT[] mqtts = new MQTT[cleanClientIds.length]; for (int i = 0; i < cleanClientIds.length; i++) { mqtts[i] = createMQTTConnection("", true); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/MQTTTestSupport.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/MQTTTestSupport.java index 28cd8d308e..2e37110197 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/MQTTTestSupport.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/MQTTTestSupport.java @@ -55,7 +55,7 @@ public class MQTTTestSupport extends ActiveMQTestBase { protected int port = 1883; protected ActiveMQConnectionFactory cf; - protected LinkedList exceptions = new LinkedList(); + protected LinkedList exceptions = new LinkedList<>(); protected boolean persistent; protected String protocolConfig; protected String protocolScheme; @@ -134,7 +134,7 @@ public class MQTTTestSupport extends ActiveMQTestBase { // MQTT transport connectors as needed, the port variable is always supposed to be // assigned the primary MQTT connector's port. - HashMap params = new HashMap(); + HashMap params = new HashMap<>(); params.put(TransportConstants.PORT_PROP_NAME, "" + 5445); params.put(TransportConstants.PROTOCOLS_PROP_NAME, "CORE"); TransportConfiguration transportConfiguration = new TransportConfiguration(NETTY_ACCEPTOR_FACTORY, params); @@ -148,7 +148,7 @@ public class MQTTTestSupport extends ActiveMQTestBase { // MQTT transport connectors as needed, the port variable is always supposed to be // assigned the primary MQTT connector's port. - HashMap params = new HashMap(); + HashMap params = new HashMap<>(); params.put(TransportConstants.PORT_PROP_NAME, "" + port); params.put(TransportConstants.PROTOCOLS_PROP_NAME, "MQTT"); TransportConfiguration transportConfiguration = new TransportConfiguration(NETTY_ACCEPTOR_FACTORY, params); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/PahoMQTTTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/PahoMQTTTest.java index 73f52c01e1..bd912ffe6f 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/PahoMQTTTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/PahoMQTTTest.java @@ -60,7 +60,7 @@ public class PahoMQTTTest extends MQTTTestSupport { client.connect(); client.subscribe("test"); - final AtomicReference asyncError = new AtomicReference(); + final AtomicReference asyncError = new AtomicReference<>(); final CountDownLatch connectedDoneLatch = new CountDownLatch(CLIENTS); final CountDownLatch disconnectDoneLatch = new CountDownLatch(CLIENTS); final CountDownLatch sendBarrier = new CountDownLatch(1); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/util/ResourceLoadingSslContext.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/util/ResourceLoadingSslContext.java index 7312e62c39..91eef82064 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/util/ResourceLoadingSslContext.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/mqtt/imported/util/ResourceLoadingSslContext.java @@ -93,7 +93,7 @@ public class ResourceLoadingSslContext extends SslContext { private Collection createTrustManagers() throws Exception { KeyStore ks = createTrustManagerKeyStore(); if (ks == null) { - return new ArrayList(0); + return new ArrayList<>(0); } TrustManagerFactory tmf = TrustManagerFactory.getInstance(trustStoreAlgorithm); @@ -104,7 +104,7 @@ public class ResourceLoadingSslContext extends SslContext { private Collection createKeyManagers() throws Exception { KeyStore ks = createKeyManagerKeyStore(); if (ks == null) { - return new ArrayList(0); + return new ArrayList<>(0); } KeyManagerFactory tmf = KeyManagerFactory.getInstance(keyStoreAlgorithm); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/BasicOpenWireTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/BasicOpenWireTest.java index 01dafe0f0c..d2e3215bf1 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/BasicOpenWireTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/BasicOpenWireTest.java @@ -54,7 +54,7 @@ public class BasicOpenWireTest extends OpenWireTestBase { protected String messageTextPrefix = ""; protected boolean topic = true; - protected Map testQueues = new HashMap(); + protected Map testQueues = new HashMap<>(); @Override @Before diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/OpenWireTestBase.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/OpenWireTestBase.java index 675574e502..275fad6b61 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/OpenWireTestBase.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/OpenWireTestBase.java @@ -100,12 +100,12 @@ public class OpenWireTestBase extends ActiveMQTestBase { Map> settings = server.getConfiguration().getSecurityRoles(); if (settings == null) { - settings = new HashMap>(); + settings = new HashMap<>(); server.getConfiguration().setSecurityRoles(settings); } Set anySet = settings.get("#"); if (anySet == null) { - anySet = new HashSet(); + anySet = new HashSet<>(); settings.put("#", anySet); } anySet.add(senderRole); @@ -129,7 +129,7 @@ public class OpenWireTestBase extends ActiveMQTestBase { } protected void registerConnectionFactory() throws Exception { - List connectorConfigs = new ArrayList(); + List connectorConfigs = new ArrayList<>(); connectorConfigs.add(new TransportConfiguration(INVM_CONNECTOR_FACTORY)); createCF(connectorConfigs, "/cf"); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/JMSMessageTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/JMSMessageTest.java index 43cf62e0af..0d44282b1d 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/JMSMessageTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/JMSMessageTest.java @@ -263,7 +263,7 @@ public class JMSMessageTest extends BasicOpenWireTest { private long expiration; private int priority; private String text; - private final HashMap props = new HashMap(); + private final HashMap props = new HashMap<>(); @Override public String getJMSMessageID() throws JMSException { @@ -430,7 +430,7 @@ public class JMSMessageTest extends BasicOpenWireTest { @Override public Enumeration getPropertyNames() throws JMSException { - return new Vector(props.keySet()).elements(); + return new Vector<>(props.keySet()).elements(); } @Override diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/JmsConnectionStartStopTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/JmsConnectionStartStopTest.java index 3606200318..c538aef52c 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/JmsConnectionStartStopTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/JmsConnectionStartStopTest.java @@ -119,7 +119,7 @@ public class JmsConnectionStartStopTest extends BasicOpenWireTest { @Test public void testConcurrentSessionCreateWithStart() throws Exception { ThreadPoolExecutor executor = new ThreadPoolExecutor(50, Integer.MAX_VALUE, 60L, TimeUnit.SECONDS, new SynchronousQueue()); - final Vector exceptions = new Vector(); + final Vector exceptions = new Vector<>(); final AtomicInteger counter = new AtomicInteger(0); final Random rand = new Random(); Runnable createSessionTask = new Runnable() { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/JmsConsumerResetActiveListenerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/JmsConsumerResetActiveListenerTest.java index b50abb66f5..04a331e793 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/JmsConsumerResetActiveListenerTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/JmsConsumerResetActiveListenerTest.java @@ -53,7 +53,7 @@ public class JmsConsumerResetActiveListenerTest extends BasicOpenWireTest { final CountDownLatch latch = new CountDownLatch(2); final AtomicBoolean first = new AtomicBoolean(true); - final Vector results = new Vector(); + final Vector results = new Vector<>(); consumer.setMessageListener(new MessageListener() { @Override @@ -105,7 +105,7 @@ public class JmsConsumerResetActiveListenerTest extends BasicOpenWireTest { final CountDownLatch latch = new CountDownLatch(2); final AtomicBoolean first = new AtomicBoolean(true); - final Vector results = new Vector(); + final Vector results = new Vector<>(); consumer.setMessageListener(new MessageListener() { @Override diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/JmsTopicRequestReplyTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/JmsTopicRequestReplyTest.java index e31621d023..5228d03155 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/JmsTopicRequestReplyTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/JmsTopicRequestReplyTest.java @@ -48,7 +48,7 @@ public class JmsTopicRequestReplyTest extends BasicOpenWireTest implements Messa private MessageProducer replyProducer; private Session serverSession; private Destination requestDestination; - private List failures = new Vector(); + private List failures = new Vector<>(); private boolean dynamicallyCreateProducer; private String clientSideClientID; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/JmsTransactionTestSupport.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/JmsTransactionTestSupport.java index 21e0444021..e2cd32d01e 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/JmsTransactionTestSupport.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/JmsTransactionTestSupport.java @@ -53,8 +53,8 @@ public abstract class JmsTransactionTestSupport extends BasicOpenWireTest implem protected int batchCount = 10; protected int batchSize = 20; - private List unackMessages = new ArrayList(MESSAGE_COUNT); - private List ackMessages = new ArrayList(MESSAGE_COUNT); + private List unackMessages = new ArrayList<>(MESSAGE_COUNT); + private List ackMessages = new ArrayList<>(MESSAGE_COUNT); private boolean resendPhase; @Override @@ -175,7 +175,7 @@ public abstract class JmsTransactionTestSupport extends BasicOpenWireTest implem // receives the first message beginTx(); - ArrayList messages = new ArrayList(); + ArrayList messages = new ArrayList<>(); System.out.println("About to consume message 1"); Message message = consumer.receive(1000); messages.add(message); @@ -212,7 +212,7 @@ public abstract class JmsTransactionTestSupport extends BasicOpenWireTest implem // receives the first message beginTx(); - ArrayList messages = new ArrayList(); + ArrayList messages = new ArrayList<>(); System.out.println("About to consume message 1"); Message message = consumer.receive(1000); messages.add(message); @@ -254,7 +254,7 @@ public abstract class JmsTransactionTestSupport extends BasicOpenWireTest implem commitTx(); // receives the first message - ArrayList messages = new ArrayList(); + ArrayList messages = new ArrayList<>(); System.out.println("About to consume message 1"); beginTx(); Message message = consumer.receive(1000); @@ -303,7 +303,7 @@ public abstract class JmsTransactionTestSupport extends BasicOpenWireTest implem commitTx(); // receives the first message - ArrayList messages = new ArrayList(); + ArrayList messages = new ArrayList<>(); System.out.println("About to consume message 1"); beginTx(); Message message = consumer.receive(1000); @@ -348,7 +348,7 @@ public abstract class JmsTransactionTestSupport extends BasicOpenWireTest implem System.out.println("Sent 0: " + outbound[0]); System.out.println("Sent 1: " + outbound[1]); - ArrayList messages = new ArrayList(); + ArrayList messages = new ArrayList<>(); beginTx(); Message message = consumer.receive(1000); messages.add(message); @@ -400,7 +400,7 @@ public abstract class JmsTransactionTestSupport extends BasicOpenWireTest implem System.out.println("Sent 0: " + outbound[0]); System.out.println("Sent 1: " + outbound[1]); - ArrayList messages = new ArrayList(); + ArrayList messages = new ArrayList<>(); beginTx(); TextMessage message = (TextMessage) consumer.receive(1000); assertEquals(outbound[0], message); @@ -551,7 +551,7 @@ public abstract class JmsTransactionTestSupport extends BasicOpenWireTest implem @Test public void testChangeMutableObjectInObjectMessageThenRollback() throws Exception { - ArrayList list = new ArrayList(); + ArrayList list = new ArrayList<>(); list.add("First"); Message outbound = session.createObjectMessage(list); outbound.setStringProperty("foo", "abc"); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/MessageListenerRedeliveryTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/MessageListenerRedeliveryTest.java index d07ec1aa71..5606a6a36e 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/MessageListenerRedeliveryTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/openwire/amq/MessageListenerRedeliveryTest.java @@ -280,7 +280,7 @@ public class MessageListenerRedeliveryTest extends BasicOpenWireTest { final CountDownLatch gotMessage = new CountDownLatch(2); final AtomicInteger count = new AtomicInteger(0); final int maxDeliveries = getRedeliveryPolicy().getMaximumRedeliveries(); - final ArrayList received = new ArrayList(); + final ArrayList received = new ArrayList<>(); consumer.setMessageListener(new MessageListener() { @Override public void onMessage(Message message) { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/MultipleProducersPagingTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/MultipleProducersPagingTest.java index a57c781ba2..0adcc2f6ed 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/MultipleProducersPagingTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/MultipleProducersPagingTest.java @@ -64,7 +64,7 @@ public class MultipleProducersPagingTest extends ActiveMQTestBase { private AtomicLong msgReceived; private AtomicLong msgSent; - private final Set connections = new HashSet(); + private final Set connections = new HashSet<>(); private EmbeddedJMS jmsServer; private ConnectionFactory cf; private Queue queue; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingSendTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingSendTest.java index db8a2eea0f..5f736fc678 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingSendTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/PagingSendTest.java @@ -284,7 +284,7 @@ public class PagingSendTest extends ActiveMQTestBase { public List sendMessageBatch(int batchSize, ClientSession session, SimpleString queueAddr) throws ActiveMQException { - List messageIds = new ArrayList(); + List messageIds = new ArrayList<>(); ClientProducer producer = session.createProducer(queueAddr); for (int i = 0; i < batchSize; i++) { Message message = session.createMessage(true); @@ -308,7 +308,7 @@ public class PagingSendTest extends ActiveMQTestBase { public void checkBatchMessagesAreNotPagedTwice(Queue queue) throws Exception { LinkedListIterator pageIterator = queue.totalIterator(); - Set messageOrderSet = new HashSet(); + Set messageOrderSet = new HashSet<>(); int duplicates = 0; while (pageIterator.hasNext()) { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/SpawnedServerSupport.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/SpawnedServerSupport.java index 68986de558..cad965c9ba 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/SpawnedServerSupport.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/paging/SpawnedServerSupport.java @@ -73,7 +73,7 @@ public class SpawnedServerSupport { } protected static final ClusterConnectionConfiguration setupClusterConn(String connectorName, String... connectors) { - List connectorList = new LinkedList(); + List connectorList = new LinkedList<>(); for (String conn : connectors) { connectorList.add(conn); } @@ -97,7 +97,7 @@ public class SpawnedServerSupport { else { className = NettyConnectorFactory.class.getName(); } - Map serverParams = new HashMap(); + Map serverParams = new HashMap<>(); serverParams.put(org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants.PORT_PROP_NAME, port); return new TransportConfiguration(className, serverParams); } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/AddressSettingsConfigurationStorageTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/AddressSettingsConfigurationStorageTest.java index a03c5a22b3..cca5ed4283 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/AddressSettingsConfigurationStorageTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/AddressSettingsConfigurationStorageTest.java @@ -37,7 +37,7 @@ public class AddressSettingsConfigurationStorageTest extends StorageManagerTestB public void setUp() throws Exception { super.setUp(); - mapExpectedAddresses = new HashMap(); + mapExpectedAddresses = new HashMap<>(); } protected void addAddress(JournalStorageManager journal1, String address, AddressSettings setting) throws Exception { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/DeleteMessagesOnStartupTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/DeleteMessagesOnStartupTest.java index 718dccc03c..8b783e9909 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/DeleteMessagesOnStartupTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/DeleteMessagesOnStartupTest.java @@ -37,14 +37,14 @@ public class DeleteMessagesOnStartupTest extends StorageManagerTestBase { volatile boolean deleteMessages = false; - ArrayList deletedMessage = new ArrayList(); + ArrayList deletedMessage = new ArrayList<>(); @Test public void testDeleteMessagesOnStartup() throws Exception { createStorage(); Queue theQueue = new FakeQueue(new SimpleString("")); - HashMap queues = new HashMap(); + HashMap queues = new HashMap<>(); queues.put(100L, theQueue); ServerMessage msg = new ServerMessageImpl(1, 100); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/JMSConnectionFactoryConfigurationStorageTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/JMSConnectionFactoryConfigurationStorageTest.java index 0bf1ec4ed7..8989b278fc 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/JMSConnectionFactoryConfigurationStorageTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/JMSConnectionFactoryConfigurationStorageTest.java @@ -41,7 +41,7 @@ public class JMSConnectionFactoryConfigurationStorageTest extends StorageManager public void setUp() throws Exception { super.setUp(); - mapExpectedCFs = new HashMap(); + mapExpectedCFs = new HashMap<>(); } protected void addSetting(PersistedConnectionFactory setting) throws Exception { @@ -54,7 +54,7 @@ public class JMSConnectionFactoryConfigurationStorageTest extends StorageManager createJMSStorage(); - List transportConfigs = new ArrayList(); + List transportConfigs = new ArrayList<>(); for (int i = 0; i < 5; i++) { transportConfigs.add("c1-" + i); @@ -126,16 +126,16 @@ public class JMSConnectionFactoryConfigurationStorageTest extends StorageManager str[i] = "str" + i; } - List connectorConfigs = new ArrayList(); - Map liveParams = new HashMap(); + List connectorConfigs = new ArrayList<>(); + Map liveParams = new HashMap<>(); liveParams.put(TransportConstants.PORT_PROP_NAME, 5665); - Map backupParams = new HashMap(); + Map backupParams = new HashMap<>(); backupParams.put(TransportConstants.PORT_PROP_NAME, 5775); - Map liveParams2 = new HashMap(); + Map liveParams2 = new HashMap<>(); liveParams2.put(TransportConstants.PORT_PROP_NAME, 6665); ConnectionFactoryConfiguration config = new ConnectionFactoryConfigurationImpl().setName("some-name").setConnectorNames(connectorConfigs).setBindings(str).setCallTimeout(RandomUtil.randomPositiveLong()); - List> connectors = new ArrayList>(); + List> connectors = new ArrayList<>(); connectors.add(new Pair(RandomUtil.randomString(), null)); //config.setConnectorNames(connectors); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/JMSDynamicConfigTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/JMSDynamicConfigTest.java index 1a1430d526..8d9dbfaee7 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/JMSDynamicConfigTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/JMSDynamicConfigTest.java @@ -46,7 +46,7 @@ public class JMSDynamicConfigTest extends JMSTestBase { @Test public void testStart() throws Exception { - ArrayList connectors = new ArrayList(); + ArrayList connectors = new ArrayList<>(); connectors.add("invm"); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/RestartSMTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/RestartSMTest.java index f5dea62b9c..a60e05fa3e 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/RestartSMTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/RestartSMTest.java @@ -74,11 +74,11 @@ public class RestartSMTest extends ActiveMQTestBase { journal.start(); - List queueBindingInfos = new ArrayList(); + List queueBindingInfos = new ArrayList<>(); journal.loadBindingJournal(queueBindingInfos, new ArrayList()); - Map queues = new HashMap(); + Map queues = new HashMap<>(); journal.loadMessageJournal(postOffice, null, null, null, null, null, null, new FakeJournalLoader()); @@ -88,11 +88,11 @@ public class RestartSMTest extends ActiveMQTestBase { journal.start(); - queues = new HashMap(); + queues = new HashMap<>(); journal.loadMessageJournal(postOffice, null, null, null, null, null, null, new FakeJournalLoader()); - queueBindingInfos = new ArrayList(); + queueBindingInfos = new ArrayList<>(); journal.loadBindingJournal(queueBindingInfos, new ArrayList()); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/RolesConfigurationStorageTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/RolesConfigurationStorageTest.java index 1ebf8ad369..c0aaf86a62 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/RolesConfigurationStorageTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/RolesConfigurationStorageTest.java @@ -36,7 +36,7 @@ public class RolesConfigurationStorageTest extends StorageManagerTestBase { public void setUp() throws Exception { super.setUp(); - mapExpectedSets = new HashMap(); + mapExpectedSets = new HashMap<>(); } protected void addSetting(PersistedRoles setting) throws Exception { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/TransportConfigurationEncodingSupportTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/TransportConfigurationEncodingSupportTest.java index 3ee521b2c5..ec4b666aa6 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/TransportConfigurationEncodingSupportTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/persistence/TransportConfigurationEncodingSupportTest.java @@ -48,7 +48,7 @@ public class TransportConfigurationEncodingSupportTest extends Assert { @Test public void testTransportConfiguration() throws Exception { - Map params = new HashMap(); + Map params = new HashMap<>(); params.put(TransportConstants.PORT_PROP_NAME, 5665); params.put(TransportConstants.HOST_PROP_NAME, RandomUtil.randomString()); TransportConfiguration config = new TransportConfiguration(NettyConnectorFactory.class.getName(), params); @@ -72,18 +72,18 @@ public class TransportConfigurationEncodingSupportTest extends Assert { @Test public void testTransportConfigurations() throws Exception { - List> connectorConfigs = new ArrayList>(); - Map liveParams = new HashMap(); + List> connectorConfigs = new ArrayList<>(); + Map liveParams = new HashMap<>(); liveParams.put(TransportConstants.PORT_PROP_NAME, 5665); TransportConfiguration live1 = new TransportConfiguration(NettyConnectorFactory.class.getName(), liveParams); - Map backupParams = new HashMap(); + Map backupParams = new HashMap<>(); backupParams.put(TransportConstants.PORT_PROP_NAME, 5775); TransportConfiguration backup1 = new TransportConfiguration(NettyConnectorFactory.class.getName(), backupParams); - Map liveParams2 = new HashMap(); + Map liveParams2 = new HashMap<>(); liveParams2.put(TransportConstants.PORT_PROP_NAME, 6665); TransportConfiguration live2 = new TransportConfiguration(NettyConnectorFactory.class.getName(), liveParams2); - connectorConfigs.add(new Pair(live1, backup1)); + connectorConfigs.add(new Pair<>(live1, backup1)); connectorConfigs.add(new Pair(live2, null)); ActiveMQBuffer buffer = ActiveMQBuffers.fixedBuffer(TransportConfigurationEncodingSupport.getEncodeSize(connectorConfigs)); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/proton/ProtonTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/proton/ProtonTest.java index 7663f69f19..5d628f9d38 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/proton/ProtonTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/proton/ProtonTest.java @@ -94,7 +94,7 @@ public class ProtonTest extends ActiveMQTestBase { super.setUp(); disableCheckThread(); server = this.createServer(true, true); - HashMap params = new HashMap(); + HashMap params = new HashMap<>(); params.put(TransportConstants.PORT_PROP_NAME, "5672"); params.put(TransportConstants.PROTOCOLS_PROP_NAME, "AMQP"); TransportConfiguration transportConfiguration = new TransportConfiguration(NETTY_ACCEPTOR_FACTORY, params); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/ActiveMQMessageHandlerSecurityTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/ActiveMQMessageHandlerSecurityTest.java index 13d15600a9..544ebeab38 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/ActiveMQMessageHandlerSecurityTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/ActiveMQMessageHandlerSecurityTest.java @@ -68,7 +68,7 @@ public class ActiveMQMessageHandlerSecurityTest extends ActiveMQRATestBase { securityManager.getConfiguration().addUser("testuser", "testpassword"); securityManager.getConfiguration().addRole("testuser", "arole"); Role role = new Role("arole", false, true, false, false, false, false, false); - Set roles = new HashSet(); + Set roles = new HashSet<>(); roles.add(role); server.getSecurityRepository().addMatch(MDBQUEUEPREFIXED, roles); ActiveMQResourceAdapter qResourceAdapter = newResourceAdapter(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/JMSContextTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/JMSContextTest.java index 0fc7416fc3..756127f0aa 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/JMSContextTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/JMSContextTest.java @@ -58,7 +58,7 @@ public class JMSContextTest extends ActiveMQRATestBase { securityManager.getConfiguration().addRole("testuser", "arole"); securityManager.getConfiguration().addRole("guest", "arole"); Role role = new Role("arole", true, true, true, true, true, true, true); - Set roles = new HashSet(); + Set roles = new HashSet<>(); roles.add(role); server.getSecurityRepository().addMatch(MDBQUEUEPREFIXED, roles); resourceAdapter = new ActiveMQResourceAdapter(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/OutgoingConnectionTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/OutgoingConnectionTest.java index 10723a59eb..e9fbff3ba3 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/OutgoingConnectionTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/OutgoingConnectionTest.java @@ -83,7 +83,7 @@ public class OutgoingConnectionTest extends ActiveMQRATestBase { securityManager.getConfiguration().addRole("testuser", "arole"); securityManager.getConfiguration().addRole("guest", "arole"); Role role = new Role("arole", true, true, true, true, true, true, true); - Set roles = new HashSet(); + Set roles = new HashSet<>(); roles.add(role); server.getSecurityRepository().addMatch(MDBQUEUEPREFIXED, roles); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/OutgoingConnectionTestJTA.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/OutgoingConnectionTestJTA.java index a1abc48429..1b32d2c07b 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/OutgoingConnectionTestJTA.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/OutgoingConnectionTestJTA.java @@ -72,7 +72,7 @@ public class OutgoingConnectionTestJTA extends ActiveMQRATestBase { ((ActiveMQJAASSecurityManager) server.getSecurityManager()).getConfiguration().addRole("testuser", "arole"); ((ActiveMQJAASSecurityManager) server.getSecurityManager()).getConfiguration().addRole("guest", "arole"); Role role = new Role("arole", true, true, true, true, true, true, true); - Set roles = new HashSet(); + Set roles = new HashSet<>(); roles.add(role); server.getSecurityRepository().addMatch(MDBQUEUEPREFIXED, roles); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/ResourceAdapterTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/ResourceAdapterTest.java index 6bce079f09..272214b894 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/ResourceAdapterTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ra/ResourceAdapterTest.java @@ -620,7 +620,7 @@ public class ResourceAdapterTest extends ActiveMQRATestBase { qResourceAdapter.setPasswordCodec(DefaultSensitiveStringCodec.class.getName() + ";key=anotherkey"); DefaultSensitiveStringCodec codec = new DefaultSensitiveStringCodec(); - Map prop = new HashMap(); + Map prop = new HashMap<>(); prop.put("key", "anotherkey"); codec.init(prop); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/remoting/BatchDelayTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/remoting/BatchDelayTest.java index 2548fc6393..78ca02ca5c 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/remoting/BatchDelayTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/remoting/BatchDelayTest.java @@ -48,7 +48,7 @@ public class BatchDelayTest extends ActiveMQTestBase { public void setUp() throws Exception { super.setUp(); - Map params = new HashMap(); + Map params = new HashMap<>(); params.put(TransportConstants.BATCH_DELAY, DELAY); TransportConfiguration tc = new TransportConfiguration(NETTY_ACCEPTOR_FACTORY, params); @@ -59,7 +59,7 @@ public class BatchDelayTest extends ActiveMQTestBase { } protected ClientSessionFactory createSessionFactory() throws Exception { - Map params = new HashMap(); + Map params = new HashMap<>(); params.put(TransportConstants.BATCH_DELAY, DELAY); ServerLocator locator = ActiveMQClient.createServerLocatorWithoutHA(createTransportConfiguration(true, false, params)); addServerLocator(locator); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/remoting/DirectDeliverTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/remoting/DirectDeliverTest.java index 6a06a88677..897cec08f7 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/remoting/DirectDeliverTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/remoting/DirectDeliverTest.java @@ -49,7 +49,7 @@ public class DirectDeliverTest extends ActiveMQTestBase { public void setUp() throws Exception { super.setUp(); - Map params = new HashMap(); + Map params = new HashMap<>(); params.put(TransportConstants.DIRECT_DELIVER, true); TransportConfiguration tc = new TransportConfiguration(NettyAcceptorFactory.class.getName(), params); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/remoting/NetworkAddressTestBase.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/remoting/NetworkAddressTestBase.java index 1fb4cef917..366d55d4a1 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/remoting/NetworkAddressTestBase.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/remoting/NetworkAddressTestBase.java @@ -62,7 +62,7 @@ public abstract class NetworkAddressTestBase extends ActiveMQTestBase { } public static Map getAddressForEachNetworkInterface() throws Exception { - Map map = new HashMap(); + Map map = new HashMap<>(); Enumeration ifaces = NetworkInterface.getNetworkInterfaces(); while (ifaces.hasMoreElements()) { NetworkInterface iface = ifaces.nextElement(); @@ -183,10 +183,10 @@ public abstract class NetworkAddressTestBase extends ActiveMQTestBase { final int localPort) throws Exception { System.out.println("acceptor=" + acceptorHost + ", connector=" + connectorHost + ", mustConnect=" + mustConnect); - Map params = new HashMap(); + Map params = new HashMap<>(); params.put(getHostPropertyKey(), acceptorHost); TransportConfiguration acceptorConfig = new TransportConfiguration(getAcceptorFactoryClassName(), params); - Set transportConfigs = new HashSet(); + Set transportConfigs = new HashSet<>(); transportConfigs.add(acceptorConfig); Configuration config = createDefaultNettyConfig(); @@ -195,7 +195,7 @@ public abstract class NetworkAddressTestBase extends ActiveMQTestBase { try { messagingService.start(); - params = new HashMap(); + params = new HashMap<>(); params.put(getHostPropertyKey(), connectorHost); if (localPort != 0) { params.put(getLocalPortProperty(), localPort); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/remoting/ReconnectTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/remoting/ReconnectTest.java index 268b10be63..c344591870 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/remoting/ReconnectTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/remoting/ReconnectTest.java @@ -188,7 +188,7 @@ public class ReconnectTest extends ActiveMQTestBase { } private ServerSession[] countMetadata(ActiveMQServer server, String parameter, int expected) throws Exception { - List sessionList = new LinkedList(); + List sessionList = new LinkedList<>(); for (int i = 0; i < 10 && sessionList.size() != expected; i++) { sessionList.clear(); @@ -241,7 +241,7 @@ public class ReconnectTest extends ActiveMQTestBase { // One for beforeReconnecto from the Factory, and one for the commit about to be done final CountDownLatch latchCommit = new CountDownLatch(2); - final ArrayList threadToBeInterrupted = new ArrayList(); + final ArrayList threadToBeInterrupted = new ArrayList<>(); factory.addFailureListener(new SessionFailureListener() { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/replication/ReplicationTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/replication/ReplicationTest.java index e9e3c02aaf..4a00caabb2 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/replication/ReplicationTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/replication/ReplicationTest.java @@ -340,7 +340,7 @@ public final class ReplicationTest extends ActiveMQTestBase { final AtomicInteger lastError = new AtomicInteger(0); - final List msgsResult = new ArrayList(); + final List msgsResult = new ArrayList<>(); final CountDownLatch latch = new CountDownLatch(1); @@ -498,7 +498,7 @@ public final class ReplicationTest extends ActiveMQTestBase { setupServer(true); - final ArrayList executions = new ArrayList(); + final ArrayList executions = new ArrayList<>(); StorageManager storage = getStorage(); manager = liveServer.getReplicationManager(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/scheduling/ScheduledMessageTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/scheduling/ScheduledMessageTest.java index 11a9c67c0d..1b6b513f74 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/scheduling/ScheduledMessageTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/scheduling/ScheduledMessageTest.java @@ -727,7 +727,7 @@ public class ScheduledMessageTest extends ActiveMQTestBase { ClientConsumer consumer = session.createConsumer(atestq); - ArrayList xids = new ArrayList(); + ArrayList xids = new ArrayList<>(); session.start(); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/SecurityTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/SecurityTest.java index 468ffa5b92..e5404efafc 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/SecurityTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/security/SecurityTest.java @@ -112,7 +112,7 @@ public class SecurityTest extends ActiveMQTestBase { ActiveMQJAASSecurityManager securityManager = new ActiveMQJAASSecurityManager("CertLogin"); ActiveMQServer server = addServer(ActiveMQServers.newActiveMQServer(createDefaultInVMConfig().setSecurityEnabled(true), ManagementFactory.getPlatformMBeanServer(), securityManager, false)); - Map params = new HashMap(); + Map params = new HashMap<>(); params.put(TransportConstants.SSL_ENABLED_PROP_NAME, true); params.put(TransportConstants.KEYSTORE_PATH_PROP_NAME, "server-side-keystore.jks"); params.put(TransportConstants.KEYSTORE_PASSWORD_PROP_NAME, "secureexample"); @@ -172,7 +172,7 @@ public class SecurityTest extends ActiveMQTestBase { ActiveMQJAASSecurityManager securityManager = new ActiveMQJAASSecurityManager("CertLogin"); ActiveMQServer server = addServer(ActiveMQServers.newActiveMQServer(createDefaultInVMConfig().setSecurityEnabled(true), ManagementFactory.getPlatformMBeanServer(), securityManager, false)); - Map params = new HashMap(); + Map params = new HashMap<>(); params.put(TransportConstants.SSL_ENABLED_PROP_NAME, true); params.put(TransportConstants.KEYSTORE_PATH_PROP_NAME, "server-side-keystore.jks"); params.put(TransportConstants.KEYSTORE_PASSWORD_PROP_NAME, "secureexample"); @@ -312,7 +312,7 @@ public class SecurityTest extends ActiveMQTestBase { ActiveMQJAASSecurityManager securityManager = new ActiveMQJAASSecurityManager("CertLogin"); ActiveMQServer server = addServer(ActiveMQServers.newActiveMQServer(createDefaultInVMConfig().setSecurityEnabled(true), ManagementFactory.getPlatformMBeanServer(), securityManager, false)); - Map params = new HashMap(); + Map params = new HashMap<>(); params.put(TransportConstants.SSL_ENABLED_PROP_NAME, true); params.put(TransportConstants.KEYSTORE_PATH_PROP_NAME, "server-side-keystore.jks"); params.put(TransportConstants.KEYSTORE_PASSWORD_PROP_NAME, "secureexample"); @@ -494,7 +494,7 @@ public class SecurityTest extends ActiveMQTestBase { ActiveMQJAASSecurityManager securityManager = new ActiveMQJAASSecurityManager("CertLogin"); ActiveMQServer server = addServer(ActiveMQServers.newActiveMQServer(createDefaultInVMConfig().setSecurityEnabled(true), ManagementFactory.getPlatformMBeanServer(), securityManager, false)); - Map params = new HashMap(); + Map params = new HashMap<>(); params.put(TransportConstants.SSL_ENABLED_PROP_NAME, true); params.put(TransportConstants.KEYSTORE_PATH_PROP_NAME, "server-side-keystore.jks"); params.put(TransportConstants.KEYSTORE_PASSWORD_PROP_NAME, "secureexample"); @@ -750,7 +750,7 @@ public class SecurityTest extends ActiveMQTestBase { ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager(); securityManager.getConfiguration().addUser("auser", "pass"); Role role = new Role("arole", false, false, true, false, false, false, false); - Set roles = new HashSet(); + Set roles = new HashSet<>(); roles.add(role); securityRepository.addMatch(SecurityTest.addressA, roles); securityManager.getConfiguration().addRole("auser", "arole"); @@ -769,7 +769,7 @@ public class SecurityTest extends ActiveMQTestBase { ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager(); securityManager.getConfiguration().addUser("auser", "pass"); Role role = new Role("arole", false, false, false, false, false, false, false); - Set roles = new HashSet(); + Set roles = new HashSet<>(); roles.add(role); securityRepository.addMatch(SecurityTest.addressA, roles); securityManager.getConfiguration().addRole("auser", "arole"); @@ -796,7 +796,7 @@ public class SecurityTest extends ActiveMQTestBase { ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager(); securityManager.getConfiguration().addUser("auser", "pass"); Role role = new Role("arole", false, false, true, true, false, false, false); - Set roles = new HashSet(); + Set roles = new HashSet<>(); roles.add(role); securityRepository.addMatch(SecurityTest.addressA, roles); securityManager.getConfiguration().addRole("auser", "arole"); @@ -815,7 +815,7 @@ public class SecurityTest extends ActiveMQTestBase { ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager(); securityManager.getConfiguration().addUser("auser", "pass"); Role role = new Role("arole", false, false, true, false, false, false, false); - Set roles = new HashSet(); + Set roles = new HashSet<>(); roles.add(role); securityRepository.addMatch(SecurityTest.addressA, roles); securityManager.getConfiguration().addRole("auser", "arole"); @@ -844,7 +844,7 @@ public class SecurityTest extends ActiveMQTestBase { ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager(); securityManager.getConfiguration().addUser("auser", "pass"); Role role = new Role("arole", false, false, false, false, true, false, false); - Set roles = new HashSet(); + Set roles = new HashSet<>(); roles.add(role); securityRepository.addMatch(SecurityTest.addressA, roles); securityManager.getConfiguration().addRole("auser", "arole"); @@ -863,7 +863,7 @@ public class SecurityTest extends ActiveMQTestBase { ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager(); securityManager.getConfiguration().addUser("auser", "pass"); Role role = new Role("arole", false, false, false, false, false, false, false); - Set roles = new HashSet(); + Set roles = new HashSet<>(); roles.add(role); securityRepository.addMatch(SecurityTest.addressA, roles); securityManager.getConfiguration().addRole("auser", "arole"); @@ -890,7 +890,7 @@ public class SecurityTest extends ActiveMQTestBase { ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager(); securityManager.getConfiguration().addUser("auser", "pass"); Role role = new Role("arole", false, false, false, false, true, true, false); - Set roles = new HashSet(); + Set roles = new HashSet<>(); roles.add(role); securityRepository.addMatch(SecurityTest.addressA, roles); securityManager.getConfiguration().addRole("auser", "arole"); @@ -909,7 +909,7 @@ public class SecurityTest extends ActiveMQTestBase { ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager(); securityManager.getConfiguration().addUser("auser", "pass"); Role role = new Role("arole", false, false, false, false, true, false, false); - Set roles = new HashSet(); + Set roles = new HashSet<>(); roles.add(role); securityRepository.addMatch(SecurityTest.addressA, roles); securityManager.getConfiguration().addRole("auser", "arole"); @@ -943,7 +943,7 @@ public class SecurityTest extends ActiveMQTestBase { Role role = new Role("arole", true, true, true, false, false, false, false); - Set roles = new HashSet(); + Set roles = new HashSet<>(); roles.add(role); @@ -975,7 +975,7 @@ public class SecurityTest extends ActiveMQTestBase { role = new Role("arole", false, false, true, false, false, false, false); - roles = new HashSet(); + roles = new HashSet<>(); roles.add(role); @@ -1002,7 +1002,7 @@ public class SecurityTest extends ActiveMQTestBase { ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager(); securityManager.getConfiguration().addUser("auser", "pass"); Role role = new Role("arole", false, false, true, false, false, false, false); - Set roles = new HashSet(); + Set roles = new HashSet<>(); roles.add(role); securityRepository.addMatch(SecurityTest.addressA, roles); securityManager.getConfiguration().addRole("auser", "arole"); @@ -1032,7 +1032,7 @@ public class SecurityTest extends ActiveMQTestBase { ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager(); securityManager.getConfiguration().addUser("auser", "pass"); Role role = new Role("arole", false, false, true, false, false, false, false); - Set roles = new HashSet(); + Set roles = new HashSet<>(); roles.add(role); securityRepository.addMatch(SecurityTest.addressA, roles); securityManager.getConfiguration().addRole("auser", "arole"); @@ -1059,7 +1059,7 @@ public class SecurityTest extends ActiveMQTestBase { securityManager.getConfiguration().setDefaultUser("guest"); Role role = new Role("arole", false, true, false, false, false, false, false); Role sendRole = new Role("guest", true, false, true, false, false, false, false); - Set roles = new HashSet(); + Set roles = new HashSet<>(); roles.add(sendRole); roles.add(role); securityRepository.addMatch(SecurityTest.addressA, roles); @@ -1087,7 +1087,7 @@ public class SecurityTest extends ActiveMQTestBase { securityManager.getConfiguration().setDefaultUser("guest"); Role role = new Role("arole", false, false, false, false, false, false, false); Role sendRole = new Role("guest", true, false, true, false, false, false, false); - Set roles = new HashSet(); + Set roles = new HashSet<>(); roles.add(sendRole); roles.add(role); securityRepository.addMatch(SecurityTest.addressA, roles); @@ -1125,7 +1125,7 @@ public class SecurityTest extends ActiveMQTestBase { Role role = new Role("arole", false, false, false, false, false, false, false); Role sendRole = new Role("guest", true, false, true, false, false, false, false); Role receiveRole = new Role("receiver", false, true, false, false, false, false, false); - Set roles = new HashSet(); + Set roles = new HashSet<>(); roles.add(sendRole); roles.add(role); roles.add(receiveRole); @@ -1176,7 +1176,7 @@ public class SecurityTest extends ActiveMQTestBase { Role role = new Role("arole", false, false, false, false, false, false, false); Role sendRole = new Role("guest", true, false, true, false, false, false, false); Role receiveRole = new Role("receiver", false, true, false, false, false, false, false); - Set roles = new HashSet(); + Set roles = new HashSet<>(); roles.add(sendRole); roles.add(role); roles.add(receiveRole); @@ -1239,7 +1239,7 @@ public class SecurityTest extends ActiveMQTestBase { System.out.println("guest:" + sendRole); Role receiveRole = new Role("receiver", false, true, false, false, false, false, false); System.out.println("guest:" + receiveRole); - Set roles = new HashSet(); + Set roles = new HashSet<>(); roles.add(sendRole); roles.add(role); roles.add(receiveRole); @@ -1323,7 +1323,7 @@ public class SecurityTest extends ActiveMQTestBase { ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager(); securityManager.getConfiguration().addUser("auser", "pass"); Role role = new Role("arole", false, false, false, false, false, false, true); - Set roles = new HashSet(); + Set roles = new HashSet<>(); roles.add(role); securityRepository.addMatch(configuration.getManagementAddress().toString(), roles); securityManager.getConfiguration().addRole("auser", "arole"); @@ -1344,7 +1344,7 @@ public class SecurityTest extends ActiveMQTestBase { ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager(); securityManager.getConfiguration().addUser("auser", "pass"); Role role = new Role("arole", false, false, true, false, false, false, false); - Set roles = new HashSet(); + Set roles = new HashSet<>(); roles.add(role); securityRepository.addMatch(configuration.getManagementAddress().toString(), roles); securityManager.getConfiguration().addRole("auser", "arole"); @@ -1375,7 +1375,7 @@ public class SecurityTest extends ActiveMQTestBase { ActiveMQJAASSecurityManager securityManager = (ActiveMQJAASSecurityManager) server.getSecurityManager(); securityManager.getConfiguration().addUser("auser", "pass"); Role role = new Role("arole", false, false, true, false, false, false, false); - Set roles = new HashSet(); + Set roles = new HashSet<>(); roles.add(role); securityRepository.addMatch(configuration.getManagementAddress().toString(), roles); securityManager.getConfiguration().addRole("auser", "arole"); @@ -1412,17 +1412,17 @@ public class SecurityTest extends ActiveMQTestBase { securityManager.getConfiguration().addRole("sam", "user"); Role all = new Role("all", true, true, true, true, true, true, true); HierarchicalRepository> repository = server.getSecurityRepository(); - Set add = new HashSet(); + Set add = new HashSet<>(); add.add(new Role("user", true, true, true, true, true, true, false)); add.add(all); repository.addMatch("#", add); - Set add1 = new HashSet(); + Set add1 = new HashSet<>(); add1.add(all); add1.add(new Role("user", false, false, true, true, true, true, false)); add1.add(new Role("europe-user", true, false, false, false, false, false, false)); add1.add(new Role("news-user", false, true, false, false, false, false, false)); repository.addMatch("news.europe.#", add1); - Set add2 = new HashSet(); + Set add2 = new HashSet<>(); add2.add(all); add2.add(new Role("user", false, false, true, true, true, true, false)); add2.add(new Role("us-user", true, false, false, false, false, false, false)); @@ -1543,17 +1543,17 @@ public class SecurityTest extends ActiveMQTestBase { securityManager.getConfiguration().addRole("sam", "user"); Role all = new Role("all", true, true, true, true, true, true, true); HierarchicalRepository> repository = server.getSecurityRepository(); - Set add = new HashSet(); + Set add = new HashSet<>(); add.add(new Role("user", true, true, true, true, true, true, false)); add.add(all); repository.addMatch("#", add); - Set add1 = new HashSet(); + Set add1 = new HashSet<>(); add1.add(all); add1.add(new Role("user", false, false, true, true, true, true, false)); add1.add(new Role("europe-user", true, false, false, false, false, false, false)); add1.add(new Role("news-user", false, true, false, false, false, false, false)); repository.addMatch("news.europe.#", add1); - Set add2 = new HashSet(); + Set add2 = new HashSet<>(); add2.add(all); add2.add(new Role("user", false, false, true, true, true, true, false)); add2.add(new Role("us-user", true, false, false, false, false, false, false)); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ExpiryRunnerTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ExpiryRunnerTest.java index ee4ac081c4..57773ed706 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ExpiryRunnerTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/ExpiryRunnerTest.java @@ -252,7 +252,7 @@ public class ExpiryRunnerTest extends ActiveMQTestBase { private static class DummyMessageHandler implements Runnable { - List payloads = new ArrayList(); + List payloads = new ArrayList<>(); private final ClientConsumer consumer; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/FakeStorageManager.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/FakeStorageManager.java index 69c5ec1165..c3670c5194 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/FakeStorageManager.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/FakeStorageManager.java @@ -24,9 +24,9 @@ import org.apache.activemq.artemis.core.server.ServerMessage; public class FakeStorageManager extends NullStorageManager { - List messageIds = new ArrayList(); + List messageIds = new ArrayList<>(); - List ackIds = new ArrayList(); + List ackIds = new ArrayList<>(); @Override public void storeMessage(final ServerMessage message) throws Exception { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/PredefinedQueueTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/PredefinedQueueTest.java index ebed9e6b43..1dc666c199 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/PredefinedQueueTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/server/PredefinedQueueTest.java @@ -68,7 +68,7 @@ public class PredefinedQueueTest extends ActiveMQTestBase { CoreQueueConfiguration queue3 = new CoreQueueConfiguration().setAddress(testAddress).setName(queueName3); - List queueConfs = new ArrayList(); + List queueConfs = new ArrayList<>(); queueConfs.add(queue1); queueConfs.add(queue2); @@ -287,7 +287,7 @@ public class PredefinedQueueTest extends ActiveMQTestBase { CoreQueueConfiguration queue2 = new CoreQueueConfiguration().setAddress(testAddress).setName(queueName2); - List queueConfs = new ArrayList(); + List queueConfs = new ArrayList<>(); queueConfs.add(queue1); queueConfs.add(queue2); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/CoreClientOverOneWaySSLTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/CoreClientOverOneWaySSLTest.java index 46c60eb832..08293f0b05 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/CoreClientOverOneWaySSLTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/CoreClientOverOneWaySSLTest.java @@ -519,7 +519,7 @@ public class CoreClientOverOneWaySSLTest extends ActiveMQTestBase { } private void createCustomSslServer(String cipherSuites, String protocols) throws Exception { - Map params = new HashMap(); + Map params = new HashMap<>(); params.put(TransportConstants.SSL_ENABLED_PROP_NAME, true); params.put(TransportConstants.KEYSTORE_PROVIDER_PROP_NAME, storeType); params.put(TransportConstants.KEYSTORE_PATH_PROP_NAME, SERVER_SIDE_KEYSTORE); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/CoreClientOverTwoWaySSLTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/CoreClientOverTwoWaySSLTest.java index d66b968c17..f24f34859d 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/CoreClientOverTwoWaySSLTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/ssl/CoreClientOverTwoWaySSLTest.java @@ -174,7 +174,7 @@ public class CoreClientOverTwoWaySSLTest extends ActiveMQTestBase { @Before public void setUp() throws Exception { super.setUp(); - Map params = new HashMap(); + Map params = new HashMap<>(); params.put(TransportConstants.SSL_ENABLED_PROP_NAME, true); params.put(TransportConstants.KEYSTORE_PATH_PROP_NAME, SERVER_SIDE_KEYSTORE); params.put(TransportConstants.KEYSTORE_PASSWORD_PROP_NAME, PASSWORD); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/ExtraStompTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/ExtraStompTest.java index a52ed03f9f..723792b89d 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/ExtraStompTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/ExtraStompTest.java @@ -612,7 +612,7 @@ public class ExtraStompTest extends StompTestBase { } protected JMSServerManager createPersistentServerWithStompMinLargeSize(int sz) throws Exception { - Map params = new HashMap(); + Map params = new HashMap<>(); params.put(TransportConstants.PROTOCOLS_PROP_NAME, StompProtocolManagerFactory.STOMP_PROTOCOL_NAME); params.put(TransportConstants.PORT_PROP_NAME, TransportConstants.DEFAULT_STOMP_PORT); params.put(TransportConstants.STOMP_CONSUMERS_CREDIT, "-1"); @@ -693,7 +693,7 @@ public class ExtraStompTest extends StompTestBase { protected JMSServerManager createServerWithExtraStompOptions(String ttl, Boolean enableMessageID) throws Exception { - Map params = new HashMap(); + Map params = new HashMap<>(); params.put(TransportConstants.PROTOCOLS_PROP_NAME, StompProtocolManagerFactory.STOMP_PROTOCOL_NAME); params.put(TransportConstants.PORT_PROP_NAME, TransportConstants.DEFAULT_STOMP_PORT); if (ttl != null) { @@ -719,7 +719,7 @@ public class ExtraStompTest extends StompTestBase { public static class MyCoreInterceptor implements Interceptor { - static List incomingInterceptedFrames = new ArrayList(); + static List incomingInterceptedFrames = new ArrayList<>(); @Override public boolean intercept(Packet packet, RemotingConnection connection) { @@ -731,7 +731,7 @@ public class ExtraStompTest extends StompTestBase { public static class MyIncomingStompFrameInterceptor implements StompFrameInterceptor { - static List incomingInterceptedFrames = new ArrayList(); + static List incomingInterceptedFrames = new ArrayList<>(); @Override public boolean intercept(StompFrame stompFrame, RemotingConnection connection) { @@ -743,7 +743,7 @@ public class ExtraStompTest extends StompTestBase { public static class MyOutgoingStompFrameInterceptor implements StompFrameInterceptor { - static List outgoingInterceptedFrames = new ArrayList(); + static List outgoingInterceptedFrames = new ArrayList<>(); @Override public boolean intercept(StompFrame stompFrame, RemotingConnection connection) { @@ -758,10 +758,10 @@ public class ExtraStompTest extends StompTestBase { MyIncomingStompFrameInterceptor.incomingInterceptedFrames.clear(); MyOutgoingStompFrameInterceptor.outgoingInterceptedFrames.clear(); try { - List incomingInterceptorList = new ArrayList(); + List incomingInterceptorList = new ArrayList<>(); incomingInterceptorList.add("org.apache.activemq.artemis.tests.integration.stomp.ExtraStompTest$MyIncomingStompFrameInterceptor"); incomingInterceptorList.add("org.apache.activemq.artemis.tests.integration.stomp.ExtraStompTest$MyCoreInterceptor"); - List outgoingInterceptorList = new ArrayList(); + List outgoingInterceptorList = new ArrayList<>(); outgoingInterceptorList.add("org.apache.activemq.artemis.tests.integration.stomp.ExtraStompTest$MyOutgoingStompFrameInterceptor"); server = createServerWithStompInterceptor(incomingInterceptorList, outgoingInterceptorList); @@ -808,13 +808,13 @@ public class ExtraStompTest extends StompTestBase { server.stop(); } - List incomingCommands = new ArrayList(4); + List incomingCommands = new ArrayList<>(4); incomingCommands.add("CONNECT"); incomingCommands.add("SUBSCRIBE"); incomingCommands.add("SEND"); incomingCommands.add("DISCONNECT"); - List outgoingCommands = new ArrayList(3); + List outgoingCommands = new ArrayList<>(3); outgoingCommands.add("CONNECTED"); outgoingCommands.add("MESSAGE"); outgoingCommands.add("MESSAGE"); @@ -847,7 +847,7 @@ public class ExtraStompTest extends StompTestBase { protected JMSServerManager createServerWithStompInterceptor(List stompIncomingInterceptor, List stompOutgoingInterceptor) throws Exception { - Map params = new HashMap(); + Map params = new HashMap<>(); params.put(TransportConstants.PROTOCOLS_PROP_NAME, StompProtocolManagerFactory.STOMP_PROTOCOL_NAME); params.put(TransportConstants.PORT_PROP_NAME, TransportConstants.DEFAULT_STOMP_PORT); params.put(TransportConstants.STOMP_CONSUMERS_CREDIT, "-1"); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompTestBase.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompTestBase.java index 2e5650e608..3c42b3d04c 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompTestBase.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompTestBase.java @@ -178,7 +178,7 @@ public abstract class StompTestBase extends ActiveMQTestBase { * @throws Exception */ protected JMSServerManager createServer() throws Exception { - Map params = new HashMap(); + Map params = new HashMap<>(); params.put(TransportConstants.PROTOCOLS_PROP_NAME, StompProtocolManagerFactory.STOMP_PROTOCOL_NAME); params.put(TransportConstants.PORT_PROP_NAME, TransportConstants.DEFAULT_STOMP_PORT); params.put(TransportConstants.STOMP_CONSUMERS_CREDIT, "-1"); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompWebSocketTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompWebSocketTest.java index 012e7da129..240fa655b3 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompWebSocketTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/StompWebSocketTest.java @@ -64,7 +64,7 @@ public class StompWebSocketTest extends ActiveMQTestBase { * @throws Exception */ private JMSServerManager createServer() throws Exception { - Map params = new HashMap(); + Map params = new HashMap<>(); params.put(TransportConstants.PROTOCOLS_PROP_NAME, StompProtocolManagerFactory.STOMP_PROTOCOL_NAME); params.put(TransportConstants.PORT_PROP_NAME, TransportConstants.DEFAULT_STOMP_PORT + 1); TransportConfiguration stompTransport = new TransportConfiguration(NettyAcceptorFactory.class.getName(), params); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/util/AbstractClientStompFrame.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/util/AbstractClientStompFrame.java index 1aabb1ad35..dc2e1ed69a 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/util/AbstractClientStompFrame.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/util/AbstractClientStompFrame.java @@ -28,10 +28,10 @@ public abstract class AbstractClientStompFrame implements ClientStompFrame { protected static final String HEADER_RECEIPT = "receipt"; - protected static final Set validCommands = new HashSet(); + protected static final Set validCommands = new HashSet<>(); protected String command; - protected List
headers = new ArrayList
(); - protected Set headerKeys = new HashSet(); + protected List
headers = new ArrayList<>(); + protected Set headerKeys = new HashSet<>(); protected String body; protected String EOL = "\n"; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/util/AbstractStompClientConnection.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/util/AbstractStompClientConnection.java index 4d3c07c91c..42f8a1dba5 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/util/AbstractStompClientConnection.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/util/AbstractStompClientConnection.java @@ -59,7 +59,7 @@ public abstract class AbstractStompClientConnection implements StompClientConnec protected List receiveList; - protected BlockingQueue frameQueue = new LinkedBlockingQueue(); + protected BlockingQueue frameQueue = new LinkedBlockingQueue<>(); protected boolean connected = false; private int serverPingCounter; @@ -83,7 +83,7 @@ public abstract class AbstractStompClientConnection implements StompClientConnec private void startReaderThread() { readBuffer = ByteBuffer.allocateDirect(10240); - receiveList = new ArrayList(10240); + receiveList = new ArrayList<>(10240); new ReaderThread().start(); } diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/v11/StompV11TestBase.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/v11/StompV11TestBase.java index 034eb80543..d37d90b615 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/v11/StompV11TestBase.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/stomp/v11/StompV11TestBase.java @@ -97,7 +97,7 @@ public abstract class StompV11TestBase extends ActiveMQTestBase { * @throws Exception */ protected JMSServerManager createServer() throws Exception { - Map params = new HashMap(); + Map params = new HashMap<>(); params.put(TransportConstants.PROTOCOLS_PROP_NAME, StompProtocolManagerFactory.STOMP_PROTOCOL_NAME); params.put(TransportConstants.PORT_PROP_NAME, TransportConstants.DEFAULT_STOMP_PORT); params.put(TransportConstants.STOMP_CONSUMERS_CREDIT, "-1"); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/transports/netty/ActiveMQFrameDecoder2Test.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/transports/netty/ActiveMQFrameDecoder2Test.java index 321fda7949..ed11fa9a5f 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/transports/netty/ActiveMQFrameDecoder2Test.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/transports/netty/ActiveMQFrameDecoder2Test.java @@ -50,7 +50,7 @@ public class ActiveMQFrameDecoder2Test extends ActiveMQTestBase { src.writeBytes(data); } - List packets = new ArrayList(); + List packets = new ArrayList<>(); while (src.isReadable()) { int length = Math.min(ActiveMQFrameDecoder2Test.rand.nextInt(ActiveMQFrameDecoder2Test.FRAGMENT_MAX_LEN), src.readableBytes()); packets.add(src.readBytes(length)); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/transports/netty/NettyConnectorWithHTTPUpgradeTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/transports/netty/NettyConnectorWithHTTPUpgradeTest.java index edcb588262..6bb90084a0 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/transports/netty/NettyConnectorWithHTTPUpgradeTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/transports/netty/NettyConnectorWithHTTPUpgradeTest.java @@ -110,7 +110,7 @@ public class NettyConnectorWithHTTPUpgradeTest extends ActiveMQTestBase { @Before public void setUp() throws Exception { super.setUp(); - HashMap httpAcceptorParams = new HashMap(); + HashMap httpAcceptorParams = new HashMap<>(); // This prop controls the usage of HTTP Get + Upgrade from Netty connector httpAcceptorParams.put(TransportConstants.HTTP_UPGRADE_ENABLED_PROP_NAME, true); httpAcceptorParams.put(TransportConstants.PORT_PROP_NAME, HTTP_PORT); @@ -122,7 +122,7 @@ public class NettyConnectorWithHTTPUpgradeTest extends ActiveMQTestBase { server.start(); - HashMap httpConnectorParams = new HashMap(); + HashMap httpConnectorParams = new HashMap<>(); httpAcceptorParams.put(TransportConstants.HTTP_UPGRADE_ENABLED_PROP_NAME, true); httpAcceptorParams.put(TransportConstants.PORT_PROP_NAME, HTTP_PORT); if (useSSL) { diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/vertx/ActiveMQVertxUnitTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/vertx/ActiveMQVertxUnitTest.java index 0c19b73b26..c1ffec5b76 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/vertx/ActiveMQVertxUnitTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/vertx/ActiveMQVertxUnitTest.java @@ -88,7 +88,7 @@ public class ActiveMQVertxUnitTest extends ActiveMQTestBase { CoreQueueConfiguration qc3 = new CoreQueueConfiguration().setAddress(inOutQueue2).setName(inOutQueue2); //incoming - HashMap config1 = new HashMap(); + HashMap config1 = new HashMap<>(); config1.put(VertxConstants.HOST, host); config1.put(VertxConstants.PORT, port); config1.put(VertxConstants.QUEUE_NAME, incomingQueue1); @@ -97,7 +97,7 @@ public class ActiveMQVertxUnitTest extends ActiveMQTestBase { ConnectorServiceConfiguration inconf1 = new ConnectorServiceConfiguration().setFactoryClassName(VertxIncomingConnectorServiceFactory.class.getName()).setParams(config1).setName("test-vertx-incoming-connector1"); //outgoing send style - HashMap config2 = new HashMap(); + HashMap config2 = new HashMap<>(); config2.put(VertxConstants.HOST, host); config2.put(VertxConstants.PORT, port); config2.put(VertxConstants.QUEUE_NAME, inOutQueue1); @@ -105,7 +105,7 @@ public class ActiveMQVertxUnitTest extends ActiveMQTestBase { ConnectorServiceConfiguration inconf2 = new ConnectorServiceConfiguration().setFactoryClassName(VertxIncomingConnectorServiceFactory.class.getName()).setParams(config2).setName("test-vertx-incoming-connector2"); - HashMap config3 = new HashMap(); + HashMap config3 = new HashMap<>(); config3.put(VertxConstants.HOST, host); config3.put(VertxConstants.PORT, port); config3.put(VertxConstants.QUEUE_NAME, inOutQueue1); @@ -114,7 +114,7 @@ public class ActiveMQVertxUnitTest extends ActiveMQTestBase { ConnectorServiceConfiguration outconf1 = new ConnectorServiceConfiguration().setFactoryClassName(VertxOutgoingConnectorServiceFactory.class.getName()).setParams(config3).setName("test-vertx-outgoing-connector1"); //outgoing publish style - HashMap config4 = new HashMap(); + HashMap config4 = new HashMap<>(); config4.put(VertxConstants.HOST, host); config4.put(VertxConstants.PORT, port); config4.put(VertxConstants.QUEUE_NAME, inOutQueue2); @@ -122,7 +122,7 @@ public class ActiveMQVertxUnitTest extends ActiveMQTestBase { ConnectorServiceConfiguration inconf3 = new ConnectorServiceConfiguration().setFactoryClassName(VertxIncomingConnectorServiceFactory.class.getName()).setParams(config4).setName("test-vertx-incoming-connector3"); - HashMap config5 = new HashMap(); + HashMap config5 = new HashMap<>(); config5.put(VertxConstants.HOST, host); config5.put(VertxConstants.PORT, port); config5.put(VertxConstants.QUEUE_NAME, inOutQueue2); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/xa/BasicXaRecoveryTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/xa/BasicXaRecoveryTest.java index b6d1f00b66..6cb6d0bab2 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/xa/BasicXaRecoveryTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/xa/BasicXaRecoveryTest.java @@ -51,7 +51,7 @@ public class BasicXaRecoveryTest extends ActiveMQTestBase { private static IntegrationTestLogger log = IntegrationTestLogger.LOGGER; - private final Map addressSettings = new HashMap(); + private final Map addressSettings = new HashMap<>(); private ActiveMQServer server; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/xa/BasicXaTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/xa/BasicXaTest.java index ce253a76e8..6c67a76096 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/xa/BasicXaTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/xa/BasicXaTest.java @@ -49,7 +49,7 @@ public class BasicXaTest extends ActiveMQTestBase { private static IntegrationTestLogger log = IntegrationTestLogger.LOGGER; - private final Map addressSettings = new HashMap(); + private final Map addressSettings = new HashMap<>(); private ActiveMQServer messagingService; diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/xa/XaTimeoutTest.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/xa/XaTimeoutTest.java index ea9d24a9f6..b6d679a24b 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/xa/XaTimeoutTest.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/integration/xa/XaTimeoutTest.java @@ -55,7 +55,7 @@ import java.util.concurrent.atomic.AtomicInteger; public class XaTimeoutTest extends ActiveMQTestBase { - private final Map addressSettings = new HashMap(); + private final Map addressSettings = new HashMap<>(); private ActiveMQServer server; @@ -462,7 +462,7 @@ public class XaTimeoutTest extends ActiveMQTestBase { clientConsumer = clientSession.createConsumer(outQueue); - HashSet msgsIds = new HashSet(); + HashSet msgsIds = new HashSet<>(); for (int i = 0; i < numberOfMessages; i++) { ClientMessage msg = clientConsumer.receive(1000); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/util/JMSTestBase.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/util/JMSTestBase.java index cb4ba0aa18..83dc3ba5fe 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/util/JMSTestBase.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/util/JMSTestBase.java @@ -61,7 +61,7 @@ public class JMSTestBase extends ActiveMQTestBase { protected ConnectionFactory cf; protected Connection conn; - private final Set contextSet = new HashSet(); + private final Set contextSet = new HashSet<>(); private final Random random = new Random(); protected InVMNamingContext namingContext; @@ -203,7 +203,7 @@ public class JMSTestBase extends ActiveMQTestBase { } protected void registerConnectionFactory() throws Exception { - List connectorConfigs = new ArrayList(); + List connectorConfigs = new ArrayList<>(); connectorConfigs.add(new TransportConfiguration(INVM_CONNECTOR_FACTORY)); createCF(connectorConfigs, "/cf"); diff --git a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/util/TransportConfigurationUtils.java b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/util/TransportConfigurationUtils.java index 6aa3b451ef..472d32795e 100644 --- a/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/util/TransportConfigurationUtils.java +++ b/tests/integration-tests/src/test/java/org/apache/activemq/artemis/tests/util/TransportConfigurationUtils.java @@ -78,20 +78,20 @@ public final class TransportConfigurationUtils { return new TransportConfiguration(classname); } - Map server1Params = new HashMap(); + Map server1Params = new HashMap<>(); server1Params.put(TransportConstants.SERVER_ID_PROP_NAME, 1); return new TransportConfiguration(classname, server1Params); } private static TransportConfiguration transportConfiguration(String classname, boolean live, int server) { if (classname.contains("netty")) { - Map serverParams = new HashMap(); + Map serverParams = new HashMap<>(); Integer port = live ? 61616 : 5545; serverParams.put(org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants.PORT_PROP_NAME, port); return new TransportConfiguration(classname, serverParams); } - Map serverParams = new HashMap(); + Map serverParams = new HashMap<>(); serverParams.put(TransportConstants.SERVER_ID_PROP_NAME, live ? server : server + 100); return new TransportConfiguration(classname, serverParams); } @@ -101,13 +101,13 @@ public final class TransportConfigurationUtils { int server, String name) { if (classname.contains("netty")) { - Map serverParams = new HashMap(); + Map serverParams = new HashMap<>(); Integer port = live ? 61616 : 5545; serverParams.put(org.apache.activemq.artemis.core.remoting.impl.netty.TransportConstants.PORT_PROP_NAME, port); return new TransportConfiguration(classname, serverParams, name); } - Map serverParams = new HashMap(); + Map serverParams = new HashMap<>(); serverParams.put(TransportConstants.SERVER_ID_PROP_NAME, live ? server : server + 100); return new TransportConfiguration(classname, serverParams, name); } diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/ActiveMQServerTestCase.java b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/ActiveMQServerTestCase.java index 0b53ca9d7c..5383492544 100644 --- a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/ActiveMQServerTestCase.java +++ b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/ActiveMQServerTestCase.java @@ -72,7 +72,7 @@ public abstract class ActiveMQServerTestCase { * Some testcases are time sensitive, and we need to make sure a GC would happen before certain scenarios */ public static void forceGC() { - WeakReference dumbReference = new WeakReference(new Object()); + WeakReference dumbReference = new WeakReference<>(new Object()); // A loop that will wait GC, using the minimal time as possible while (dumbReference.get() != null) { System.gc(); @@ -84,7 +84,7 @@ public abstract class ActiveMQServerTestCase { } } - protected static List servers = new ArrayList(); + protected static List servers = new ArrayList<>(); protected static Topic topic1; protected static Topic topic2; @@ -95,8 +95,8 @@ public abstract class ActiveMQServerTestCase { protected Queue queue3; protected Queue queue4; - private final Set connectionsSet = new HashSet(); - private final Set contextSet = new HashSet(); + private final Set connectionsSet = new HashSet<>(); + private final Set contextSet = new HashSet<>(); @Rule public TestRule watcher = new TestWatcher() { @@ -191,7 +191,7 @@ public abstract class ActiveMQServerTestCase { } protected HashMap getConfiguration() { - return new HashMap(); + return new HashMap<>(); } protected void deployAndLookupAdministeredObjects() throws Exception { diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/CTSMiscellaneousTest.java b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/CTSMiscellaneousTest.java index 0aefc07683..afa51d7edc 100644 --- a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/CTSMiscellaneousTest.java +++ b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/CTSMiscellaneousTest.java @@ -51,7 +51,7 @@ public class CTSMiscellaneousTest extends JMSTest { try { super.setUp(); // Deploy a connection factory with load balancing but no failover on node0 - List bindings = new ArrayList(); + List bindings = new ArrayList<>(); bindings.add("StrictTCKConnectionFactory"); getJmsServerManager().createConnectionFactory("StrictTCKConnectionFactory", false, JMSFactoryType.CF, NETTY_CONNECTOR, null, ActiveMQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD, ActiveMQClient.DEFAULT_CONNECTION_TTL, ActiveMQClient.DEFAULT_CALL_TIMEOUT, ActiveMQClient.DEFAULT_CALL_FAILOVER_TIMEOUT, ActiveMQClient.DEFAULT_CACHE_LARGE_MESSAGE_CLIENT, ActiveMQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE, ActiveMQClient.DEFAULT_COMPRESS_LARGE_MESSAGES, ActiveMQClient.DEFAULT_CONSUMER_WINDOW_SIZE, ActiveMQClient.DEFAULT_CONSUMER_MAX_RATE, ActiveMQClient.DEFAULT_CONFIRMATION_WINDOW_SIZE, ActiveMQClient.DEFAULT_PRODUCER_WINDOW_SIZE, ActiveMQClient.DEFAULT_PRODUCER_MAX_RATE, true, true, true, ActiveMQClient.DEFAULT_AUTO_GROUP, ActiveMQClient.DEFAULT_PRE_ACKNOWLEDGE, ActiveMQClient.DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME, ActiveMQClient.DEFAULT_ACK_BATCH_SIZE, ActiveMQClient.DEFAULT_ACK_BATCH_SIZE, ActiveMQClient.DEFAULT_USE_GLOBAL_POOLS, ActiveMQClient.DEFAULT_SCHEDULED_THREAD_POOL_MAX_SIZE, ActiveMQClient.DEFAULT_THREAD_POOL_MAX_SIZE, ActiveMQClient.DEFAULT_RETRY_INTERVAL, ActiveMQClient.DEFAULT_RETRY_INTERVAL_MULTIPLIER, ActiveMQClient.DEFAULT_MAX_RETRY_INTERVAL, ActiveMQClient.DEFAULT_RECONNECT_ATTEMPTS, ActiveMQClient.DEFAULT_FAILOVER_ON_INITIAL_CONNECTION, null, "/StrictTCKConnectionFactory"); diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/ConnectionFactoryTest.java b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/ConnectionFactoryTest.java index 8e29dfd3c0..5c7cfeeede 100644 --- a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/ConnectionFactoryTest.java +++ b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/ConnectionFactoryTest.java @@ -184,7 +184,7 @@ public class ConnectionFactoryTest extends JMSTestCase { @Test public void testSlowConsumers() throws Exception { - ArrayList bindings = new ArrayList(); + ArrayList bindings = new ArrayList<>(); bindings.add("TestSlowConsumersCF"); ActiveMQServerTestCase.deployConnectionFactory(0, "TestSlowConsumersCF", 1, "TestSlowConsumersCF"); diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/JMSTest.java b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/JMSTest.java index 63e87b96bb..02e7f22a96 100644 --- a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/JMSTest.java +++ b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/JMSTest.java @@ -244,7 +244,7 @@ public class JMSTest extends JMSTestCase { conn.start(); - final AtomicReference message = new AtomicReference(); + final AtomicReference message = new AtomicReference<>(); final CountDownLatch latch = new CountDownLatch(1); new Thread(new Runnable() { @@ -294,7 +294,7 @@ public class JMSTest extends JMSTestCase { MessageConsumer cons = sessionConsumer.createConsumer(queue1); - final AtomicReference message = new AtomicReference(); + final AtomicReference message = new AtomicReference<>(); final CountDownLatch latch = new CountDownLatch(1); cons.setMessageListener(new MessageListener() { diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/JMSTestCase.java b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/JMSTestCase.java index ae695dcbf1..21e482fa6e 100644 --- a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/JMSTestCase.java +++ b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/JMSTestCase.java @@ -42,7 +42,7 @@ import org.junit.Before; @Deprecated public class JMSTestCase extends ActiveMQServerTestCase { - protected static final ArrayList NETTY_CONNECTOR = new ArrayList(); + protected static final ArrayList NETTY_CONNECTOR = new ArrayList<>(); static { NETTY_CONNECTOR.add("netty"); diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/QueueTest.java b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/QueueTest.java index c4c4185c17..6f502ff713 100644 --- a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/QueueTest.java +++ b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/QueueTest.java @@ -142,7 +142,7 @@ public class QueueTest extends JMSTestCase { // There is a possibility the messages arrive out of order if they hit the closed // consumer and are cancelled back before delivery to the other consumer has finished. // There is nothing much we can do about this - Set texts = new HashSet(); + Set texts = new HashSet<>(); for (int i = 0; i < 20; i++) { TextMessage txt = (TextMessage) c2.receive(5000); diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/message/BodyIsAssignableFromTest.java b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/message/BodyIsAssignableFromTest.java index d75c7f42dd..58e8bd86b8 100644 --- a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/message/BodyIsAssignableFromTest.java +++ b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/message/BodyIsAssignableFromTest.java @@ -141,7 +141,7 @@ public class BodyIsAssignableFromTest extends MessageBodyTestCase { msg1.setLong("long", 37L); msg1.setString("string", "crocodile"); msg = msg1; - Map map = new HashMap(); + Map map = new HashMap<>(); map.put("int", Integer.valueOf(13)); map.put("long", Long.valueOf(37L)); map.put("string", "crocodile"); diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/message/MessageBodyTest.java b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/message/MessageBodyTest.java index cf85fe56b2..5bafb6476b 100644 --- a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/message/MessageBodyTest.java +++ b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/message/MessageBodyTest.java @@ -570,7 +570,7 @@ public class MessageBodyTest extends MessageBodyTestCase { ProxyAssertSupport.assertFalse(m2.itemExists("sausages")); - HashSet itemNames = new HashSet(); + HashSet itemNames = new HashSet<>(); @SuppressWarnings("unchecked") Enumeration en = m2.getMapNames(); while (en.hasMoreElements()) { diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/message/MessageHeaderTest.java b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/message/MessageHeaderTest.java index 7394a93613..cbb7a9d43d 100644 --- a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/message/MessageHeaderTest.java +++ b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/message/MessageHeaderTest.java @@ -276,7 +276,7 @@ public class MessageHeaderTest extends MessageHeaderTestBase { ProxyAssertSupport.assertFalse(m2.propertyExists("sausages")); - Set propNames = new HashSet(); + Set propNames = new HashSet<>(); Enumeration en = m2.getPropertyNames(); while (en.hasMoreElements()) { String propName = (String) en.nextElement(); diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/message/ObjectMessageTest.java b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/message/ObjectMessageTest.java index 1a3e922934..ddab13f6f9 100644 --- a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/message/ObjectMessageTest.java +++ b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/message/ObjectMessageTest.java @@ -87,7 +87,7 @@ public class ObjectMessageTest extends MessageTestBase { @Test public void testVectorOnObjectMessage() throws Exception { - java.util.Vector vectorOnMessage = new java.util.Vector(); + java.util.Vector vectorOnMessage = new java.util.Vector<>(); vectorOnMessage.add("world!"); ((ObjectMessage) message).setObject(vectorOnMessage); @@ -104,7 +104,7 @@ public class ObjectMessageTest extends MessageTestBase { @Test public void testObjectIsolation() throws Exception { ObjectMessage msgTest = session.createObjectMessage(); - ArrayList list = new ArrayList(); + ArrayList list = new ArrayList<>(); list.add("hello"); msgTest.setObject(list); @@ -193,7 +193,7 @@ public class ObjectMessageTest extends MessageTestBase { pathIgnore = classLocation.toString(); } - ArrayList urls = new ArrayList(); + ArrayList urls = new ArrayList<>(); while (tokenString.hasMoreElements()) { String value = tokenString.nextToken(); URL itemLocation = new File(value).toURI().toURL(); diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/message/SimpleJMSMessage.java b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/message/SimpleJMSMessage.java index 3f49a5bfae..dc53e7a47e 100644 --- a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/message/SimpleJMSMessage.java +++ b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/message/SimpleJMSMessage.java @@ -199,7 +199,7 @@ public class SimpleJMSMessage implements Message { this.priority = priority; } - private final Map properties = new HashMap(); + private final Map properties = new HashMap<>(); @Override public void clearProperties() throws JMSException { diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/message/SimpleJMSStreamMessage.java b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/message/SimpleJMSStreamMessage.java index ca63cefb6e..4d86fdf12a 100644 --- a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/message/SimpleJMSStreamMessage.java +++ b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/message/SimpleJMSStreamMessage.java @@ -48,7 +48,7 @@ public class SimpleJMSStreamMessage extends SimpleJMSMessage implements StreamMe // Constructors -------------------------------------------------- public SimpleJMSStreamMessage() { - content = new ArrayList(); + content = new ArrayList<>(); position = 0; size = 0; offset = 0; diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/selector/SelectorTest.java b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/selector/SelectorTest.java index baf8df8a8d..ad56fbe19e 100644 --- a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/selector/SelectorTest.java +++ b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/selector/SelectorTest.java @@ -530,8 +530,8 @@ public class SelectorTest extends ActiveMQServerTestCase { conn.start(); - final List received = new ArrayList(); - final List received2 = new ArrayList(); + final List received = new ArrayList<>(); + final List received2 = new ArrayList<>(); final CountDownLatch latch = new CountDownLatch(1); final CountDownLatch latch2 = new CountDownLatch(1); diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/tools/ServerManagement.java b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/tools/ServerManagement.java index 2bf0c06a06..dbe410fcee 100644 --- a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/tools/ServerManagement.java +++ b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/tools/ServerManagement.java @@ -53,7 +53,7 @@ public class ServerManagement { private static JmsTestLogger log = JmsTestLogger.LOGGER; - private static List servers = new ArrayList(); + private static List servers = new ArrayList<>(); /** * Makes sure that a "hollow" TestServer (either local or remote, depending on the nature of the diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/tools/container/InVMContext.java b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/tools/container/InVMContext.java index 269246b020..7fa6fafdd8 100644 --- a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/tools/container/InVMContext.java +++ b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/tools/container/InVMContext.java @@ -178,7 +178,7 @@ public class InVMContext implements Context, Serializable { } } - List l = new ArrayList(); + List l = new ArrayList<>(); for (String name : map.keySet()) { Object object = map.get(name); l.add(new Binding(name, object)); @@ -254,7 +254,7 @@ public class InVMContext implements Context, Serializable { @Override public Hashtable getEnvironment() throws NamingException { - Hashtable env = new Hashtable(); + Hashtable env = new Hashtable<>(); env.put("java.naming.factory.initial", InVMInitialContextFactory.class.getCanonicalName()); return env; } diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/tools/container/InVMInitialContextFactory.java b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/tools/container/InVMInitialContextFactory.java index ce8c2cf94b..76bc64900d 100644 --- a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/tools/container/InVMInitialContextFactory.java +++ b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/tools/container/InVMInitialContextFactory.java @@ -46,7 +46,7 @@ public class InVMInitialContextFactory implements InitialContextFactory { * @return the JNDI environment to use to get this InitialContextFactory. */ public static Hashtable getJNDIEnvironment(final int serverIndex) { - Hashtable env = new Hashtable(); + Hashtable env = new Hashtable<>(); env.put("java.naming.factory.initial", "org.apache.activemq.artemis.jms.tests.tools.container.InVMInitialContextFactory"); env.put(Constants.SERVER_INDEX_PROPERTY_NAME, Integer.toString(serverIndex)); return env; diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/tools/container/LocalTestServer.java b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/tools/container/LocalTestServer.java index e4b615dbe2..54e07e41c3 100644 --- a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/tools/container/LocalTestServer.java +++ b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/tools/container/LocalTestServer.java @@ -54,7 +54,7 @@ public class LocalTestServer implements Server, Runnable { private boolean started = false; - private final HashMap> allBindings = new HashMap>(); + private final HashMap> allBindings = new HashMap<>(); private JMSServerManagerImpl jmsServerManager; // Static --------------------------------------------------------------------------------------- @@ -269,10 +269,10 @@ public class LocalTestServer implements Server, Runnable { final int dupsOkBatchSize, final boolean blockOnAcknowledge, final String... jndiBindings) throws Exception { - List connectorConfigs = new ArrayList(); + List connectorConfigs = new ArrayList<>(); connectorConfigs.add(new TransportConfiguration(NettyConnectorFactory.class.getName())); - ArrayList connectors = new ArrayList(); + ArrayList connectors = new ArrayList<>(); connectors.add("netty"); getJMSServerManager().createConnectionFactory(objectName, false, type, connectors, clientId, ActiveMQClient.DEFAULT_CLIENT_FAILURE_CHECK_PERIOD, ActiveMQClient.DEFAULT_CONNECTION_TTL, ActiveMQClient.DEFAULT_CALL_TIMEOUT, ActiveMQClient.DEFAULT_CALL_FAILOVER_TIMEOUT, ActiveMQClient.DEFAULT_CACHE_LARGE_MESSAGE_CLIENT, ActiveMQClient.DEFAULT_MIN_LARGE_MESSAGE_SIZE, ActiveMQClient.DEFAULT_COMPRESS_LARGE_MESSAGES, prefetchSize, ActiveMQClient.DEFAULT_CONSUMER_MAX_RATE, ActiveMQClient.DEFAULT_CONFIRMATION_WINDOW_SIZE, ActiveMQClient.DEFAULT_PRODUCER_WINDOW_SIZE, ActiveMQClient.DEFAULT_PRODUCER_MAX_RATE, blockOnAcknowledge, true, true, ActiveMQClient.DEFAULT_AUTO_GROUP, ActiveMQClient.DEFAULT_PRE_ACKNOWLEDGE, ActiveMQClient.DEFAULT_CONNECTION_LOAD_BALANCING_POLICY_CLASS_NAME, ActiveMQClient.DEFAULT_ACK_BATCH_SIZE, dupsOkBatchSize, ActiveMQClient.DEFAULT_USE_GLOBAL_POOLS, ActiveMQClient.DEFAULT_SCHEDULED_THREAD_POOL_MAX_SIZE, ActiveMQClient.DEFAULT_THREAD_POOL_MAX_SIZE, ActiveMQClient.DEFAULT_RETRY_INTERVAL, ActiveMQClient.DEFAULT_RETRY_INTERVAL_MULTIPLIER, ActiveMQClient.DEFAULT_MAX_RETRY_INTERVAL, ActiveMQClient.DEFAULT_RECONNECT_ATTEMPTS, ActiveMQClient.DEFAULT_FAILOVER_ON_INITIAL_CONNECTION, null, jndiBindings); @@ -358,7 +358,7 @@ public class LocalTestServer implements Server, Runnable { ObjectName objectName = ObjectNameBuilder.DEFAULT.getJMSTopicObjectName(s); TopicControl topic = MBeanServerInvocationHandler.newProxyInstance(ManagementFactory.getPlatformMBeanServer(), objectName, TopicControl.class, false); Object[] subInfos = topic.listAllSubscriptions(); - List subs = new ArrayList(); + List subs = new ArrayList<>(); for (Object o : subInfos) { Object[] data = (Object[]) o; subs.add((String) data[2]); diff --git a/tests/joram-tests/src/test/java/org/apache/activemq/artemis/jms/ActiveMQAdmin.java b/tests/joram-tests/src/test/java/org/apache/activemq/artemis/jms/ActiveMQAdmin.java index 94ebed1589..27d2a464e8 100644 --- a/tests/joram-tests/src/test/java/org/apache/activemq/artemis/jms/ActiveMQAdmin.java +++ b/tests/joram-tests/src/test/java/org/apache/activemq/artemis/jms/ActiveMQAdmin.java @@ -65,7 +65,7 @@ public class ActiveMQAdmin implements Admin { public ActiveMQAdmin() { serverLifeCycleActive = Boolean.valueOf(System.getProperty(SERVER_LIVE_CYCLE_PROPERTY, "true")); try { - Hashtable env = new Hashtable(); + Hashtable env = new Hashtable<>(); env.put("java.naming.factory.initial", "org.apache.activemq.artemis.jndi.ActiveMQInitialContextFactory"); env.put("java.naming.provider.url", "tcp://localhost:61616"); context = new InitialContext(env); diff --git a/tests/performance-tests/src/test/java/org/apache/activemq/artemis/tests/performance/paging/MeasurePagingMultiThreadTest.java b/tests/performance-tests/src/test/java/org/apache/activemq/artemis/tests/performance/paging/MeasurePagingMultiThreadTest.java index 31133d2ea2..87645b81cd 100644 --- a/tests/performance-tests/src/test/java/org/apache/activemq/artemis/tests/performance/paging/MeasurePagingMultiThreadTest.java +++ b/tests/performance-tests/src/test/java/org/apache/activemq/artemis/tests/performance/paging/MeasurePagingMultiThreadTest.java @@ -40,7 +40,7 @@ public class MeasurePagingMultiThreadTest extends ActiveMQTestBase { final int NUMBER_OF_MESSAGES = 50000; final int SIZE_OF_MESSAGE = 1024; - HashMap settings = new HashMap(); + HashMap settings = new HashMap<>(); ActiveMQServer messagingService = createServer(true, createDefaultInVMConfig(), 10 * 1024, 20 * 1024, settings); messagingService.start(); diff --git a/tests/performance-tests/src/test/java/org/apache/activemq/artemis/tests/performance/sends/AbstractSendReceivePerfTest.java b/tests/performance-tests/src/test/java/org/apache/activemq/artemis/tests/performance/sends/AbstractSendReceivePerfTest.java index 7e3c16c3cb..12d622941e 100644 --- a/tests/performance-tests/src/test/java/org/apache/activemq/artemis/tests/performance/sends/AbstractSendReceivePerfTest.java +++ b/tests/performance-tests/src/test/java/org/apache/activemq/artemis/tests/performance/sends/AbstractSendReceivePerfTest.java @@ -64,7 +64,7 @@ public abstract class AbstractSendReceivePerfTest extends JMSTestBase { @Override protected void registerConnectionFactory() throws Exception { - List connectorConfigs = new ArrayList(); + List connectorConfigs = new ArrayList<>(); connectorConfigs.add(new TransportConfiguration(NETTY_CONNECTOR_FACTORY)); createCF(connectorConfigs, "/cf"); diff --git a/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/client/ClientSoakTest.java b/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/client/ClientSoakTest.java index 1f770d96e4..77d09a8df3 100644 --- a/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/client/ClientSoakTest.java +++ b/tests/soak-tests/src/test/java/org/apache/activemq/artemis/tests/soak/client/ClientSoakTest.java @@ -76,7 +76,7 @@ public class ClientSoakTest extends ActiveMQTestBase { DivertConfiguration divert2 = new DivertConfiguration().setName("dv2").setRoutingName("nm2").setAddress(ClientSoakTest.ADDRESS.toString()).setForwardingAddress(ClientSoakTest.DIVERTED_AD2.toString()).setExclusive(true); - ArrayList divertList = new ArrayList(); + ArrayList divertList = new ArrayList<>(); divertList.add(divert1); divertList.add(divert2); diff --git a/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/journal/AddAndRemoveStressTest.java b/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/journal/AddAndRemoveStressTest.java index 3bf033e3bb..5c7ec19069 100644 --- a/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/journal/AddAndRemoveStressTest.java +++ b/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/journal/AddAndRemoveStressTest.java @@ -112,8 +112,8 @@ public class AddAndRemoveStressTest extends ActiveMQTestBase { impl.start(); - ArrayList info = new ArrayList(); - ArrayList trans = new ArrayList(); + ArrayList info = new ArrayList<>(); + ArrayList trans = new ArrayList<>(); impl.load(info, trans, null); @@ -174,8 +174,8 @@ public class AddAndRemoveStressTest extends ActiveMQTestBase { impl.start(); - ArrayList info = new ArrayList(); - ArrayList trans = new ArrayList(); + ArrayList info = new ArrayList<>(); + ArrayList trans = new ArrayList<>(); impl.load(info, trans, null); diff --git a/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/journal/JournalCleanupCompactStressTest.java b/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/journal/JournalCleanupCompactStressTest.java index 2bab97b95c..75600a19b1 100644 --- a/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/journal/JournalCleanupCompactStressTest.java +++ b/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/journal/JournalCleanupCompactStressTest.java @@ -265,8 +265,8 @@ public class JournalCleanupCompactStressTest extends ActiveMQTestBase { private void reloadJournal() throws Exception { assertEquals(0, errors.get()); - ArrayList committedRecords = new ArrayList(); - ArrayList preparedTransactions = new ArrayList(); + ArrayList committedRecords = new ArrayList<>(); + ArrayList preparedTransactions = new ArrayList<>(); journal.load(committedRecords, preparedTransactions, new TransactionFailureCallback() { @Override public void failedTransaction(long transactionID, List records, List recordsToDelete) { @@ -297,7 +297,7 @@ public class JournalCleanupCompactStressTest extends ActiveMQTestBase { class FastAppenderTx extends Thread { - LinkedBlockingDeque queue = new LinkedBlockingDeque(); + LinkedBlockingDeque queue = new LinkedBlockingDeque<>(); OperationContextImpl ctx = new OperationContextImpl(executorFactory.getExecutor()); diff --git a/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/journal/JournalRestartStressTest.java b/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/journal/JournalRestartStressTest.java index c718719026..1454a3a868 100644 --- a/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/journal/JournalRestartStressTest.java +++ b/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/journal/JournalRestartStressTest.java @@ -120,7 +120,7 @@ public class JournalRestartStressTest extends ActiveMQTestBase { final ClientSession sessionReceive = sf.createSession(true, true); sessionReceive.start(); - final ArrayList errors = new ArrayList(); + final ArrayList errors = new ArrayList<>(); Thread tReceive = new Thread() { @Override diff --git a/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/journal/MultiThreadConsumerStressTest.java b/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/journal/MultiThreadConsumerStressTest.java index ab786b7fcf..e4add672e8 100644 --- a/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/journal/MultiThreadConsumerStressTest.java +++ b/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/journal/MultiThreadConsumerStressTest.java @@ -89,7 +89,7 @@ public class MultiThreadConsumerStressTest extends ActiveMQTestBase { CountDownLatch latchStart = new CountDownLatch(1); - ArrayList threads = new ArrayList(); + ArrayList threads = new ArrayList<>(); ProducerThread[] prod = new ProducerThread[numberOfProducers]; for (int i = 0; i < numberOfProducers; i++) { diff --git a/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/journal/NIOMultiThreadCompactorStressTest.java b/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/journal/NIOMultiThreadCompactorStressTest.java index 205022c52c..bdb68d5118 100644 --- a/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/journal/NIOMultiThreadCompactorStressTest.java +++ b/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/journal/NIOMultiThreadCompactorStressTest.java @@ -86,8 +86,8 @@ public class NIOMultiThreadCompactorStressTest extends ActiveMQTestBase { NIOSequentialFileFactory factory = new NIOSequentialFileFactory(new File(getJournalDir()), 1); JournalImpl journal = new JournalImpl(ActiveMQDefaultConfiguration.getDefaultJournalFileSize(), 2, 0, 0, factory, "activemq-data", "amq", 100); - List committedRecords = new ArrayList(); - List preparedTransactions = new ArrayList(); + List committedRecords = new ArrayList<>(); + List preparedTransactions = new ArrayList<>(); journal.start(); journal.load(committedRecords, preparedTransactions, null); @@ -181,7 +181,7 @@ public class NIOMultiThreadCompactorStressTest extends ActiveMQTestBase { CountDownLatch latchStart = new CountDownLatch(1); - ArrayList threads = new ArrayList(); + ArrayList threads = new ArrayList<>(); ProducerThread[] prod = new ProducerThread[numberOfProducers]; for (int i = 0; i < numberOfProducers; i++) { diff --git a/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/paging/MultipleConsumersPageStressTest.java b/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/paging/MultipleConsumersPageStressTest.java index befef1c714..a9116a9fe4 100644 --- a/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/paging/MultipleConsumersPageStressTest.java +++ b/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/paging/MultipleConsumersPageStressTest.java @@ -71,11 +71,11 @@ public class MultipleConsumersPageStressTest extends ActiveMQTestBase { private volatile boolean runningConsumer = true; - ArrayList producers = new ArrayList(); + ArrayList producers = new ArrayList<>(); - ArrayList consumers = new ArrayList(); + ArrayList consumers = new ArrayList<>(); - ArrayList exceptions = new ArrayList(); + ArrayList exceptions = new ArrayList<>(); @Test public void testOpenConsumerEveryTimeDefaultFlowControl0() throws Throwable { @@ -96,7 +96,7 @@ public class MultipleConsumersPageStressTest extends ActiveMQTestBase { public void setUp() throws Exception { super.setUp(); - HashMap settings = new HashMap(); + HashMap settings = new HashMap<>(); server = createServer(true, createDefaultInVMConfig(), 10024, 200024, settings); server.start(); diff --git a/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/paging/PageCursorStressTest.java b/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/paging/PageCursorStressTest.java index d0e127ab15..febcb453e1 100644 --- a/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/paging/PageCursorStressTest.java +++ b/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/paging/PageCursorStressTest.java @@ -780,7 +780,7 @@ public class PageCursorStressTest extends ActiveMQTestBase { public void setUp() throws Exception { super.setUp(); OperationContextImpl.clearContext(); - queueList = new ArrayList(); + queueList = new ArrayList<>(); createServer(); lock = new ReentrantReadWriteLock().readLock(); diff --git a/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/paging/PageStressTest.java b/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/paging/PageStressTest.java index de3d545678..a43958782d 100644 --- a/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/paging/PageStressTest.java +++ b/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/paging/PageStressTest.java @@ -48,7 +48,7 @@ public class PageStressTest extends ActiveMQTestBase { public void testStopDuringDepage() throws Exception { Configuration config = createDefaultInVMConfig().setJournalSyncNonTransactional(false).setJournalSyncTransactional(false); - HashMap settings = new HashMap(); + HashMap settings = new HashMap<>(); AddressSettings setting = new AddressSettings().setMaxSizeBytes(20 * 1024 * 1024); settings.put("page-adr", setting); diff --git a/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/stomp/StompStressTest.java b/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/stomp/StompStressTest.java index 1a7b7648d9..71485edff3 100644 --- a/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/stomp/StompStressTest.java +++ b/tests/stress-tests/src/test/java/org/apache/activemq/artemis/tests/stress/stomp/StompStressTest.java @@ -103,7 +103,7 @@ public class StompStressTest extends ActiveMQTestBase { } private ActiveMQServer createServer() throws Exception { - Map params = new HashMap(); + Map params = new HashMap<>(); params.put(TransportConstants.PROTOCOLS_PROP_NAME, StompProtocolManagerFactory.STOMP_PROTOCOL_NAME); params.put(TransportConstants.PORT_PROP_NAME, TransportConstants.DEFAULT_STOMP_PORT); TransportConfiguration stompTransport = new TransportConfiguration(NettyAcceptorFactory.class.getName(), params); diff --git a/tests/timing-tests/src/test/java/org/apache/activemq/artemis/tests/timing/core/server/impl/QueueConcurrentTest.java b/tests/timing-tests/src/test/java/org/apache/activemq/artemis/tests/timing/core/server/impl/QueueConcurrentTest.java index deb32b5481..adf97fc011 100644 --- a/tests/timing-tests/src/test/java/org/apache/activemq/artemis/tests/timing/core/server/impl/QueueConcurrentTest.java +++ b/tests/timing-tests/src/test/java/org/apache/activemq/artemis/tests/timing/core/server/impl/QueueConcurrentTest.java @@ -119,7 +119,7 @@ public class QueueConcurrentTest extends ActiveMQTestBase { return e; } - private final List refs = new ArrayList(); + private final List refs = new ArrayList<>(); public List getReferences() { return refs; diff --git a/tests/timing-tests/src/test/java/org/apache/activemq/artemis/tests/timing/core/server/impl/QueueImplTest.java b/tests/timing-tests/src/test/java/org/apache/activemq/artemis/tests/timing/core/server/impl/QueueImplTest.java index a2120e81e9..8fb9b9beab 100644 --- a/tests/timing-tests/src/test/java/org/apache/activemq/artemis/tests/timing/core/server/impl/QueueImplTest.java +++ b/tests/timing-tests/src/test/java/org/apache/activemq/artemis/tests/timing/core/server/impl/QueueImplTest.java @@ -106,7 +106,7 @@ public class QueueImplTest extends ActiveMQTestBase { ref8.setScheduledDeliveryTime(now + 6000); queue.addTail(ref8); - List refs = new ArrayList(); + List refs = new ArrayList<>(); // Scheduled refs are added back to *FRONT* of queue - otherwise if there were many messages in the queue // They may get stranded behind a big backlog @@ -179,7 +179,7 @@ public class QueueImplTest extends ActiveMQTestBase { queue.deliverNow(); - List refs = new ArrayList(); + List refs = new ArrayList<>(); refs.add(ref2); refs.add(ref3); diff --git a/tests/timing-tests/src/test/java/org/apache/activemq/artemis/tests/timing/jms/bridge/impl/JMSBridgeImplTest.java b/tests/timing-tests/src/test/java/org/apache/activemq/artemis/tests/timing/jms/bridge/impl/JMSBridgeImplTest.java index 896fda8852..4054c64137 100644 --- a/tests/timing-tests/src/test/java/org/apache/activemq/artemis/tests/timing/jms/bridge/impl/JMSBridgeImplTest.java +++ b/tests/timing-tests/src/test/java/org/apache/activemq/artemis/tests/timing/jms/bridge/impl/JMSBridgeImplTest.java @@ -319,7 +319,7 @@ public class JMSBridgeImplTest extends ActiveMQTestBase { Connection targetConn = JMSBridgeImplTest.createConnectionFactory().createConnection(); Session targetSess = targetConn.createSession(false, Session.AUTO_ACKNOWLEDGE); MessageConsumer consumer = targetSess.createConsumer(targetDF.createDestination()); - final List messages = new LinkedList(); + final List messages = new LinkedList<>(); MessageListener listener = new MessageListener() { @Override @@ -378,7 +378,7 @@ public class JMSBridgeImplTest extends ActiveMQTestBase { Connection targetConn = JMSBridgeImplTest.createConnectionFactory().createConnection(); Session targetSess = targetConn.createSession(false, Session.AUTO_ACKNOWLEDGE); MessageConsumer consumer = targetSess.createConsumer(targetDF.createDestination()); - final List messages = new LinkedList(); + final List messages = new LinkedList<>(); final CountDownLatch latch = new CountDownLatch(numMessages); MessageListener listener = new MessageListener() { @Override @@ -480,7 +480,7 @@ public class JMSBridgeImplTest extends ActiveMQTestBase { @Test public void testExceptionOnSourceAndRetrySucceeds() throws Exception { - final AtomicReference sourceConn = new AtomicReference(); + final AtomicReference sourceConn = new AtomicReference<>(); ActiveMQJMSConnectionFactory failingSourceCF = new ActiveMQJMSConnectionFactory(false, new TransportConfiguration(InVMConnectorFactory.class.getName())) { private static final long serialVersionUID = -8866390811966688830L; @@ -530,7 +530,7 @@ public class JMSBridgeImplTest extends ActiveMQTestBase { @Test public void testExceptionOnSourceAndRetryFails() throws Exception { - final AtomicReference sourceConn = new AtomicReference(); + final AtomicReference sourceConn = new AtomicReference<>(); ActiveMQJMSConnectionFactory failingSourceCF = new ActiveMQJMSConnectionFactory(false, new TransportConfiguration(INVM_CONNECTOR_FACTORY)) { private static final long serialVersionUID = 8216804886099984645L; boolean firstTime = true; @@ -587,7 +587,7 @@ public class JMSBridgeImplTest extends ActiveMQTestBase { public void testStartWithSpecificTCCL() throws Exception { MockContextClassLoader mockTccl = setMockTCCL(); try { - final AtomicReference sourceConn = new AtomicReference(); + final AtomicReference sourceConn = new AtomicReference<>(); ActiveMQJMSConnectionFactory failingSourceCF = new ActiveMQJMSConnectionFactory(false, new TransportConfiguration(InVMConnectorFactory.class.getName())) { private static final long serialVersionUID = -8866390811966688830L; diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/asyncio/MultiThreadAsynchronousFileTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/asyncio/MultiThreadAsynchronousFileTest.java index 469d2a2639..4806bf9e3c 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/asyncio/MultiThreadAsynchronousFileTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/asyncio/MultiThreadAsynchronousFileTest.java @@ -109,7 +109,7 @@ public class MultiThreadAsynchronousFileTest extends AIOTestBase { CountDownLatch latchStart = new CountDownLatch(MultiThreadAsynchronousFileTest.NUMBER_OF_THREADS + 1); - ArrayList list = new ArrayList(MultiThreadAsynchronousFileTest.NUMBER_OF_THREADS); + ArrayList list = new ArrayList<>(MultiThreadAsynchronousFileTest.NUMBER_OF_THREADS); for (int i = 0; i < MultiThreadAsynchronousFileTest.NUMBER_OF_THREADS; i++) { ThreadProducer producer = new ThreadProducer("Thread " + i, latchStart, file, sync); list.add(producer); @@ -197,7 +197,7 @@ public class MultiThreadAsynchronousFileTest extends AIOTestBase { latchFinishThread = new CountDownLatch(MultiThreadAsynchronousFileTest.NUMBER_OF_LINES); } - LinkedList list = new LinkedList(); + LinkedList list = new LinkedList<>(); for (int i = 0; i < MultiThreadAsynchronousFileTest.NUMBER_OF_LINES; i++) { diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/config/impl/ConnectorsServiceTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/config/impl/ConnectorsServiceTest.java index 110a621353..300f9782b0 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/config/impl/ConnectorsServiceTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/config/impl/ConnectorsServiceTest.java @@ -77,7 +77,7 @@ public class ConnectorsServiceTest extends ActiveMQTestBase { public void testConnectorsServiceUsesConfiguredConnectorServices() throws Exception { ConnectorServiceConfiguration connectorServiceConfiguration = new ConnectorServiceConfiguration().setFactoryClassName(FakeConnectorServiceFactory.class.getCanonicalName()).setParams(new HashMap()).setName("myfact"); - List connectorServiceConfigurations = new ArrayList(); + List connectorServiceConfigurations = new ArrayList<>(); connectorServiceConfigurations.add(connectorServiceConfiguration); configuration.setConnectorServiceConfigurations(connectorServiceConfigurations); diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/config/impl/fakes/FakeConnectorServiceFactory.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/config/impl/fakes/FakeConnectorServiceFactory.java index af7b94de4d..16bdc7cf9e 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/config/impl/fakes/FakeConnectorServiceFactory.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/config/impl/fakes/FakeConnectorServiceFactory.java @@ -48,12 +48,12 @@ public class FakeConnectorServiceFactory implements ConnectorServiceFactory { @Override public Set getAllowableProperties() { - return new HashSet(); + return new HashSet<>(); } @Override public Set getRequiredProperties() { - return new HashSet(); + return new HashSet<>(); } public ConnectorService getConnectorService() { diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/AlignedJournalImplTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/AlignedJournalImplTest.java index 97cd4fe8b6..e01263b095 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/AlignedJournalImplTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/AlignedJournalImplTest.java @@ -1128,7 +1128,7 @@ public class AlignedJournalImplTest extends ActiveMQTestBase { final CountDownLatch latchReady = new CountDownLatch(2); final CountDownLatch latchStart = new CountDownLatch(1); final AtomicInteger finishedOK = new AtomicInteger(0); - final BlockingQueue queueDelete = new LinkedBlockingQueue(); + final BlockingQueue queueDelete = new LinkedBlockingQueue<>(); final int NUMBER_OF_ELEMENTS = 500; @@ -1234,8 +1234,8 @@ public class AlignedJournalImplTest extends ActiveMQTestBase { addActiveMQComponent(journalImpl); journalImpl.start(); - ArrayList info = new ArrayList(); - ArrayList trans = new ArrayList(); + ArrayList info = new ArrayList<>(); + ArrayList trans = new ArrayList<>(); journalImpl.load(info, trans, null); @@ -1253,11 +1253,11 @@ public class AlignedJournalImplTest extends ActiveMQTestBase { public void setUp() throws Exception { super.setUp(); - records = new ArrayList(); + records = new ArrayList<>(); - transactions = new ArrayList(); + transactions = new ArrayList<>(); - incompleteTransactions = new ArrayList(); + incompleteTransactions = new ArrayList<>(); factory = null; diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/JournalAsyncTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/JournalAsyncTest.java index 22395e8ba4..f8a907ab25 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/JournalAsyncTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/JournalAsyncTest.java @@ -173,9 +173,9 @@ public class JournalAsyncTest extends ActiveMQTestBase { public void setUp() throws Exception { super.setUp(); - records = new ArrayList(); + records = new ArrayList<>(); - transactions = new ArrayList(); + transactions = new ArrayList<>(); factory = null; diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/JournalImplTestBase.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/JournalImplTestBase.java index 4c6c4e7da6..e502ff716b 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/JournalImplTestBase.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/JournalImplTestBase.java @@ -42,13 +42,13 @@ import org.junit.Before; public abstract class JournalImplTestBase extends ActiveMQTestBase { - protected List records = new LinkedList(); + protected List records = new LinkedList<>(); protected TestableJournal journal; protected int recordLength = 1024; - protected Map transactions = new LinkedHashMap(); + protected Map transactions = new LinkedHashMap<>(); protected int maxAIO; @@ -233,9 +233,9 @@ public abstract class JournalImplTestBase extends ActiveMQTestBase { } protected void loadAndCheck(final boolean printDebugJournal) throws Exception { - List committedRecords = new ArrayList(); + List committedRecords = new ArrayList<>(); - List preparedTransactions = new ArrayList(); + List preparedTransactions = new ArrayList<>(); journal.load(committedRecords, preparedTransactions, null); @@ -247,7 +247,7 @@ public abstract class JournalImplTestBase extends ActiveMQTestBase { // check prepared transactions - List prepared = new ArrayList(); + List prepared = new ArrayList<>(); for (Map.Entry entry : transactions.entrySet()) { if (entry.getValue().prepared) { @@ -537,9 +537,9 @@ public abstract class JournalImplTestBase extends ActiveMQTestBase { static final class TransactionHolder { - List records = new ArrayList(); + List records = new ArrayList<>(); - List deletes = new ArrayList(); + List deletes = new ArrayList<>(); boolean prepared; } diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/ReclaimerTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/ReclaimerTest.java index 53849c73cd..39132a5dc1 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/ReclaimerTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/ReclaimerTest.java @@ -722,13 +722,13 @@ public class ReclaimerTest extends ActiveMQTestBase { static final class MockJournalFile implements JournalFile { - private final Set transactionIDs = new HashSet(); + private final Set transactionIDs = new HashSet<>(); - private final Set transactionTerminationIDs = new HashSet(); + private final Set transactionTerminationIDs = new HashSet<>(); - private final Set transactionPrepareIDs = new HashSet(); + private final Set transactionPrepareIDs = new HashSet<>(); - private final Map negCounts = new HashMap(); + private final Map negCounts = new HashMap<>(); private int posCount; diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/SequentialFileFactoryTestBase.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/SequentialFileFactoryTestBase.java index 18b8a9c2a0..5ec0d074b1 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/SequentialFileFactoryTestBase.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/SequentialFileFactoryTestBase.java @@ -73,7 +73,7 @@ public abstract class SequentialFileFactoryTestBase extends ActiveMQTestBase { @Test public void testCreateAndListFiles() throws Exception { - List expectedFiles = new ArrayList(); + List expectedFiles = new ArrayList<>(); final int numFiles = 10; diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/TimedBufferTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/TimedBufferTest.java index 537cabf17a..780c4ed4ff 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/TimedBufferTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/TimedBufferTest.java @@ -59,7 +59,7 @@ public class TimedBufferTest extends ActiveMQTestBase { @Test public void testFillBuffer() { - final ArrayList buffers = new ArrayList(); + final ArrayList buffers = new ArrayList<>(); final AtomicInteger flushTimes = new AtomicInteger(0); class TestObserver implements TimedBufferObserver { @@ -128,7 +128,7 @@ public class TimedBufferTest extends ActiveMQTestBase { @Test public void testTimingAndFlush() throws Exception { - final ArrayList buffers = new ArrayList(); + final ArrayList buffers = new ArrayList<>(); final AtomicInteger flushTimes = new AtomicInteger(0); class TestObserver implements TimedBufferObserver { diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/fakes/FakeSequentialFileFactory.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/fakes/FakeSequentialFileFactory.java index 7ab0abf683..fd44f2bcf2 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/fakes/FakeSequentialFileFactory.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/journal/impl/fakes/FakeSequentialFileFactory.java @@ -35,7 +35,7 @@ import org.apache.activemq.artemis.core.io.buffer.TimedBuffer; public class FakeSequentialFileFactory implements SequentialFileFactory { - private final Map fileMap = new ConcurrentHashMap(); + private final Map fileMap = new ConcurrentHashMap<>(); private final int alignment; @@ -52,7 +52,7 @@ public class FakeSequentialFileFactory implements SequentialFileFactory { public FakeSequentialFileFactory(final int alignment, final boolean supportsCallback) { this.alignment = alignment; this.supportsCallback = supportsCallback; - callbacksInHold = new ArrayList(); + callbacksInHold = new ArrayList<>(); } public FakeSequentialFileFactory() { @@ -98,7 +98,7 @@ public class FakeSequentialFileFactory implements SequentialFileFactory { @Override public List listFiles(final String extension) { - List files = new ArrayList(); + List files = new ArrayList<>(); for (String s : fileMap.keySet()) { if (s.endsWith("." + extension)) { diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/message/impl/MessageImplTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/message/impl/MessageImplTest.java index 18f37e6ccb..0178f63570 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/message/impl/MessageImplTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/message/impl/MessageImplTest.java @@ -302,7 +302,7 @@ public class MessageImplTest extends ActiveMQTestBase { } } - ArrayList threads = new ArrayList(); + ArrayList threads = new ArrayList<>(); for (int i = 0; i < T1_number; i++) { T1 t = new T1(); diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/paging/impl/PageTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/paging/impl/PageTest.java index aa06ea02d1..d6e0f72c19 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/paging/impl/PageTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/paging/impl/PageTest.java @@ -193,7 +193,7 @@ public class PageTest extends ActiveMQTestBase { protected ArrayList addPageElements(final SimpleString simpleDestination, final Page page, final int numberOfElements) throws Exception { - ArrayList buffers = new ArrayList(); + ArrayList buffers = new ArrayList<>(); int initialNumberOfMessages = page.getNumberOfMessages(); diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/paging/impl/PagingManagerImplTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/paging/impl/PagingManagerImplTest.java index 5f2175376b..868bdfa54b 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/paging/impl/PagingManagerImplTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/paging/impl/PagingManagerImplTest.java @@ -50,7 +50,7 @@ public class PagingManagerImplTest extends ActiveMQTestBase { @Test public void testPagingManager() throws Exception { - HierarchicalRepository addressSettings = new HierarchicalObjectRepository(); + HierarchicalRepository addressSettings = new HierarchicalObjectRepository<>(); addressSettings.setDefault(new AddressSettings().setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE)); final StorageManager storageManager = new NullStorageManager(); diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/paging/impl/PagingStoreImplTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/paging/impl/PagingStoreImplTest.java index 13908b07d7..d361ffa520 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/paging/impl/PagingStoreImplTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/paging/impl/PagingStoreImplTest.java @@ -141,7 +141,7 @@ public class PagingStoreImplTest extends ActiveMQTestBase { Assert.assertEquals(1, storeImpl.getNumberOfPages()); - List buffers = new ArrayList(); + List buffers = new ArrayList<>(); ActiveMQBuffer buffer = createRandomBuffer(0, 10); @@ -183,7 +183,7 @@ public class PagingStoreImplTest extends ActiveMQTestBase { storeImpl.startPaging(); - List buffers = new ArrayList(); + List buffers = new ArrayList<>(); int numMessages = 10; @@ -247,7 +247,7 @@ public class PagingStoreImplTest extends ActiveMQTestBase { Assert.assertEquals(1, store.getNumberOfPages()); - List buffers = new ArrayList(); + List buffers = new ArrayList<>(); for (int i = 0; i < 10; i++) { @@ -370,9 +370,9 @@ public class PagingStoreImplTest extends ActiveMQTestBase { final CountDownLatch latchStart = new CountDownLatch(numberOfThreads); - final ConcurrentHashMap buffers = new ConcurrentHashMap(); + final ConcurrentHashMap buffers = new ConcurrentHashMap<>(); - final ArrayList readPages = new ArrayList(); + final ArrayList readPages = new ArrayList<>(); AddressSettings settings = new AddressSettings().setPageSizeBytes(MAX_SIZE).setAddressFullMessagePolicy(AddressFullMessagePolicy.PAGE); @@ -477,7 +477,7 @@ public class PagingStoreImplTest extends ActiveMQTestBase { throw consumer.e; } - final ConcurrentMap buffers2 = new ConcurrentHashMap(); + final ConcurrentMap buffers2 = new ConcurrentHashMap<>(); for (Page page : readPages) { page.open(); @@ -627,7 +627,7 @@ public class PagingStoreImplTest extends ActiveMQTestBase { final long NUMBER_OF_MESSAGES = 100000; - final List errors = new ArrayList(); + final List errors = new ArrayList<>(); class WriterThread extends Thread { diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/persistence/impl/BatchIDGeneratorUnitTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/persistence/impl/BatchIDGeneratorUnitTest.java index 30d7f2ade1..554a5e3166 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/persistence/impl/BatchIDGeneratorUnitTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/persistence/impl/BatchIDGeneratorUnitTest.java @@ -114,8 +114,8 @@ public class BatchIDGeneratorUnitTest extends ActiveMQTestBase { } protected void loadIDs(final Journal journal, final BatchingIDGenerator batch) throws Exception { - ArrayList records = new ArrayList(); - ArrayList tx = new ArrayList(); + ArrayList records = new ArrayList<>(); + ArrayList tx = new ArrayList<>(); journal.start(); journal.load(records, tx, null); diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/DuplicateDetectionUnitTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/DuplicateDetectionUnitTest.java index af6fc72217..e89510e64e 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/DuplicateDetectionUnitTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/DuplicateDetectionUnitTest.java @@ -96,7 +96,7 @@ public class DuplicateDetectionUnitTest extends ActiveMQTestBase { journal.start(); journal.loadBindingJournal(new ArrayList(), new ArrayList()); - HashMap>> mapDups = new HashMap>>(); + HashMap>> mapDups = new HashMap<>(); FakePagingManager pagingManager = new FakePagingManager(); journal.loadMessageJournal(postOffice, pagingManager, new ResourceManagerImpl(0, 0, scheduledThreadPool), null, mapDups, null, null, new PostOfficeJournalLoader(postOffice, pagingManager, null, null, null, null, null, null)); diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/WildcardAddressManagerUnitTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/WildcardAddressManagerUnitTest.java index 6f177706f9..23b1c652db 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/WildcardAddressManagerUnitTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/postoffice/impl/WildcardAddressManagerUnitTest.java @@ -179,7 +179,7 @@ public class WildcardAddressManagerUnitTest extends ActiveMQTestBase { class BindignsFake implements Bindings { - ArrayList bindings = new ArrayList(); + ArrayList bindings = new ArrayList<>(); @Override public Collection getBindings() { diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/remoting/impl/invm/InVMConnectorFactoryTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/remoting/impl/invm/InVMConnectorFactoryTest.java index 3fe6af144e..0e4e18198a 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/remoting/impl/invm/InVMConnectorFactoryTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/remoting/impl/invm/InVMConnectorFactoryTest.java @@ -43,7 +43,7 @@ public class InVMConnectorFactoryTest { assertTrue(tc.getParams().equals(InVMConnector.DEFAULT_CONFIG)); // Test defaults are not set when TransportConfig params are not empty - Map params = new HashMap(); + Map params = new HashMap<>(); params.put("Foo", "Bar"); tc = new TransportConfiguration(InVMConnectorFactory.class.getName(), params); assertTrue(tc.getParams().size() == 1); diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/remoting/impl/netty/NettyAcceptorFactoryTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/remoting/impl/netty/NettyAcceptorFactoryTest.java index a8fdfabec4..ac2ff3c78b 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/remoting/impl/netty/NettyAcceptorFactoryTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/remoting/impl/netty/NettyAcceptorFactoryTest.java @@ -40,7 +40,7 @@ public class NettyAcceptorFactoryTest extends ActiveMQTestBase { public void testCreateAcceptor() throws Exception { NettyAcceptorFactory factory = new NettyAcceptorFactory(); - Map params = new HashMap(); + Map params = new HashMap<>(); BufferHandler handler = new BufferHandler() { @Override diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/remoting/impl/netty/NettyAcceptorTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/remoting/impl/netty/NettyAcceptorTest.java index 55aae43f02..f0ea5db1a5 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/remoting/impl/netty/NettyAcceptorTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/remoting/impl/netty/NettyAcceptorTest.java @@ -71,7 +71,7 @@ public class NettyAcceptorTest extends ActiveMQTestBase { } }; - Map params = new HashMap(); + Map params = new HashMap<>(); ConnectionLifeCycleListener listener = new ConnectionLifeCycleListener() { @Override diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/remoting/impl/netty/NettyConnectorFactoryTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/remoting/impl/netty/NettyConnectorFactoryTest.java index b391b2c292..e4c7cd7fa6 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/remoting/impl/netty/NettyConnectorFactoryTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/remoting/impl/netty/NettyConnectorFactoryTest.java @@ -43,7 +43,7 @@ public class NettyConnectorFactoryTest { assertTrue(tc.getParams().equals(NettyConnector.DEFAULT_CONFIG)); // Test defaults are not set when TransportConfig params are not empty - Map params = new HashMap(); + Map params = new HashMap<>(); params.put("Foo", "Bar"); tc = new TransportConfiguration(NettyConnectorFactory.class.getName(), params); assertTrue(tc.getParams().size() == 1); diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/remoting/impl/netty/NettyConnectorTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/remoting/impl/netty/NettyConnectorTest.java index fb6a5d85d0..1888fb44ee 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/remoting/impl/netty/NettyConnectorTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/remoting/impl/netty/NettyConnectorTest.java @@ -43,7 +43,7 @@ public class NettyConnectorTest extends ActiveMQTestBase { public void bufferReceived(final Object connectionID, final ActiveMQBuffer buffer) { } }; - Map params = new HashMap(); + Map params = new HashMap<>(); ConnectionLifeCycleListener listener = new ConnectionLifeCycleListener() { @Override public void connectionException(final Object connectionID, final ActiveMQException me) { @@ -79,7 +79,7 @@ public class NettyConnectorTest extends ActiveMQTestBase { public void bufferReceived(final Object connectionID, final ActiveMQBuffer buffer) { } }; - Map params = new HashMap(); + Map params = new HashMap<>(); ConnectionLifeCycleListener listener = new ConnectionLifeCycleListener() { @Override public void connectionException(final Object connectionID, final ActiveMQException me) { @@ -126,7 +126,7 @@ public class NettyConnectorTest extends ActiveMQTestBase { public void bufferReceived(final Object connectionID, final ActiveMQBuffer buffer) { } }; - Map params = new HashMap(); + Map params = new HashMap<>(); params.put(TransportConstants.SSL_ENABLED_PROP_NAME, true); params.put(TransportConstants.KEYSTORE_PATH_PROP_NAME, "bad path"); params.put(TransportConstants.KEYSTORE_PASSWORD_PROP_NAME, "bad password"); @@ -172,7 +172,7 @@ public class NettyConnectorTest extends ActiveMQTestBase { public void bufferReceived(final Object connectionID, final ActiveMQBuffer buffer) { } }; - Map params = new HashMap(); + Map params = new HashMap<>(); params.put(TransportConstants.SSL_ENABLED_PROP_NAME, true); params.put(TransportConstants.KEYSTORE_PATH_PROP_NAME, "bad path"); params.put(TransportConstants.KEYSTORE_PASSWORD_PROP_NAME, "bad password"); @@ -223,7 +223,7 @@ public class NettyConnectorTest extends ActiveMQTestBase { public void bufferReceived(final Object connectionID, final ActiveMQBuffer buffer) { } }; - Map params = new HashMap(); + Map params = new HashMap<>(); params.put(TransportConstants.SSL_ENABLED_PROP_NAME, true); params.put(TransportConstants.ENABLED_CIPHER_SUITES_PROP_NAME, "myBadCipherSuite"); ConnectionLifeCycleListener listener = new ConnectionLifeCycleListener() { @@ -262,7 +262,7 @@ public class NettyConnectorTest extends ActiveMQTestBase { public void bufferReceived(final Object connectionID, final ActiveMQBuffer buffer) { } }; - Map params = new HashMap(); + Map params = new HashMap<>(); params.put(TransportConstants.SSL_ENABLED_PROP_NAME, true); params.put(TransportConstants.ENABLED_PROTOCOLS_PROP_NAME, "myBadProtocol"); ConnectionLifeCycleListener listener = new ConnectionLifeCycleListener() { diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/security/impl/ActiveMQSecurityManagerImplTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/security/impl/ActiveMQSecurityManagerImplTest.java index ea8ca0ccc7..fdd32c0436 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/security/impl/ActiveMQSecurityManagerImplTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/security/impl/ActiveMQSecurityManagerImplTest.java @@ -61,22 +61,22 @@ public class ActiveMQSecurityManagerImplTest extends ActiveMQTestBase { Assert.assertTrue(securityManager.validateUser(null, null)); Assert.assertTrue(securityManager.validateUser("guest", "password")); Assert.assertFalse(securityManager.validateUser(null, "wrongpass")); - HashSet roles = new HashSet(); + HashSet roles = new HashSet<>(); roles.add(new Role("guest", true, true, true, true, true, true, true)); Assert.assertTrue(securityManager.validateUserAndRole(null, null, roles, CheckType.CREATE_DURABLE_QUEUE)); Assert.assertTrue(securityManager.validateUserAndRole(null, null, roles, CheckType.SEND)); Assert.assertTrue(securityManager.validateUserAndRole(null, null, roles, CheckType.CONSUME)); - roles = new HashSet(); + roles = new HashSet<>(); roles.add(new Role("guest", true, true, false, true, true, true, true)); Assert.assertFalse(securityManager.validateUserAndRole(null, null, roles, CheckType.CREATE_DURABLE_QUEUE)); Assert.assertTrue(securityManager.validateUserAndRole(null, null, roles, CheckType.SEND)); Assert.assertTrue(securityManager.validateUserAndRole(null, null, roles, CheckType.CONSUME)); - roles = new HashSet(); + roles = new HashSet<>(); roles.add(new Role("guest", true, false, false, true, true, true, true)); Assert.assertFalse(securityManager.validateUserAndRole(null, null, roles, CheckType.CREATE_DURABLE_QUEUE)); Assert.assertTrue(securityManager.validateUserAndRole(null, null, roles, CheckType.SEND)); Assert.assertFalse(securityManager.validateUserAndRole(null, null, roles, CheckType.CONSUME)); - roles = new HashSet(); + roles = new HashSet<>(); roles.add(new Role("guest", false, false, false, true, true, true, true)); Assert.assertFalse(securityManager.validateUserAndRole(null, null, roles, CheckType.CREATE_DURABLE_QUEUE)); Assert.assertFalse(securityManager.validateUserAndRole(null, null, roles, CheckType.SEND)); @@ -128,19 +128,19 @@ public class ActiveMQSecurityManagerImplTest extends ActiveMQTestBase { securityManager.getConfiguration().addRole("newuser1", "role2"); securityManager.getConfiguration().addRole("newuser1", "role3"); securityManager.getConfiguration().addRole("newuser1", "role4"); - HashSet roles = new HashSet(); + HashSet roles = new HashSet<>(); roles.add(new Role("role1", true, true, true, true, true, true, true)); Assert.assertTrue(securityManager.validateUserAndRole("newuser1", "newpassword1", roles, CheckType.SEND)); - roles = new HashSet(); + roles = new HashSet<>(); roles.add(new Role("role2", true, true, true, true, true, true, true)); Assert.assertTrue(securityManager.validateUserAndRole("newuser1", "newpassword1", roles, CheckType.SEND)); - roles = new HashSet(); + roles = new HashSet<>(); roles.add(new Role("role3", true, true, true, true, true, true, true)); Assert.assertTrue(securityManager.validateUserAndRole("newuser1", "newpassword1", roles, CheckType.SEND)); - roles = new HashSet(); + roles = new HashSet<>(); roles.add(new Role("role4", true, true, true, true, true, true, true)); Assert.assertTrue(securityManager.validateUserAndRole("newuser1", "newpassword1", roles, CheckType.SEND)); - roles = new HashSet(); + roles = new HashSet<>(); roles.add(new Role("role5", true, true, true, true, true, true, true)); Assert.assertFalse(securityManager.validateUserAndRole("newuser1", "newpassword1", roles, CheckType.SEND)); } @@ -154,19 +154,19 @@ public class ActiveMQSecurityManagerImplTest extends ActiveMQTestBase { securityManager.getConfiguration().addRole("newuser1", "role4"); securityManager.getConfiguration().removeRole("newuser1", "role2"); securityManager.getConfiguration().removeRole("newuser1", "role4"); - HashSet roles = new HashSet(); + HashSet roles = new HashSet<>(); roles.add(new Role("role1", true, true, true, true, true, true, true)); Assert.assertTrue(securityManager.validateUserAndRole("newuser1", "newpassword1", roles, CheckType.SEND)); - roles = new HashSet(); + roles = new HashSet<>(); roles.add(new Role("role2", true, true, true, true, true, true, true)); Assert.assertFalse(securityManager.validateUserAndRole("newuser1", "newpassword1", roles, CheckType.SEND)); - roles = new HashSet(); + roles = new HashSet<>(); roles.add(new Role("role3", true, true, true, true, true, true, true)); Assert.assertTrue(securityManager.validateUserAndRole("newuser1", "newpassword1", roles, CheckType.SEND)); - roles = new HashSet(); + roles = new HashSet<>(); roles.add(new Role("role4", true, true, true, true, true, true, true)); Assert.assertFalse(securityManager.validateUserAndRole("newuser1", "newpassword1", roles, CheckType.SEND)); - roles = new HashSet(); + roles = new HashSet<>(); roles.add(new Role("role5", true, true, true, true, true, true, true)); Assert.assertFalse(securityManager.validateUserAndRole("newuser1", "newpassword1", roles, CheckType.SEND)); } diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/QueueImplTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/QueueImplTest.java index 8b4e26564a..f7ad00dae6 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/QueueImplTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/QueueImplTest.java @@ -215,7 +215,7 @@ public class QueueImplTest extends ActiveMQTestBase { final int numMessages = 10; - List refs = new ArrayList(); + List refs = new ArrayList<>(); for (int i = 0; i < numMessages; i++) { MessageReference ref = generateReference(queue, i); @@ -258,7 +258,7 @@ public class QueueImplTest extends ActiveMQTestBase { final int numMessages = 10; - List refs = new ArrayList(); + List refs = new ArrayList<>(); for (int i = 0; i < numMessages; i++) { MessageReference ref = generateReference(queue, i); @@ -301,7 +301,7 @@ public class QueueImplTest extends ActiveMQTestBase { final int numMessages = 10; - List refs = new ArrayList(); + List refs = new ArrayList<>(); for (int i = 0; i < numMessages; i++) { MessageReference ref = generateReference(queue, i); @@ -359,7 +359,7 @@ public class QueueImplTest extends ActiveMQTestBase { final int numMessages = 10; - List refs1 = new ArrayList(); + List refs1 = new ArrayList<>(); for (int i = 0; i < numMessages; i++) { MessageReference ref = generateReference(queue, i); @@ -369,7 +369,7 @@ public class QueueImplTest extends ActiveMQTestBase { queue.addTail(ref); } - LinkedList refs2 = new LinkedList(); + LinkedList refs2 = new LinkedList<>(); for (int i = 0; i < numMessages; i++) { MessageReference ref = generateReference(queue, i + numMessages); @@ -379,7 +379,7 @@ public class QueueImplTest extends ActiveMQTestBase { queue.addHead(ref); } - List refs3 = new ArrayList(); + List refs3 = new ArrayList<>(); for (int i = 0; i < numMessages; i++) { MessageReference ref = generateReference(queue, i + 2 * numMessages); @@ -395,7 +395,7 @@ public class QueueImplTest extends ActiveMQTestBase { queue.deliverNow(); - List allRefs = new ArrayList(); + List allRefs = new ArrayList<>(); allRefs.addAll(refs2); allRefs.addAll(refs1); @@ -410,7 +410,7 @@ public class QueueImplTest extends ActiveMQTestBase { final int numMessages = 10; - List refs = new ArrayList(); + List refs = new ArrayList<>(); for (int i = 0; i < numMessages; i++) { MessageReference ref = generateReference(queue, i); @@ -563,7 +563,7 @@ public class QueueImplTest extends ActiveMQTestBase { final int numMessages = 10; - List refs = new ArrayList(); + List refs = new ArrayList<>(); queue.pause(); @@ -616,7 +616,7 @@ public class QueueImplTest extends ActiveMQTestBase { final int numMessages = 10; - List refs = new ArrayList(); + List refs = new ArrayList<>(); for (int i = 0; i < numMessages; i++) { MessageReference ref = generateReference(queue, i); @@ -673,7 +673,7 @@ public class QueueImplTest extends ActiveMQTestBase { final int numMessages = 20; - List refs = new ArrayList(); + List refs = new ArrayList<>(); for (int i = 0; i < numMessages; i++) { MessageReference ref = generateReference(queue, i); @@ -686,7 +686,7 @@ public class QueueImplTest extends ActiveMQTestBase { Assert.assertEquals(numMessages, getMessageCount(queue)); Iterator iterator = queue.iterator(); - List list = new ArrayList(); + List list = new ArrayList<>(); while (iterator.hasNext()) { list.add(iterator.next()); } @@ -712,7 +712,7 @@ public class QueueImplTest extends ActiveMQTestBase { queue.addConsumer(consumer); - List refs = new ArrayList(); + List refs = new ArrayList<>(); MessageReference ref1 = generateReference(queue, 1); @@ -787,7 +787,7 @@ public class QueueImplTest extends ActiveMQTestBase { final int numMessages = 10; - List refs = new ArrayList(); + List refs = new ArrayList<>(); for (int i = 0; i < numMessages; i++) { MessageReference ref = generateReference(queue, i); @@ -826,7 +826,7 @@ public class QueueImplTest extends ActiveMQTestBase { final int numMessages = 10; - List refs = new ArrayList(); + List refs = new ArrayList<>(); for (int i = 0; i < numMessages; i++) { MessageReference ref = generateReference(queue, i); @@ -889,7 +889,7 @@ public class QueueImplTest extends ActiveMQTestBase { QueueImpl queue = getTemporaryQueue(); final int numMessages = 10; - List refs = new ArrayList(); + List refs = new ArrayList<>(); for (int i = 0; i < numMessages; i++) { MessageReference ref = generateReference(queue, i); @@ -956,7 +956,7 @@ public class QueueImplTest extends ActiveMQTestBase { queue.addConsumer(consumer); } - List refs = new ArrayList(); + List refs = new ArrayList<>(); MessageReference ref1 = generateReference(queue, 1); @@ -1105,7 +1105,7 @@ public class QueueImplTest extends ActiveMQTestBase { final int numMessages = 10; - List refs = new ArrayList(); + List refs = new ArrayList<>(); for (int i = 0; i < numMessages; i++) { MessageReference ref = generateReference(queue, i); @@ -1166,7 +1166,7 @@ public class QueueImplTest extends ActiveMQTestBase { final int numMessages = 10; - List refs = new ArrayList(); + List refs = new ArrayList<>(); for (int i = 0; i < numMessages; i++) { MessageReference ref = generateReference(queue, i); diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/fakes/FakeConsumer.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/fakes/FakeConsumer.java index 735567493f..a7be2fab2c 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/fakes/FakeConsumer.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/core/server/impl/fakes/FakeConsumer.java @@ -33,7 +33,7 @@ public class FakeConsumer implements Consumer { private int delayCountdown = 0; - private final LinkedList references = new LinkedList(); + private final LinkedList references = new LinkedList<>(); private final Filter filter; diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/ra/ActiveMQResourceAdapterConfigTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/ra/ActiveMQResourceAdapterConfigTest.java index 080b837484..bfdeaa279f 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/ra/ActiveMQResourceAdapterConfigTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/ra/ActiveMQResourceAdapterConfigTest.java @@ -397,7 +397,7 @@ public class ActiveMQResourceAdapterConfigTest extends ActiveMQTestBase { @Test public void testConfiguration() throws Exception { Method[] methods = ActiveMQResourceAdapter.class.getMethods(); - Map methodList = new HashMap(); + Map methodList = new HashMap<>(); for (Method method : methods) { if (method.getName().startsWith("set")) { methodList.put(method.getName(), method); diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/ra/ConnectionFactoryPropertiesTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/ra/ConnectionFactoryPropertiesTest.java index 7927206dac..4e617aebba 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/ra/ConnectionFactoryPropertiesTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/ra/ConnectionFactoryPropertiesTest.java @@ -39,12 +39,12 @@ public class ConnectionFactoryPropertiesTest extends ActiveMQTestBase { private static final SortedSet UNSUPPORTED_RA_PROPERTIES; static { - UNSUPPORTED_CF_PROPERTIES = new TreeSet(); + UNSUPPORTED_CF_PROPERTIES = new TreeSet<>(); UNSUPPORTED_CF_PROPERTIES.add("discoveryGroupName"); UNSUPPORTED_CF_PROPERTIES.add("incomingInterceptorList"); UNSUPPORTED_CF_PROPERTIES.add("outgoingInterceptorList"); - UNSUPPORTED_RA_PROPERTIES = new TreeSet(); + UNSUPPORTED_RA_PROPERTIES = new TreeSet<>(); UNSUPPORTED_RA_PROPERTIES.add("HA"); UNSUPPORTED_RA_PROPERTIES.add("jgroupsChannelName"); UNSUPPORTED_RA_PROPERTIES.add("jgroupsFile"); @@ -83,10 +83,10 @@ public class ConnectionFactoryPropertiesTest extends ActiveMQTestBase { } private static void compare(String name1, SortedSet set1, String name2, SortedSet set2) { - Set onlyInSet1 = new TreeSet(set1); + Set onlyInSet1 = new TreeSet<>(set1); onlyInSet1.removeAll(set2); - Set onlyInSet2 = new TreeSet(set2); + Set onlyInSet2 = new TreeSet<>(set2); onlyInSet2.removeAll(set1); if (!onlyInSet1.isEmpty() || !onlyInSet2.isEmpty()) { @@ -97,7 +97,7 @@ public class ConnectionFactoryPropertiesTest extends ActiveMQTestBase { } private SortedSet findAllPropertyNames(Class clazz) throws Exception { - SortedSet names = new TreeSet(); + SortedSet names = new TreeSet<>(); for (PropertyDescriptor propDesc : getBeanInfo(clazz).getPropertyDescriptors()) { if (propDesc == null || propDesc.getWriteMethod() == null) { continue; @@ -110,22 +110,22 @@ public class ConnectionFactoryPropertiesTest extends ActiveMQTestBase { @Test public void testEquality() throws Exception { ConnectionFactoryProperties cfp1 = new ConnectionFactoryProperties(); - List connectorClassNames1 = new ArrayList(); + List connectorClassNames1 = new ArrayList<>(); connectorClassNames1.add("myConnector"); cfp1.setParsedConnectorClassNames(connectorClassNames1); - List> connectionParameters1 = new ArrayList>(); - Map params1 = new HashMap(); + List> connectionParameters1 = new ArrayList<>(); + Map params1 = new HashMap<>(); params1.put("port", "0"); connectionParameters1.add(params1); cfp1.setParsedConnectionParameters(connectionParameters1); cfp1.setAutoGroup(true); ConnectionFactoryProperties cfp2 = new ConnectionFactoryProperties(); - List connectorClassNames2 = new ArrayList(); + List connectorClassNames2 = new ArrayList<>(); connectorClassNames2.add("myConnector"); cfp2.setParsedConnectorClassNames(connectorClassNames2); - List> connectionParameters2 = new ArrayList>(); - Map params2 = new HashMap(); + List> connectionParameters2 = new ArrayList<>(); + Map params2 = new HashMap<>(); params2.put("port", "0"); connectionParameters2.add(params2); cfp2.setParsedConnectionParameters(connectionParameters2); @@ -137,22 +137,22 @@ public class ConnectionFactoryPropertiesTest extends ActiveMQTestBase { @Test public void testInequality() throws Exception { ConnectionFactoryProperties cfp1 = new ConnectionFactoryProperties(); - List connectorClassNames1 = new ArrayList(); + List connectorClassNames1 = new ArrayList<>(); connectorClassNames1.add("myConnector"); cfp1.setParsedConnectorClassNames(connectorClassNames1); - List> connectionParameters1 = new ArrayList>(); - Map params1 = new HashMap(); + List> connectionParameters1 = new ArrayList<>(); + Map params1 = new HashMap<>(); params1.put("port", "0"); connectionParameters1.add(params1); cfp1.setParsedConnectionParameters(connectionParameters1); cfp1.setAutoGroup(true); ConnectionFactoryProperties cfp2 = new ConnectionFactoryProperties(); - List connectorClassNames2 = new ArrayList(); + List connectorClassNames2 = new ArrayList<>(); connectorClassNames2.add("myConnector"); cfp2.setParsedConnectorClassNames(connectorClassNames2); - List> connectionParameters2 = new ArrayList>(); - Map params2 = new HashMap(); + List> connectionParameters2 = new ArrayList<>(); + Map params2 = new HashMap<>(); params2.put("port", "1"); connectionParameters2.add(params2); cfp2.setParsedConnectionParameters(connectionParameters2); @@ -164,22 +164,22 @@ public class ConnectionFactoryPropertiesTest extends ActiveMQTestBase { @Test public void testInequality2() throws Exception { ConnectionFactoryProperties cfp1 = new ConnectionFactoryProperties(); - List connectorClassNames1 = new ArrayList(); + List connectorClassNames1 = new ArrayList<>(); connectorClassNames1.add("myConnector"); cfp1.setParsedConnectorClassNames(connectorClassNames1); - List> connectionParameters1 = new ArrayList>(); - Map params1 = new HashMap(); + List> connectionParameters1 = new ArrayList<>(); + Map params1 = new HashMap<>(); params1.put("port", "0"); connectionParameters1.add(params1); cfp1.setParsedConnectionParameters(connectionParameters1); cfp1.setAutoGroup(true); ConnectionFactoryProperties cfp2 = new ConnectionFactoryProperties(); - List connectorClassNames2 = new ArrayList(); + List connectorClassNames2 = new ArrayList<>(); connectorClassNames2.add("myConnector2"); cfp2.setParsedConnectorClassNames(connectorClassNames2); - List> connectionParameters2 = new ArrayList>(); - Map params2 = new HashMap(); + List> connectionParameters2 = new ArrayList<>(); + Map params2 = new HashMap<>(); params2.put("port", "0"); connectionParameters2.add(params2); cfp2.setParsedConnectionParameters(connectionParameters2); diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/ra/ResourceAdapterTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/ra/ResourceAdapterTest.java index b47634095b..82612490bc 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/ra/ResourceAdapterTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/ra/ResourceAdapterTest.java @@ -242,7 +242,7 @@ public class ResourceAdapterTest extends ActiveMQTestBase { ActiveMQResourceAdapter ra = new ActiveMQResourceAdapter(); ra.setConnectorClassName(InVMConnectorFactory.class.getName()); ConnectionFactoryProperties connectionFactoryProperties = new ConnectionFactoryProperties(); - ArrayList value = new ArrayList(); + ArrayList value = new ArrayList<>(); value.add(NettyConnectorFactory.class.getName()); connectionFactoryProperties.setParsedConnectorClassNames(value); ActiveMQConnectionFactory factory = ra.createActiveMQConnectionFactory(connectionFactoryProperties); @@ -311,7 +311,7 @@ public class ResourceAdapterTest extends ActiveMQTestBase { ActiveMQResourceAdapter ra = new ActiveMQResourceAdapter(); ra.setConnectorClassName(NETTY_CONNECTOR_FACTORY + "," + INVM_CONNECTOR_FACTORY + "," + NETTY_CONNECTOR_FACTORY); ConnectionFactoryProperties overrideProperties = new ConnectionFactoryProperties(); - ArrayList value = new ArrayList(); + ArrayList value = new ArrayList<>(); value.add(INVM_CONNECTOR_FACTORY); value.add(NETTY_CONNECTOR_FACTORY); value.add(INVM_CONNECTOR_FACTORY); @@ -334,20 +334,20 @@ public class ResourceAdapterTest extends ActiveMQTestBase { ra.setConnectorClassName(NETTY_CONNECTOR_FACTORY + "," + INVM_CONNECTOR_FACTORY + "," + NETTY_CONNECTOR_FACTORY); ra.setConnectionParameters("host=host1;port=61616, serverid=0, host=host2;port=61617"); ConnectionFactoryProperties overrideProperties = new ConnectionFactoryProperties(); - ArrayList value = new ArrayList(); + ArrayList value = new ArrayList<>(); value.add(INVM_CONNECTOR_FACTORY); value.add(NETTY_CONNECTOR_FACTORY); value.add(INVM_CONNECTOR_FACTORY); overrideProperties.setParsedConnectorClassNames(value); - ArrayList> connectionParameters = new ArrayList>(); - Map map1 = new HashMap(); + ArrayList> connectionParameters = new ArrayList<>(); + Map map1 = new HashMap<>(); map1.put("serverid", "0"); connectionParameters.add(map1); - Map map2 = new HashMap(); + Map map2 = new HashMap<>(); map2.put("host", "myhost"); map2.put("port", "61616"); connectionParameters.add(map2); - Map map3 = new HashMap(); + Map map3 = new HashMap<>(); map3.put("serverid", "1"); connectionParameters.add(map3); overrideProperties.setParsedConnectionParameters(connectionParameters); diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/InVMContext.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/InVMContext.java index 6d398f176a..fddff5d740 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/InVMContext.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/InVMContext.java @@ -177,13 +177,13 @@ public class InVMContext implements Context, Serializable { } } - List l = new ArrayList(); + List l = new ArrayList<>(); for (Object element : map.keySet()) { String name = (String) element; Object object = map.get(name); l.add(new Binding(name, object)); } - return new NamingEnumerationImpl(l.iterator()); + return new NamingEnumerationImpl<>(l.iterator()); } @Override @@ -254,7 +254,7 @@ public class InVMContext implements Context, Serializable { @Override public Hashtable getEnvironment() throws NamingException { - Hashtable env = new Hashtable(); + Hashtable env = new Hashtable<>(); env.put("java.naming.factory.initial", "org.apache.activemq.artemis.jms.tests.tools.container.InVMInitialContextFactory"); return env; } diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/InVMNamingContext.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/InVMNamingContext.java index b323902977..10000dc89f 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/InVMNamingContext.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/InVMNamingContext.java @@ -177,13 +177,13 @@ public class InVMNamingContext implements Context, Serializable { } } - List l = new ArrayList(); + List l = new ArrayList<>(); for (Object element : map.keySet()) { String name = (String) element; Object object = map.get(name); l.add(new Binding(name, object)); } - return new NamingEnumerationImpl(l.iterator()); + return new NamingEnumerationImpl<>(l.iterator()); } @Override @@ -254,7 +254,7 @@ public class InVMNamingContext implements Context, Serializable { @Override public Hashtable getEnvironment() throws NamingException { - Hashtable env = new Hashtable(); + Hashtable env = new Hashtable<>(); env.put("java.naming.factory.initial", "org.apache.activemq.artemis.jms.tests.tools.container.InVMInitialContextFactory"); return env; } diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/LinkedListTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/LinkedListTest.java index 504d499ab7..d035b01a88 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/LinkedListTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/LinkedListTest.java @@ -37,7 +37,7 @@ public class LinkedListTest extends ActiveMQTestBase { public void setUp() throws Exception { super.setUp(); - list = new LinkedListImpl(); + list = new LinkedListImpl<>(); } @Test @@ -58,7 +58,7 @@ public class LinkedListTest extends ActiveMQTestBase { } } - LinkedListImpl objs = new LinkedListImpl(); + LinkedListImpl objs = new LinkedListImpl<>(); // Initial add for (int i = 0; i < 100; i++) { @@ -117,7 +117,7 @@ public class LinkedListTest extends ActiveMQTestBase { } } - LinkedListImpl objs = new LinkedListImpl(); + LinkedListImpl objs = new LinkedListImpl<>(); // Initial add for (int i = 1000; i >= 0; i--) { @@ -169,10 +169,10 @@ public class LinkedListTest extends ActiveMQTestBase { while (timeout > System.currentTimeMillis() && count.get() != expected) { seqCount++; if (seqCount > 5) { - LinkedList toOME = new LinkedList(); + LinkedList toOME = new LinkedList<>(); int someCount = 0; try { - WeakReference ref = new WeakReference(new Object()); + WeakReference ref = new WeakReference<>(new Object()); while (ref.get() != null) { toOME.add("sdlfkjshadlfkjhas dlfkjhas dlfkjhads lkjfhads lfkjhads flkjashdf " + someCount++); } @@ -1103,7 +1103,7 @@ public class LinkedListTest extends ActiveMQTestBase { public void testResizing() { int numIters = 1000; - List> iters = new java.util.LinkedList>(); + List> iters = new java.util.LinkedList<>(); int num = 10; diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/ObjectInputStreamWithClassLoaderTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/ObjectInputStreamWithClassLoaderTest.java index 8e45f5da06..19d55866e2 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/ObjectInputStreamWithClassLoaderTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/ObjectInputStreamWithClassLoaderTest.java @@ -57,7 +57,7 @@ public class ObjectInputStreamWithClassLoaderTest extends ActiveMQTestBase { pathIgnore = classLocation.toString(); } - List urls = new ArrayList(); + List urls = new ArrayList<>(); while (tokenString.hasMoreElements()) { String value = tokenString.nextToken(); URL itemLocation = new File(value).toURI().toURL(); diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/SoftValueMapTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/SoftValueMapTest.java index 8c0d042576..02013a6e2d 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/SoftValueMapTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/SoftValueMapTest.java @@ -40,7 +40,7 @@ public class SoftValueMapTest extends ActiveMQTestBase { // each buffer will be 1/10th of the maxMemory int bufferSize = (int) (maxMemory / 100); - SoftValueHashMap softCache = new SoftValueHashMap(100); + SoftValueHashMap softCache = new SoftValueHashMap<>(100); final int MAX_ELEMENTS = 1000; @@ -59,7 +59,7 @@ public class SoftValueMapTest extends ActiveMQTestBase { public void testEvictionsLeastUsed() { forceGC(); - SoftValueHashMap softCache = new SoftValueHashMap(200); + SoftValueHashMap softCache = new SoftValueHashMap<>(200); for (long i = 0; i < 100; i++) { Value v = new Value(new byte[1]); @@ -99,7 +99,7 @@ public class SoftValueMapTest extends ActiveMQTestBase { Value two = new Value(new byte[100]); Value three = new Value(new byte[100]); - SoftValueHashMap softCache = new SoftValueHashMap(2); + SoftValueHashMap softCache = new SoftValueHashMap<>(2); softCache.put(3, three); softCache.put(2, two); softCache.put(1, one); diff --git a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/UUIDTest.java b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/UUIDTest.java index 62cb3a031d..a7f5cd09a9 100644 --- a/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/UUIDTest.java +++ b/tests/unit-tests/src/test/java/org/apache/activemq/artemis/tests/unit/util/UUIDTest.java @@ -33,7 +33,7 @@ public class UUIDTest extends ActiveMQTestBase { @Test public void testManyUUIDs() throws Exception { - Set uuidsSet = new HashSet(); + Set uuidsSet = new HashSet<>(); UUIDGenerator gen = UUIDGenerator.getInstance(); for (int i = 0; i < getTimes(); i++) {