http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/RemotingConnectionImpl.java ---------------------------------------------------------------------- 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 a19c3f3..1cb4f2a 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<Long, Channel> channels = new ConcurrentHashMap<Long, Channel>(); + private final Map<Long, Channel> channels = new ConcurrentHashMap<>(); private final long blockingCallTimeout; @@ -246,7 +246,7 @@ public class RemotingConnectionImpl extends AbstractRemotingConnection implement // method is // complete - Set<Channel> allChannels = new HashSet<Channel>(channels.values()); + Set<Channel> allChannels = new HashSet<>(channels.values()); if (!criticalError) { removeAllChannels();
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/ClusterTopologyChangeMessage.java ---------------------------------------------------------------------- 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 f019576..48c7862 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<TransportConfiguration, TransportConfiguration>(a, b); + pair = new Pair<>(a, b); last = buffer.readBoolean(); } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/ClusterTopologyChangeMessage_V2.java ---------------------------------------------------------------------- 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 76860e1..a39dda9 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<TransportConfiguration, TransportConfiguration>(a, b); + pair = new Pair<>(a, b); last = buffer.readBoolean(); } if (buffer.readableBytes() > 0) { http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionBindingQueryResponseMessage.java ---------------------------------------------------------------------- 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 7d77edc..65a0d25 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<SimpleString>(numQueues); + queueNames = new ArrayList<>(numQueues); for (int i = 0; i < numQueues; i++) { queueNames.add(buffer.readSimpleString()); } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/wireformat/SessionXAGetInDoubtXidsResponseMessage.java ---------------------------------------------------------------------- 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 92260b1..a78bad4 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<Xid>(len); + xids = new ArrayList<>(len); for (int i = 0; i < len; i++) { Xid xid = XidCodecSupport.decodeXid(buffer); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/TransportConfigurationUtil.java ---------------------------------------------------------------------- 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 60b8336..cfadcfa 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<String, Object> cloneDefaults(Map<String, Object> defaults) { - Map<String, Object> cloned = new HashMap<String, Object>(); + Map<String, Object> cloned = new HashMap<>(); for (Map.Entry entry : defaults.entrySet()) { cloned.put((String) entry.getKey(), entry.getValue()); } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnection.java ---------------------------------------------------------------------- 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 2c1f1c8..6f2f792 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<ReadyListener> readyListeners = new ConcurrentHashSet<ReadyListener>(); + private final Set<ReadyListener> readyListeners = new ConcurrentHashSet<>(); private RemotingConnection protocolConnection; http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyConnector.java ---------------------------------------------------------------------- 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 60d913c..3f56248 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<String, Object> config = new HashMap<String, Object>(); + Map<String, Object> 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<Object, Connection> connections = new ConcurrentHashMap<Object, Connection>(); + private ConcurrentMap<Object, Connection> connections = new ConcurrentHashMap<>(); private String servletPath; http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/SharedNioEventLoopGroup.java ---------------------------------------------------------------------- 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 7656130..b9b1a31 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<ScheduledFuture<?>> shutdown = new AtomicReference<ScheduledFuture<?>>(); + private final AtomicReference<ScheduledFuture<?>> shutdown = new AtomicReference<>(); private final AtomicLong nioChannelFactoryCount = new AtomicLong(); private final Promise<?> terminationPromise = ImmediateEventExecutor.INSTANCE.newPromise(); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-core-client/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/TransportConstants.java ---------------------------------------------------------------------- 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 b241ac5..f373639 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<String> allowableAcceptorKeys = new HashSet<String>(); + Set<String> 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<String> allowableConnectorKeys = new HashSet<String>(); + Set<String> 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); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-core-client/src/main/java/org/apache/activemq/artemis/reader/MessageUtil.java ---------------------------------------------------------------------- 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 b56abc4..f61384d 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<SimpleString> toRemove = new ArrayList<SimpleString>(); + List<SimpleString> 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<String> getPropertyNames(Message message) { - HashSet<String> set = new HashSet<String>(); + HashSet<String> set = new HashSet<>(); for (SimpleString propName : message.getPropertyNames()) { if ((!propName.startsWith(JMS) || propName.startsWith(JMSX) || http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-core-client/src/main/java/org/apache/activemq/artemis/spi/core/protocol/AbstractRemotingConnection.java ---------------------------------------------------------------------- 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 7670740..32df48c 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<FailureListener> failureListeners = new CopyOnWriteArrayList<FailureListener>(); - protected final List<CloseListener> closeListeners = new CopyOnWriteArrayList<CloseListener>(); + protected final List<FailureListener> failureListeners = new CopyOnWriteArrayList<>(); + protected final List<CloseListener> 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<FailureListener> getFailureListeners() { - return new ArrayList<FailureListener>(failureListeners); + return new ArrayList<>(failureListeners); } protected void callFailureListeners(final ActiveMQException me, String scaleDownTargetNodeID) { - final List<FailureListener> listenersClone = new ArrayList<FailureListener>(failureListeners); + final List<FailureListener> 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<CloseListener> listenersClone = new ArrayList<CloseListener>(closeListeners); + final List<CloseListener> listenersClone = new ArrayList<>(closeListeners); for (final CloseListener listener : listenersClone) { try { @@ -140,7 +140,7 @@ public abstract class AbstractRemotingConnection implements RemotingConnection { @Override public List<CloseListener> removeCloseListeners() { - List<CloseListener> ret = new ArrayList<CloseListener>(closeListeners); + List<CloseListener> ret = new ArrayList<>(closeListeners); closeListeners.clear(); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/ConfigurationHelper.java ---------------------------------------------------------------------- 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 76326b6..8771451 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<String> checkKeys(final Set<String> allowableKeys, final Set<String> keys) { - Set<String> invalid = new HashSet<String>(); + Set<String> invalid = new HashSet<>(); for (String key : keys) { if (!allowableKeys.contains(key)) { @@ -135,7 +135,7 @@ public class ConfigurationHelper { } public static Set<String> checkKeysExist(final Set<String> requiredKeys, final Set<String> keys) { - Set<String> invalid = new HashSet<String>(requiredKeys); + Set<String> invalid = new HashSet<>(requiredKeys); for (String key : keys) { if (requiredKeys.contains(key)) { http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/LinkedListImpl.java ---------------------------------------------------------------------- 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 e455db8..4262274 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<E> implements LinkedList<E> { private static final int INITIAL_ITERATOR_ARRAY_SIZE = 10; - private final Node<E> head = new Node<E>(null); + private final Node<E> head = new Node<>(null); private Node<E> tail = null; @@ -48,7 +48,7 @@ public class LinkedListImpl<E> implements LinkedList<E> { @Override public void addHead(E e) { - Node<E> node = new Node<E>(e); + Node<E> node = new Node<>(e); node.next = head.next; @@ -73,7 +73,7 @@ public class LinkedListImpl<E> implements LinkedList<E> { addHead(e); } else { - Node<E> node = new Node<E>(e); + Node<E> node = new Node<>(e); node.prev = tail; http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/MemorySize.java ---------------------------------------------------------------------- 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 dfb3f01..b3e47cc 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<Object> dumbReference = new WeakReference<Object>(new Object()); + WeakReference<Object> dumbReference = new WeakReference<>(new Object()); // A loop that will wait GC, using the minimal time as possible while (dumbReference.get() != null) { System.gc(); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/OrderedExecutorFactory.java ---------------------------------------------------------------------- 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 949970b..7475526 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<Runnable> tasks = new ConcurrentLinkedQueue<Runnable>(); + private final ConcurrentLinkedQueue<Runnable> tasks = new ConcurrentLinkedQueue<>(); // @protected by tasks private boolean running; http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/PriorityLinkedListImpl.java ---------------------------------------------------------------------- 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 6556ef5..06b2432 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<T> implements PriorityLinkedList<T> { levels = (LinkedListImpl<T>[]) Array.newInstance(LinkedListImpl.class, priorities); for (int i = 0; i < priorities; i++) { - levels[i] = new LinkedListImpl<T>(); + levels[i] = new LinkedListImpl<>(); } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/SecurityFormatter.java ---------------------------------------------------------------------- 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 d79f7d6..1df12b1 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<String> consume = toList(consumeRoles); List<String> manage = toList(manageRoles); - Set<String> allRoles = new HashSet<String>(); + Set<String> 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<Role> roles = new HashSet<Role>(allRoles.size()); + Set<Role> 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<String> toList(final String commaSeparatedString) { - List<String> list = new ArrayList<String>(); + List<String> list = new ArrayList<>(); if (commaSeparatedString == null || commaSeparatedString.trim().length() == 0) { return list; } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/SoftValueHashMap.java ---------------------------------------------------------------------- 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 19ea7dd..4cfbfa4 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<K, V extends SoftValueHashMap.ValueCache> 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<V> refQueue = new ReferenceQueue<V>(); + private final ReferenceQueue<V> refQueue = new ReferenceQueue<>(); - private final Map<K, AggregatedSoftReference> mapDelegate = new HashMap<K, AggregatedSoftReference>(); + private final Map<K, AggregatedSoftReference> mapDelegate = new HashMap<>(); private final AtomicLong usedCounter = new AtomicLong(0); @@ -156,7 +156,7 @@ public class SoftValueHashMap<K, V extends SoftValueHashMap.ValueCache> implemen private void checkCacheSize() { if (maxElements > 0 && mapDelegate.size() > maxElements) { - TreeSet<AggregatedSoftReference> usedReferences = new TreeSet<AggregatedSoftReference>(new ComparatorAgregated()); + TreeSet<AggregatedSoftReference> usedReferences = new TreeSet<>(new ComparatorAgregated()); for (AggregatedSoftReference ref : mapDelegate.values()) { V v = ref.get(); @@ -260,7 +260,7 @@ public class SoftValueHashMap<K, V extends SoftValueHashMap.ValueCache> implemen @Override public Collection<V> values() { processQueue(); - ArrayList<V> list = new ArrayList<V>(); + ArrayList<V> list = new ArrayList<>(); for (AggregatedSoftReference refs : mapDelegate.values()) { V value = refs.get(); @@ -278,11 +278,11 @@ public class SoftValueHashMap<K, V extends SoftValueHashMap.ValueCache> implemen @Override public Set<java.util.Map.Entry<K, V>> entrySet() { processQueue(); - HashSet<Map.Entry<K, V>> set = new HashSet<Map.Entry<K, V>>(); + HashSet<Map.Entry<K, V>> set = new HashSet<>(); for (Map.Entry<K, AggregatedSoftReference> pair : mapDelegate.entrySet()) { V value = pair.getValue().get(); if (value != null) { - set.add(new EntryElement<K, V>(pair.getKey(), value)); + set.add(new EntryElement<>(pair.getKey(), value)); } } return set; http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/VersionLoader.java ---------------------------------------------------------------------- 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 ace62c8..a0efdb5 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<Version> definedVersions = new ArrayList<Version>(incrementingVersions.length); + List<Version> definedVersions = new ArrayList<>(incrementingVersions.length); for (int incrementingVersion : incrementingVersions) { definedVersions.add(new VersionImpl(versionName, majorVersion, minorVersion, microVersion, incrementingVersion, compatibleVersionArray)); } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/XMLUtil.java ---------------------------------------------------------------------- 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 d8b9e6a..5634207 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<Node> filter(final NodeList nl, final short[] typesToFilter) { - List<Node> nodes = new ArrayList<Node>(); + List<Node> nodes = new ArrayList<>(); outer: for (int i = 0; i < nl.getLength(); i++) { http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-core-client/src/main/java/org/apache/activemq/artemis/utils/json/JSONArray.java ---------------------------------------------------------------------- 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 0cbaf72..b70bd21 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<Object>(); + myArrayList = new ArrayList<>(); } /** @@ -161,7 +161,7 @@ public class JSONArray { * @param collection A Collection. */ public JSONArray(final Collection collection) { - myArrayList = collection == null ? new ArrayList<Object>() : new ArrayList<Object>(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<Object>() : new ArrayList<Object>(collection.size()); + myArrayList = collection == null ? new ArrayList<>() : new ArrayList<>(collection.size()); if (collection != null) { Iterator<Object> iter = collection.iterator(); while (iter.hasNext()) { http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-core-client/src/test/java/org/apache/activemq/artemis/util/CompressionUtilTest.java ---------------------------------------------------------------------- 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 aaeb578..f5d4c42 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<Integer> zipHolder = new ArrayList<Integer>(); + ArrayList<Integer> 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<Integer> zipHolder = new ArrayList<Integer>(); + ArrayList<Integer> 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<Integer> holder = new ArrayList<Integer>(); + ArrayList<Integer> holder = new ArrayList<>(); int read = inflater.read(); while (read != -1) { http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-core-client/src/test/java/org/apache/activemq/artemis/util/ConcurrentHashSetTest.java ---------------------------------------------------------------------- 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 8a2e40b..6c97afd 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<String>(); + set = new ConcurrentHashSet<>(); element = RandomUtil.randomString(); } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-core-client/src/test/java/org/apache/activemq/artemis/util/TimeAndCounterIDGeneratorTest.java ---------------------------------------------------------------------- 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 923a9f3..671261e 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<Long> hashSet = new ConcurrentHashSet<Long>(); + final ConcurrentHashSet<Long> hashSet = new ConcurrentHashSet<>(); final TimeAndCounterIDGenerator seq = new TimeAndCounterIDGenerator(); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQConnection.java ---------------------------------------------------------------------- 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 60de2d7..19e5b67 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<ActiveMQSession> sessions = new ConcurrentHashSet<ActiveMQSession>(); + private final Set<ActiveMQSession> sessions = new ConcurrentHashSet<>(); - private final Set<SimpleString> tempQueues = new ConcurrentHashSet<SimpleString>(); + private final Set<SimpleString> tempQueues = new ConcurrentHashSet<>(); - private final Set<SimpleString> knownDestinations = new ConcurrentHashSet<SimpleString>(); + private final Set<SimpleString> 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<ActiveMQSession>(sessions)) { + for (ActiveMQSession session : new HashSet<>(sessions)) { session.close(); } @@ -689,7 +689,7 @@ public class ActiveMQConnection extends ActiveMQConnectionForContextImpl impleme private final WeakReference<ActiveMQConnection> connectionRef; JMSFailureListener(final ActiveMQConnection connection) { - connectionRef = new WeakReference<ActiveMQConnection>(connection); + connectionRef = new WeakReference<>(connection); } @Override @@ -742,7 +742,7 @@ public class ActiveMQConnection extends ActiveMQConnectionForContextImpl impleme private final WeakReference<ActiveMQConnection> connectionRef; FailoverEventListenerImpl(final ActiveMQConnection connection) { - connectionRef = new WeakReference<ActiveMQConnection>(connection); + connectionRef = new WeakReference<>(connection); } @Override http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQConnectionMetaData.java ---------------------------------------------------------------------- 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 628281b..8a14915 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<Object> v = new Vector<Object>(); + Vector<Object> v = new Vector<>(); v.add("JMSXGroupID"); v.add("JMSXGroupSeq"); v.add("JMSXDeliveryCount"); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQDestination.java ---------------------------------------------------------------------- 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 f803ff6..e77a48b 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<String, String> pair = new Pair<String, String>(parts[0].toString(), parts[1].toString()); + Pair<String, String> pair = new Pair<>(parts[0].toString(), parts[1].toString()); return pair; } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQJMSProducer.java ---------------------------------------------------------------------- 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 cd86e86..6e37a86 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<String> getPropertyNames() { try { Set<SimpleString> simplePropNames = properties.getPropertyNames(); - Set<String> propNames = new HashSet<String>(simplePropNames.size()); + Set<String> propNames = new HashSet<>(simplePropNames.size()); for (SimpleString str : simplePropNames) { propNames.add(str.toString()); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMapMessage.java ---------------------------------------------------------------------- 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 b3112a7..d067593 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<SimpleString> simplePropNames = map.getPropertyNames(); - Set<String> propNames = new HashSet<String>(simplePropNames.size()); + Set<String> propNames = new HashSet<>(simplePropNames.size()); for (SimpleString str : simplePropNames) { propNames.add(str.toString()); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQMessage.java ---------------------------------------------------------------------- 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 6dfdf7c..528a8a3 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<String, Object> coreMaptoJMSMap(final Map<String, Object> coreMessage) { - Map<String, Object> jmsMessage = new HashMap<String, Object>(); + Map<String, Object> 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<String> reservedIdentifiers = new HashSet<String>(); + private static final HashSet<String> reservedIdentifiers = new HashSet<>(); static { ActiveMQMessage.reservedIdentifiers.add("NULL"); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ActiveMQSession.java ---------------------------------------------------------------------- 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 758cb90..e2a1fca 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<ActiveMQMessageConsumer> consumers = new HashSet<ActiveMQMessageConsumer>(); + private final Set<ActiveMQMessageConsumer> 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<ActiveMQMessageConsumer>(consumers)) { + for (ActiveMQMessageConsumer cons : new HashSet<>(consumers)) { cons.close(); } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/SelectorTranslator.java ---------------------------------------------------------------------- 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 d227f89..5dcd7c3 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<Integer> positions = new ArrayList<Integer>(); + List<Integer> positions = new ArrayList<>(); boolean replaceInQuotes = match.charAt(0) == quote; http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jms/client/ThreadAwareContext.java ---------------------------------------------------------------------- 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 10624ce..602704d 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<Long> messageListenerThreads = new ConcurrentHashSet<Long>(); + private Set<Long> messageListenerThreads = new ConcurrentHashSet<>(); /** * Sets current thread to the context http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-jms-client/src/main/java/org/apache/activemq/artemis/jndi/ReadOnlyContext.java ---------------------------------------------------------------------- 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 e94377d..97d02a6 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<String, Object>(); - bindings = new HashMap<String, Object>(); - treeBindings = new HashMap<String, Object>(); + environment = new Hashtable<>(); + bindings = new HashMap<>(); + treeBindings = new HashMap<>(); } public ReadOnlyContext(Hashtable env) { if (env == null) { - this.environment = new Hashtable<String, Object>(); + this.environment = new Hashtable<>(); } else { - this.environment = new Hashtable<String, Object>(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<String, Object> bindings) { if (environment == null) { - this.environment = new Hashtable<String, Object>(); + this.environment = new Hashtable<>(); } else { - this.environment = new Hashtable<String, Object>(environment); + this.environment = new Hashtable<>(environment); } - this.bindings = new HashMap<String, Object>(); - treeBindings = new HashMap<String, Object>(); + this.bindings = new HashMap<>(); + treeBindings = new HashMap<>(); if (bindings != null) { for (Map.Entry<String, Object> 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<String, Object>(env); + this.environment = new Hashtable<>(env); } protected ReadOnlyContext(ReadOnlyContext clone, Hashtable<String, Object> env, String nameInNamespace) { @@ -155,7 +155,7 @@ public class ReadOnlyContext implements Context, Serializable { assert name != null && name.length() > 0; assert !frozen; - Map<String, Object> newBindings = new HashMap<String, Object>(); + Map<String, Object> newBindings = new HashMap<>(); int pos = name.indexOf('/'); if (pos == -1) { if (treeBindings.put(name, value) != null) { http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-jms-client/src/test/java/org/apache/activemq/artemis/uri/ConnectionFactoryURITest.java ---------------------------------------------------------------------- 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 4e88e70..9f0fd18 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<String> ignoreList = new HashSet<String>(); + private static Set<String> ignoreList = new HashSet<>(); static { ignoreList.add("protocolManagerFactoryStr"); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/bridge/impl/JMSBridgeImpl.java ---------------------------------------------------------------------- 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 6e190eb..5cbde39 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<Message>(); + 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<String, Object>(); + oldProps = new HashMap<>(); } oldProps.put(propName, msg.getObjectProperty(propName)); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/management/impl/JMSQueueControlImpl.java ---------------------------------------------------------------------- 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 b64a14f..d279f8e 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<String, Map<String, Object>[]> listDeliveringMessages() throws Exception { try { - Map<String, Map<String, Object>[]> returnMap = new HashMap<String, Map<String, Object>[]>(); + Map<String, Map<String, Object>[]> returnMap = new HashMap<>(); // the workingMap from the queue-control Map<String, Map<String, Object>[]> workingMap = coreQueueControl.listDeliveringMessages(); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/management/impl/JMSServerControlImpl.java ---------------------------------------------------------------------- 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 5c0aea8..8cb54f7 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<String> connectorList = new ArrayList<String>(connectorNames.length); + List<String> 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<String> connectorNamesList = new ArrayList<String>(); + ArrayList<String> connectorNamesList = new ArrayList<>(); for (String nameC : connectorNames) { connectorNamesList.add(nameC); } @@ -593,7 +593,7 @@ public class JMSServerControlImpl extends AbstractControl implements JMSServerCo Set<ServerSession> sessions = server.getActiveMQServer().getSessions(); - Map<Object, ServerSession> jmsSessions = new HashMap<Object, ServerSession>(); + Map<Object, ServerSession> 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<String, DestinationControl> allDests = new HashMap<String, DestinationControl>(); + Map<String, DestinationControl> 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<String> destinations = new ArrayList<String>(); + List<String> destinations = new ArrayList<>(); for (String addresse : addresses) { DestinationControl control = allDests.get(addresse); if (control != null) { http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/management/impl/JMSTopicControlImpl.java ---------------------------------------------------------------------- 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 e7711ae..e226e7a 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<QueueControl> queues = getQueues(durability); - List<Object[]> subInfos = new ArrayList<Object[]>(queues.size()); + List<Object[]> 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<QueueControl> getQueues(final DurabilityType durability) { try { - List<QueueControl> matchingQueues = new ArrayList<QueueControl>(); + List<QueueControl> matchingQueues = new ArrayList<>(); String[] queues = addressControl.getQueueNames(); for (String queue : queues) { QueueControl coreQueueControl = (QueueControl) managementService.getResource(ResourceNames.CORE_QUEUE + queue); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/persistence/config/PersistedBindings.java ---------------------------------------------------------------------- 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 bdf999b..53d0fb7 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<String> bindings = new ArrayList<String>(); + private ArrayList<String> 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<String>(bindingArraySize); + bindings = new ArrayList<>(bindingArraySize); for (int i = 0; i < bindingArraySize; i++) { bindings.add(buffer.readSimpleString().toString()); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/persistence/impl/journal/JMSJournalStorageManagerImpl.java ---------------------------------------------------------------------- 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 dc93149..55bc821 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<String, PersistedConnectionFactory> mapFactories = new ConcurrentHashMap<String, PersistedConnectionFactory>(); + private final Map<String, PersistedConnectionFactory> mapFactories = new ConcurrentHashMap<>(); - private final Map<Pair<PersistedType, String>, PersistedDestination> destinations = new ConcurrentHashMap<Pair<PersistedType, String>, PersistedDestination>(); + private final Map<Pair<PersistedType, String>, PersistedDestination> destinations = new ConcurrentHashMap<>(); - private final Map<Pair<PersistedType, String>, PersistedBindings> mapBindings = new ConcurrentHashMap<Pair<PersistedType, String>, PersistedBindings>(); + private final Map<Pair<PersistedType, String>, PersistedBindings> mapBindings = new ConcurrentHashMap<>(); private final Configuration config; @@ -101,7 +101,7 @@ public final class JMSJournalStorageManagerImpl implements JMSStorageManager { // Public -------------------------------------------------------- @Override public List<PersistedConnectionFactory> recoverConnectionFactories() { - List<PersistedConnectionFactory> cfs = new ArrayList<PersistedConnectionFactory>(mapFactories.values()); + List<PersistedConnectionFactory> cfs = new ArrayList<>(mapFactories.values()); return cfs; } @@ -124,7 +124,7 @@ public final class JMSJournalStorageManagerImpl implements JMSStorageManager { @Override public List<PersistedDestination> recoverDestinations() { - List<PersistedDestination> destinations = new ArrayList<PersistedDestination>(this.destinations.values()); + List<PersistedDestination> 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<PersistedType, String>(destination.getType(), destination.getName()), destination); + destinations.put(new Pair<>(destination.getType(), destination.getName()), destination); } @Override public List<PersistedBindings> recoverPersistedBindings() throws Exception { - ArrayList<PersistedBindings> list = new ArrayList<PersistedBindings>(mapBindings.values()); + ArrayList<PersistedBindings> list = new ArrayList<>(mapBindings.values()); return list; } @Override public void addBindings(PersistedType type, String name, String... address) throws Exception { - Pair<PersistedType, String> key = new Pair<PersistedType, String>(type, name); + Pair<PersistedType, String> 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<PersistedType, String> key = new Pair<PersistedType, String>(type, name); + Pair<PersistedType, String> 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<PersistedType, String> key = new Pair<PersistedType, String>(type, name); + Pair<PersistedType, String> 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<PersistedType, String>(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<RecordInfo> data = new ArrayList<RecordInfo>(); + List<RecordInfo> data = new ArrayList<>(); - ArrayList<PreparedTransactionInfo> list = new ArrayList<PreparedTransactionInfo>(); + ArrayList<PreparedTransactionInfo> 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<PersistedType, String>(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<PersistedType, String> key = new Pair<PersistedType, String>(bindings.getType(), bindings.getName()); + Pair<PersistedType, String> key = new Pair<>(bindings.getType(), bindings.getName()); mapBindings.put(key, bindings); } else { http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/config/impl/ConnectionFactoryConfigurationImpl.java ---------------------------------------------------------------------- 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 187d6c4..74fcdf4 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<String>(nConnectors); + connectorNames = new ArrayList<>(nConnectors); for (int i = 0; i < nConnectors; i++) { SimpleString str = buffer.readSimpleString(); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/config/impl/JMSConfigurationImpl.java ---------------------------------------------------------------------- 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 eb058c6..406fb3b 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<ConnectionFactoryConfiguration> connectionFactoryConfigurations = new ArrayList<ConnectionFactoryConfiguration>(); + private List<ConnectionFactoryConfiguration> connectionFactoryConfigurations = new ArrayList<>(); - private List<JMSQueueConfiguration> queueConfigurations = new ArrayList<JMSQueueConfiguration>(); + private List<JMSQueueConfiguration> queueConfigurations = new ArrayList<>(); - private List<TopicConfiguration> topicConfigurations = new ArrayList<TopicConfiguration>(); + private List<TopicConfiguration> topicConfigurations = new ArrayList<>(); private String domain = ActiveMQDefaultConfiguration.getDefaultJmxDomain(); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/config/impl/TransportConfigurationEncodingSupport.java ---------------------------------------------------------------------- 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 858c68b..8fe0739 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<Pair<TransportConfiguration, TransportConfiguration>> decodeConfigs(ActiveMQBuffer buffer) { int size = buffer.readInt(); - List<Pair<TransportConfiguration, TransportConfiguration>> configs = new ArrayList<Pair<TransportConfiguration, TransportConfiguration>>(size); + List<Pair<TransportConfiguration, TransportConfiguration>> 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<TransportConfiguration, TransportConfiguration>(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<String, Object> params = new HashMap<String, Object>(); + Map<String, Object> params = new HashMap<>(); for (int i = 0; i < paramSize; i++) { String key = buffer.readSimpleString().toString(); String value = buffer.readSimpleString().toString(); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-jms-server/src/main/java/org/apache/activemq/artemis/jms/server/impl/JMSServerManagerImpl.java ---------------------------------------------------------------------- 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 50c279c..94d7487 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<String, ActiveMQQueue> queues = new HashMap<String, ActiveMQQueue>(); + private final Map<String, ActiveMQQueue> queues = new HashMap<>(); - private final Map<String, ActiveMQTopic> topics = new HashMap<String, ActiveMQTopic>(); + private final Map<String, ActiveMQTopic> topics = new HashMap<>(); - private final Map<String, ActiveMQConnectionFactory> connectionFactories = new HashMap<String, ActiveMQConnectionFactory>(); + private final Map<String, ActiveMQConnectionFactory> connectionFactories = new HashMap<>(); - private final Map<String, List<String>> queueBindings = new HashMap<String, List<String>>(); + private final Map<String, List<String>> queueBindings = new HashMap<>(); - private final Map<String, List<String>> topicBindings = new HashMap<String, List<String>>(); + private final Map<String, List<String>> topicBindings = new HashMap<>(); - private final Map<String, List<String>> connectionFactoryBindings = new HashMap<String, List<String>>(); + private final Map<String, List<String>> connectionFactoryBindings = new HashMap<>(); // We keep things cached if objects are created while the JMS is not active - private final List<Runnable> cachedCommands = new ArrayList<Runnable>(); + private final List<Runnable> cachedCommands = new ArrayList<>(); private final ActiveMQServer server; @@ -133,7 +133,7 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback private JMSStorageManager storage; - private final Map<String, List<String>> unRecoveredBindings = new HashMap<String, List<String>>(); + private final Map<String, List<String>> 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<String>(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<String>(); + bindingsList = new ArrayList<>(); mapBindings.put(name, bindingsList); } @@ -336,7 +336,7 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback } if (bindingsList == null) { - bindingsList = new ArrayList<String>(); + 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<String> bindingsToAdd = new ArrayList<String>(); + ArrayList<String> 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<String> bindingsToAdd = new ArrayList<String>(); + ArrayList<String> 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<String> bindingsToAdd = new ArrayList<String>(); + ArrayList<String> bindingsToAdd = new ArrayList<>(); for (String bindingsItem : bindings) { if (bindToBindings(bindingsItem, cf)) { @@ -1302,7 +1302,7 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback return ""; } - ArrayList<Entry<Xid, Long>> xidsSortedByCreationTime = new ArrayList<Map.Entry<Xid, Long>>(xids.entrySet()); + ArrayList<Entry<Xid, Long>> xidsSortedByCreationTime = new ArrayList<>(xids.entrySet()); Collections.sort(xidsSortedByCreationTime, new Comparator<Entry<Xid, Long>>() { @Override public int compare(final Entry<Xid, Long> entry1, final Entry<Xid, Long> entry2) { @@ -1332,7 +1332,7 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback return "<h3>*** Prepared Transaction Details ***</h3><p>No entry.</p>"; } - ArrayList<Entry<Xid, Long>> xidsSortedByCreationTime = new ArrayList<Map.Entry<Xid, Long>>(xids.entrySet()); + ArrayList<Entry<Xid, Long>> xidsSortedByCreationTime = new ArrayList<>(xids.entrySet()); Collections.sort(xidsSortedByCreationTime, new Comparator<Entry<Xid, Long>>() { @Override public int compare(final Entry<Xid, Long> entry1, final Entry<Xid, Long> entry2) { @@ -1411,7 +1411,7 @@ public class JMSServerManagerImpl implements JMSServerManager, ActivateCallback private void addToBindings(Map<String, List<String>> map, String name, String... bindings) { List<String> list = map.get(name); if (list == null) { - list = new ArrayList<String>(); + list = new ArrayList<>(); map.put(name, list); } for (String bindingsItem : bindings) { http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/aio/AIOSequentialFileFactory.java ---------------------------------------------------------------------- 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 92d1b3b..58f7248 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<ByteBuffer> reuseBuffersQueue = new ConcurrentLinkedQueue<ByteBuffer>(); + private final ConcurrentLinkedQueue<ByteBuffer> reuseBuffersQueue = new ConcurrentLinkedQueue<>(); private boolean stopped = false; http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/buffer/TimedBuffer.java ---------------------------------------------------------------------- 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 20761a5..23e0981 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<IOCallback>(); + 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<IOCallback>(); + callbacks = new LinkedList<>(); buffer.clear(); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-journal/src/main/java/org/apache/activemq/artemis/core/io/nio/NIOSequentialFileFactory.java ---------------------------------------------------------------------- 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 d949f0b..67c3038 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<Object> obj = new WeakReference<Object>(new Object()); + WeakReference<Object> obj = new WeakReference<>(new Object()); try { long timeout = System.currentTimeMillis() + 5000; while (System.currentTimeMillis() > timeout && obj.get() != null) { http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/PreparedTransactionInfo.java ---------------------------------------------------------------------- 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 3d82a23..82abc4f 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<RecordInfo> records = new ArrayList<RecordInfo>(); + public final List<RecordInfo> records = new ArrayList<>(); - public final List<RecordInfo> recordsToDelete = new ArrayList<RecordInfo>(); + public final List<RecordInfo> recordsToDelete = new ArrayList<>(); public PreparedTransactionInfo(final long id, final byte[] extraData) { this.id = id; http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/AbstractJournalUpdateTask.java ---------------------------------------------------------------------- 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 6e9bc69..a8ffebc 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<Long> recordsSnapshot = new ConcurrentHashSet<Long>(); + private final Set<Long> recordsSnapshot = new ConcurrentHashSet<>(); - protected final List<JournalFile> newDataFiles = new ArrayList<JournalFile>(); + protected final List<JournalFile> newDataFiles = new ArrayList<>(); // Static -------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-journal/src/main/java/org/apache/activemq/artemis/core/journal/impl/FileWrapperJournal.java ---------------------------------------------------------------------- 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 ba3807b..cf09fd7 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<Long, AtomicInteger> transactions = new ConcurrentHashMap<Long, AtomicInteger>(); + private final ConcurrentMap<Long, AtomicInteger> transactions = new ConcurrentHashMap<>(); private final JournalImpl journal; protected volatile JournalFile currentFile;