http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/HttpKeepAliveRunnable.java ---------------------------------------------------------------------- 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 651e395..419ece4 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<HttpAcceptorHandler> handlers = new ArrayList<HttpAcceptorHandler>(); + private final List<HttpAcceptorHandler> handlers = new ArrayList<>(); private boolean closed = false;
http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/impl/netty/NettyAcceptor.java ---------------------------------------------------------------------- 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 94cd7aa..ef56322 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<Object, NettyServerConnection> connections = new ConcurrentHashMap<Object, NettyServerConnection>(); + private final ConcurrentMap<Object, NettyServerConnection> connections = new ConcurrentHashMap<>(); private final Map<String, Object> configuration; http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-server/src/main/java/org/apache/activemq/artemis/core/remoting/server/impl/RemotingServiceImpl.java ---------------------------------------------------------------------- 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 30f6ac4..f56fb46 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<BaseInterceptor> outgoingInterceptors = new CopyOnWriteArrayList<>(); - private final Map<String, Acceptor> acceptors = new HashMap<String, Acceptor>(); + private final Map<String, Acceptor> acceptors = new HashMap<>(); - private final Map<Object, ConnectionEntry> connections = new ConcurrentHashMap<Object, ConnectionEntry>(); + private final Map<Object, ConnectionEntry> 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<Object, ConnectionEntry> connectionEntries = new HashMap<Object, ConnectionEntry>(connections); + HashMap<Object, ConnectionEntry> 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<ConnectionEntry> connectionEntries = new HashSet<ConnectionEntry>(connections.values()); + HashSet<ConnectionEntry> 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<RemotingConnection> getConnections() { - Set<RemotingConnection> conns = new HashSet<RemotingConnection>(connections.size()); + Set<RemotingConnection> 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<Object> idsToRemove = new HashSet<Object>(); + Set<Object> idsToRemove = new HashSet<>(); for (ConnectionEntry entry : connections.values()) { final RemotingConnection conn = entry.connection; http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-server/src/main/java/org/apache/activemq/artemis/core/replication/ReplicationEndpoint.java ---------------------------------------------------------------------- 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 2caaa8d..63e3935 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<JournalContent, Map<Long, JournalSyncFile>> filesReservedForSync = new HashMap<JournalContent, Map<Long, JournalSyncFile>>(); + private final Map<JournalContent, Map<Long, JournalSyncFile>> 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<JournalContent, Journal> journalsHolder = new HashMap<JournalContent, Journal>(); + private Map<JournalContent, Journal> journalsHolder = new HashMap<>(); private StorageManager storageManager; private PagingManager pageManager; - private final ConcurrentMap<SimpleString, ConcurrentMap<Integer, Page>> pageIndex = new ConcurrentHashMap<SimpleString, ConcurrentMap<Integer, Page>>(); - private final ConcurrentMap<Long, ReplicatedLargeMessage> largeMessages = new ConcurrentHashMap<Long, ReplicatedLargeMessage>(); + private final ConcurrentMap<SimpleString, ConcurrentMap<Integer, Page>> pageIndex = new ConcurrentHashMap<>(); + private final ConcurrentMap<Long, ReplicatedLargeMessage> 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<Integer, Page> resultIndex = pageIndex.get(storeName); if (resultIndex == null) { - resultIndex = new ConcurrentHashMap<Integer, Page>(); + resultIndex = new ConcurrentHashMap<>(); ConcurrentMap<Integer, Page> mapResult = pageIndex.putIfAbsent(storeName, resultIndex); if (mapResult != null) { resultIndex = mapResult; http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-server/src/main/java/org/apache/activemq/artemis/core/replication/ReplicationManager.java ---------------------------------------------------------------------- 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 4759cfa..255415b 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<OperationContext> pendingTokens = new ConcurrentLinkedQueue<OperationContext>(); + private final Queue<OperationContext> pendingTokens = new ConcurrentLinkedQueue<>(); private final ExecutorFactory executorFactory; @@ -302,7 +302,7 @@ public final class ReplicationManager implements ActiveMQComponent { */ public Set<OperationContext> getActiveTokens() { - LinkedHashSet<OperationContext> activeContexts = new LinkedHashSet<OperationContext>(); + LinkedHashSet<OperationContext> 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<Long, Pair<String, Long>> largeMessages) { ArrayList<Long> idsToSend; - idsToSend = new ArrayList<Long>(largeMessages.keySet()); + idsToSend = new ArrayList<>(largeMessages.keySet()); if (enabled) sendReplicatePacket(new ReplicationStartSyncMessage(idsToSend)); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-server/src/main/java/org/apache/activemq/artemis/core/security/impl/SecurityStoreImpl.java ---------------------------------------------------------------------- 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 514ec8d..2807b47 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<String, ConcurrentHashSet<SimpleString>> cache = new ConcurrentHashMap<String, ConcurrentHashSet<SimpleString>>(); + private final ConcurrentMap<String, ConcurrentHashSet<SimpleString>> 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<SimpleString> set = new ConcurrentHashSet<SimpleString>(); + ConcurrentHashSet<SimpleString> set = new ConcurrentHashSet<>(); ConcurrentHashSet<SimpleString> act = cache.putIfAbsent(user + "." + checkType.name(), set); if (act != null) { set = act; http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/ClusterManager.java ---------------------------------------------------------------------- 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 1a6271d..9bb449a 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<String, ClusterConnection> clusterConnections = new HashMap<String, ClusterConnection>(); + private final Map<String, ClusterConnection> clusterConnections = new HashMap<>(); - private final Set<ServerLocatorInternal> clusterLocators = new ConcurrentHashSet<ServerLocatorInternal>(); + private final Set<ServerLocatorInternal> clusterLocators = new ConcurrentHashSet<>(); private final Executor executor; @@ -359,15 +359,15 @@ public final class ClusterManager implements ActiveMQComponent { } public Map<String, Bridge> getBridges() { - return new HashMap<String, Bridge>(bridges); + return new HashMap<>(bridges); } public Set<ClusterConnection> getClusterConnections() { - return new HashSet<ClusterConnection>(clusterConnections.values()); + return new HashSet<>(clusterConnections.values()); } public Set<BroadcastGroup> getBroadcastGroups() { - return new HashSet<BroadcastGroup>(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<ClusterConnection> cloneClusterConnections() { - ArrayList<ClusterConnection> list = new ArrayList<ClusterConnection>(clusterConnections.values()); + ArrayList<ClusterConnection> list = new ArrayList<>(clusterConnections.values()); return list; } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/BridgeImpl.java ---------------------------------------------------------------------- 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 2ddcaeb..ac75a1c 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<MessageReference> refs = new ConcurrentLinkedQueue<MessageReference>(); + private final java.util.Queue<MessageReference> refs = new ConcurrentLinkedQueue<>(); private final Transformer transformer; @@ -228,7 +228,7 @@ public class BridgeImpl implements Bridge, SessionFailureListener, SendAcknowled @Override public List<MessageReference> getDeliveringMessages() { synchronized (this) { - return new ArrayList<MessageReference>(refs); + return new ArrayList<>(refs); } } @@ -270,7 +270,7 @@ public class BridgeImpl implements Bridge, SessionFailureListener, SendAcknowled private void cancelRefs() { MessageReference ref; - LinkedList<MessageReference> list = new LinkedList<MessageReference>(); + LinkedList<MessageReference> list = new LinkedList<>(); while ((ref = refs.poll()) != null) { if (isTrace) { http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/BroadcastGroupImpl.java ---------------------------------------------------------------------- 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 7a5dbc4..277b925 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<TransportConfiguration> connectors = new ArrayList<TransportConfiguration>(); + private final List<TransportConfiguration> connectors = new ArrayList<>(); private boolean started; http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/ClusterConnectionBridge.java ---------------------------------------------------------------------- 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 3963b02..7bcc6b2 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<SimpleString> propNames = new HashSet<SimpleString>(messageCopy.getPropertyNames()); + Set<SimpleString> 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<String> includes = new ArrayList<String>(); - List<String> excludes = new ArrayList<String>(); + List<String> includes = new ArrayList<>(); + List<String> excludes = new ArrayList<>(); // Split the list into addresses to match and addresses to exclude. for (int i = 0; i < list.length; i++) { http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/ClusterConnectionImpl.java ---------------------------------------------------------------------- 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 12ca5e3..9624ab9 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<String, MessageFlowRecord> records = new ConcurrentHashMap<String, MessageFlowRecord>(); + private final Map<String, MessageFlowRecord> records = new ConcurrentHashMap<>(); - private final Map<String, MessageFlowRecord> disconnectedRecords = new ConcurrentHashMap<String, MessageFlowRecord>(); + private final Map<String, MessageFlowRecord> 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<TransportConfiguration> allowableConnections = new HashSet<TransportConfiguration>(); + private final Set<TransportConfiguration> allowableConnections = new HashSet<>(); private final ClusterManager manager; @@ -547,7 +547,7 @@ public final class ClusterConnectionImpl implements ClusterConnection, AfterConn @Override public Map<String, String> getNodes() { synchronized (recordsGuard) { - Map<String, String> nodes = new HashMap<String, String>(); + Map<String, String> nodes = new HashMap<>(); for (Entry<String, MessageFlowRecord> 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<SimpleString, RemoteQueueBinding> bindings = new HashMap<SimpleString, RemoteQueueBinding>(); + private final Map<SimpleString, RemoteQueueBinding> 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<RemoteQueueBinding>(bindings.values())) { + for (RemoteQueueBinding binding : new HashSet<>(bindings.values())) { removeBinding(binding.getClusterName()); } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/cluster/impl/RemoteQueueBindingImpl.java ---------------------------------------------------------------------- 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 883d36e..6ff0733 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<Filter> filters = new HashSet<Filter>(); + private final Set<Filter> filters = new HashSet<>(); - private final Map<SimpleString, Integer> filterCounts = new HashMap<SimpleString, Integer>(); + private final Map<SimpleString, Integer> filterCounts = new HashMap<>(); private int consumerCount; http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/group/impl/LocalGroupingHandler.java ---------------------------------------------------------------------- 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 09a8fc3..eb43313 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<SimpleString, GroupBinding> map = new ConcurrentHashMap<SimpleString, GroupBinding>(); + private final ConcurrentMap<SimpleString, GroupBinding> map = new ConcurrentHashMap<>(); - private final ConcurrentMap<SimpleString, List<GroupBinding>> groupMap = new ConcurrentHashMap<SimpleString, List<GroupBinding>>(); + private final ConcurrentMap<SimpleString, List<GroupBinding>> 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<SimpleString> expectedBindings = new LinkedList<SimpleString>(); + private List<SimpleString> 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<GroupBinding> newList = new ArrayList<GroupBinding>(); + List<GroupBinding> newList = new ArrayList<>(); List<GroupBinding> 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<GroupBinding> newList = new ArrayList<GroupBinding>(); + List<GroupBinding> newList = new ArrayList<>(); List<GroupBinding> oldList = groupMap.putIfAbsent(groupBinding.getClusterName(), newList); if (oldList != null) { newList = oldList; @@ -248,10 +248,10 @@ public final class LocalGroupingHandler extends GroupHandlingAbstract { List<SimpleString> bindingsAlreadyAdded; if (expectedBindings == null) { bindingsAlreadyAdded = Collections.emptyList(); - expectedBindings = new LinkedList<SimpleString>(); + expectedBindings = new LinkedList<>(); } else { - bindingsAlreadyAdded = new ArrayList<SimpleString>(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<SimpleString>(); + expectedBindings = new LinkedList<>(); } if (reaperPeriod > 0 && groupTimeout > 0) { http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/group/impl/RemoteGroupingHandler.java ---------------------------------------------------------------------- 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 57763d5..06ddc95 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<SimpleString, Response> responses = new ConcurrentHashMap<SimpleString, Response>(); + private final Map<SimpleString, Response> 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<SimpleString, List<SimpleString>> groupMap = new ConcurrentHashMap<SimpleString, List<SimpleString>>(); + private final ConcurrentMap<SimpleString, List<SimpleString>> groupMap = new ConcurrentHashMap<>(); private final ConcurrentHashSet<Notification> pendingNotifications = new ConcurrentHashSet(); @@ -240,7 +240,7 @@ public final class RemoteGroupingHandler extends GroupHandlingAbstract { try { lock.lock(); responses.put(response.getGroupId(), response); - List<SimpleString> newList = new ArrayList<SimpleString>(); + List<SimpleString> newList = new ArrayList<>(); List<SimpleString> oldList = groupMap.putIfAbsent(response.getChosenClusterName(), newList); if (oldList != null) { newList = oldList; http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ActiveMQServerImpl.java ---------------------------------------------------------------------- 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 70d3bbd..8b3dae0 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<String, ServerSession> sessions = new ConcurrentHashMap<String, ServerSession>(); + private final Map<String, ServerSession> 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<ActivateCallback> activateCallbacks = new ConcurrentHashSet<ActivateCallback>(); + private final Set<ActivateCallback> activateCallbacks = new ConcurrentHashSet<>(); private volatile GroupingHandler groupingHandler; @@ -329,11 +329,11 @@ public class ActiveMQServerImpl implements ActiveMQServer { this.securityManager = securityManager; - addressSettingsRepository = new HierarchicalObjectRepository<AddressSettings>(); + addressSettingsRepository = new HierarchicalObjectRepository<>(); addressSettingsRepository.setDefault(new AddressSettings()); - securityRepository = new HierarchicalObjectRepository<Set<Role>>(); + securityRepository = new HierarchicalObjectRepository<>(); securityRepository.setDefault(new HashSet<Role>()); @@ -1130,7 +1130,7 @@ public class ActiveMQServerImpl implements ActiveMQServer { @Override public synchronized List<ServerSession> getSessions(final String connectionID) { Set<Entry<String, ServerSession>> sessionEntries = sessions.entrySet(); - List<ServerSession> matchingSessions = new ArrayList<ServerSession>(); + List<ServerSession> matchingSessions = new ArrayList<>(); for (Entry<String, ServerSession> 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<ServerSession> getSessions() { - return new HashSet<ServerSession>(sessions.values()); + return new HashSet<>(sessions.values()); } @Override @@ -1773,11 +1773,11 @@ public class ActiveMQServerImpl implements ActiveMQServer { journalLoader.handleGroupingBindings(groupingInfos); - Map<SimpleString, List<Pair<byte[], Long>>> duplicateIDMap = new HashMap<SimpleString, List<Pair<byte[], Long>>>(); + Map<SimpleString, List<Pair<byte[], Long>>> duplicateIDMap = new HashMap<>(); - HashSet<Pair<Long, Long>> pendingLargeMessages = new HashSet<Pair<Long, Long>>(); + HashSet<Pair<Long, Long>> pendingLargeMessages = new HashSet<>(); - List<PageCountPending> pendingNonTXPageCounter = new LinkedList<PageCountPending>(); + List<PageCountPending> pendingNonTXPageCounter = new LinkedList<>(); journalInfo[1] = storageManager.loadMessageJournal(postOffice, pagingManager, resourceManager, queueBindingInfosMap, duplicateIDMap, pendingLargeMessages, pendingNonTXPageCounter, journalLoader); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/AnyLiveNodeLocatorForReplication.java ---------------------------------------------------------------------- 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 6d2923a..859daaa 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<String, Pair<TransportConfiguration, TransportConfiguration>> untriedConnectors = new HashMap<String, Pair<TransportConfiguration, TransportConfiguration>>(); - Map<String, Pair<TransportConfiguration, TransportConfiguration>> triedConnectors = new HashMap<String, Pair<TransportConfiguration, TransportConfiguration>>(); + Map<String, Pair<TransportConfiguration, TransportConfiguration>> untriedConnectors = new HashMap<>(); + Map<String, Pair<TransportConfiguration, TransportConfiguration>> 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<TransportConfiguration, TransportConfiguration> connector = new Pair<TransportConfiguration, TransportConfiguration>(topologyMember.getLive(), topologyMember.getBackup()); + Pair<TransportConfiguration, TransportConfiguration> connector = new Pair<>(topologyMember.getLive(), topologyMember.getBackup()); if (server.checkLiveIsNotColocated(topologyMember.getNodeId())) { untriedConnectors.put(topologyMember.getNodeId(), connector); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ConnectorsService.java ---------------------------------------------------------------------- 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 789b9b6..912f721 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<ConnectorService> connectors = new HashSet<ConnectorService>(); + private final Set<ConnectorService> connectors = new HashSet<>(); private final ServiceRegistry serviceRegistry; http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/LastValueQueue.java ---------------------------------------------------------------------- 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 c474a45..5420688 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<SimpleString, HolderReference> map = new ConcurrentHashMap<SimpleString, HolderReference>(); + private final Map<SimpleString, HolderReference> map = new ConcurrentHashMap<>(); public LastValueQueue(final long persistenceID, final SimpleString address, http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/LegacyLDAPSecuritySettingPlugin.java ---------------------------------------------------------------------- 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 cc24dd5..21de3d7 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<String, String> env = new Hashtable<String, String>(); + Hashtable<String, String> 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<String, Set<Role>> securityRoles = new HashMap<String, Set<Role>>(); + Map<String, Set<Role>> securityRoles = new HashMap<>(); try { NamingEnumeration<SearchResult> searchResults = context.search(destinationBase, filter, searchControls); int i = 0; http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/NamedLiveNodeLocatorForReplication.java ---------------------------------------------------------------------- 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 38bbc54..862e3a6 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<TransportConfiguration, TransportConfiguration>(topologyMember.getLive(), topologyMember.getBackup()); + liveConfiguration = new Pair<>(topologyMember.getLive(), topologyMember.getBackup()); nodeID = topologyMember.getNodeId(); condition.signal(); } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/NamedLiveNodeLocatorForScaleDown.java ---------------------------------------------------------------------- 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 6b6c25b..663148a 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<TransportConfiguration, TransportConfiguration> connector = new Pair<TransportConfiguration, TransportConfiguration>(topologyMember.getLive(), topologyMember.getBackup()); + Pair<TransportConfiguration, TransportConfiguration> connector = new Pair<>(topologyMember.getLive(), topologyMember.getBackup()); if (topologyMember.getNodeId().equals(myNodeID)) { if (ActiveMQServerLogger.LOGGER.isTraceEnabled()) { http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/PostOfficeJournalLoader.java ---------------------------------------------------------------------- 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 cd6908e..e67142e 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<PagedMessage> pgMessages = pg.read(storageManager); - Map<Long, AtomicInteger> countsPerQueueOnPage = new HashMap<Long, AtomicInteger>(); + Map<Long, AtomicInteger> countsPerQueueOnPage = new HashMap<>(); for (PagedMessage pgd : pgMessages) { if (pgd.getTransactionID() <= 0) { @@ -405,7 +405,7 @@ public class PostOfficeJournalLoader implements JournalLoader { private Map<SimpleString, Map<Long, Map<Long, List<PageCountPending>>>> generateMapsOnPendingCount(Map<Long, Queue> queues, List<PageCountPending> pendingNonTXPageCounter, Transaction txRecoverCounter) throws Exception { - Map<SimpleString, Map<Long, Map<Long, List<PageCountPending>>>> perAddressMap = new HashMap<SimpleString, Map<Long, Map<Long, List<PageCountPending>>>>(); + Map<SimpleString, Map<Long, Map<Long, List<PageCountPending>>>> 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<PageCountPending> pendingCounters = perQueueMap.get(queueID); if (pendingCounters == null) { - pendingCounters = new LinkedList<PageCountPending>(); + pendingCounters = new LinkedList<>(); perQueueMap.put(queueID, pendingCounters); } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/QueueImpl.java ---------------------------------------------------------------------- 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 bea9f6d..5d7053e 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<MessageReference> intermediateMessageReferences = new ConcurrentLinkedQueue<MessageReference>(); + private final ConcurrentLinkedQueue<MessageReference> intermediateMessageReferences = new ConcurrentLinkedQueue<>(); // This is where messages are stored - private final PriorityLinkedList<MessageReference> messageReferences = new PriorityLinkedListImpl<MessageReference>(QueueImpl.NUM_PRIORITIES); + private final PriorityLinkedList<MessageReference> 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<ConsumerHolder> consumerList = new CopyOnWriteArrayList<ConsumerHolder>(); + private final List<ConsumerHolder> consumerList = new CopyOnWriteArrayList<>(); private final ScheduledDeliveryHandler scheduledDeliveryHandler; @@ -190,7 +190,7 @@ public class QueueImpl implements Queue { private Redistributor redistributor; - private final Set<ScheduledFuture<?>> futures = new ConcurrentHashSet<ScheduledFuture<?>>(); + private final Set<ScheduledFuture<?>> 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<Consumer> consumerSet = new HashSet<Consumer>(); + private final Set<Consumer> consumerSet = new HashSet<>(); - private final Map<SimpleString, Consumer> groups = new HashMap<SimpleString, Consumer>(); + private final Map<SimpleString, Consumer> groups = new HashMap<>(); private volatile SimpleString expiryAddress; @@ -252,7 +252,7 @@ public class QueueImpl implements Queue { } synchronized (this) { - ArrayList<SimpleString> groupsUsed = new ArrayList<SimpleString>(); + ArrayList<SimpleString> 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<SimpleString>(); + groupsToRemove = new LinkedList<>(); } groupsToRemove.add(groupID); } @@ -823,7 +823,7 @@ public class QueueImpl implements Queue { @Override public synchronized Set<Consumer> getConsumers() { - return new HashSet<Consumer>(consumerSet); + return new HashSet<>(consumerSet); } @Override @@ -944,7 +944,7 @@ public class QueueImpl implements Queue { List<ConsumerHolder> consumerListClone = cloneConsumersList(); - Map<String, List<MessageReference>> mapReturn = new HashMap<String, List<MessageReference>>(); + Map<String, List<MessageReference>> mapReturn = new HashMap<>(); for (ConsumerHolder holder : consumerListClone) { List<MessageReference> msgs = holder.consumer.getDeliveringMessages(); @@ -2551,7 +2551,7 @@ public class QueueImpl implements Queue { List<ConsumerHolder> consumerListClone; synchronized (this) { - consumerListClone = new ArrayList<ConsumerHolder>(consumerList); + consumerListClone = new ArrayList<>(consumerList); } return consumerListClone; } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/RefsOperation.java ---------------------------------------------------------------------- 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 e11af87..d117186 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<MessageReference> refsToAck = new ArrayList<MessageReference>(); + List<MessageReference> refsToAck = new ArrayList<>(); List<ServerMessage> pagedMessagesToPostACK = null; @@ -59,7 +59,7 @@ public class RefsOperation extends TransactionOperationAbstract { refsToAck.add(ref); if (ref.isPaged()) { if (pagedMessagesToPostACK == null) { - pagedMessagesToPostACK = new ArrayList<ServerMessage>(); + pagedMessagesToPostACK = new ArrayList<>(); } pagedMessagesToPostACK.add(ref.getMessage()); } @@ -67,7 +67,7 @@ public class RefsOperation extends TransactionOperationAbstract { @Override public void afterRollback(final Transaction tx) { - Map<QueueImpl, LinkedList<MessageReference>> queueMap = new HashMap<QueueImpl, LinkedList<MessageReference>>(); + Map<QueueImpl, LinkedList<MessageReference>> queueMap = new HashMap<>(); long timeBase = System.currentTimeMillis(); @@ -90,7 +90,7 @@ public class RefsOperation extends TransactionOperationAbstract { LinkedList<MessageReference> toCancel = queueMap.get(ref.getQueue()); if (toCancel == null) { - toCancel = new LinkedList<MessageReference>(); + toCancel = new LinkedList<>(); queueMap.put((QueueImpl) ref.getQueue(), toCancel); } @@ -165,14 +165,14 @@ public class RefsOperation extends TransactionOperationAbstract { @Override public synchronized List<MessageReference> getRelatedMessageReferences() { - List<MessageReference> listRet = new LinkedList<MessageReference>(); + List<MessageReference> listRet = new LinkedList<>(); listRet.addAll(listRet); return listRet; } @Override public synchronized List<MessageReference> getListOnConsumer(long consumerID) { - List<MessageReference> list = new LinkedList<MessageReference>(); + List<MessageReference> list = new LinkedList<>(); for (MessageReference ref : refsToAck) { if (ref.getConsumerId() != null && ref.getConsumerId().equals(consumerID)) { list.add(ref); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/RoutingContextImpl.java ---------------------------------------------------------------------- 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 1a5bcbd..6bbeaf4 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<SimpleString, RouteContextList> map = new HashMap<SimpleString, RouteContextList>(); + private final Map<SimpleString, RouteContextList> 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<Queue> durableQueue = new ArrayList<Queue>(1); + private final List<Queue> durableQueue = new ArrayList<>(1); - private final List<Queue> nonDurableQueue = new ArrayList<Queue>(1); + private final List<Queue> nonDurableQueue = new ArrayList<>(1); private final List<Queue> ackedQueues = new ArrayList<>(); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ScaleDownHandler.java ---------------------------------------------------------------------- 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 48a56bf..8f63476 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<Queue, QueuesXRefInnerManager> controls = new HashMap<Queue, QueuesXRefInnerManager>(); + final HashMap<Queue, QueuesXRefInnerManager> controls = new HashMap<>(); PagingStore pageStore = pagingManager.getPageStore(address); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ScheduledDeliveryHandlerImpl.java ---------------------------------------------------------------------- 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 9fc5bab..f9ee1ce 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<MessageReference> getScheduledReferences() { - List<MessageReference> refs = new LinkedList<MessageReference>(); + List<MessageReference> refs = new LinkedList<>(); synchronized (scheduledReferences) { for (RefScheduled ref : scheduledReferences) { @@ -98,7 +98,7 @@ public class ScheduledDeliveryHandlerImpl implements ScheduledDeliveryHandler { @Override public List<MessageReference> cancel(final Filter filter) { - List<MessageReference> refs = new ArrayList<MessageReference>(); + List<MessageReference> refs = new ArrayList<>(); synchronized (scheduledReferences) { Iterator<RefScheduled> iter = scheduledReferences.iterator(); @@ -170,7 +170,7 @@ public class ScheduledDeliveryHandlerImpl implements ScheduledDeliveryHandler { @Override public void run() { - HashMap<Queue, LinkedList<MessageReference>> refs = new HashMap<Queue, LinkedList<MessageReference>>(); + HashMap<Queue, LinkedList<MessageReference>> refs = new HashMap<>(); runnables.remove(deliveryTime); @@ -212,7 +212,7 @@ public class ScheduledDeliveryHandlerImpl implements ScheduledDeliveryHandler { LinkedList<MessageReference> references = refs.get(reference.getQueue()); if (references == null) { - references = new LinkedList<MessageReference>(); + references = new LinkedList<>(); refs.put(reference.getQueue(), references); } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerConsumerImpl.java ---------------------------------------------------------------------- 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 e74b60e..243d139 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<MessageReference> deliveringRefs = new ConcurrentLinkedQueue<MessageReference>(); + protected final java.util.Queue<MessageReference> deliveringRefs = new ConcurrentLinkedQueue<>(); private final SessionCallback callback; @@ -260,7 +260,7 @@ public class ServerConsumerImpl implements ServerConsumer, ReadyListener { @Override public List<MessageReference> getDeliveringMessages() { - List<MessageReference> refs = new LinkedList<MessageReference>(); + List<MessageReference> refs = new LinkedList<>(); synchronized (lock) { List<MessageReference> refsOnConsumer = session.getInTXMessagesForConsumer(this.id); if (refsOnConsumer != null) { @@ -529,7 +529,7 @@ public class ServerConsumerImpl implements ServerConsumer, ReadyListener { largeMessageDeliverer = null; } - LinkedList<MessageReference> refs = new LinkedList<MessageReference>(); + LinkedList<MessageReference> refs = new LinkedList<>(); synchronized (lock) { if (!deliveringRefs.isEmpty()) { http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/impl/ServerSessionImpl.java ---------------------------------------------------------------------- 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 26d9bb4..d036fdf 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<Long, ServerConsumer> consumers = new ConcurrentHashMap<Long, ServerConsumer>(); + protected final Map<Long, ServerConsumer> consumers = new ConcurrentHashMap<>(); protected Transaction tx; @@ -132,7 +132,7 @@ public class ServerSessionImpl implements ServerSession, FailureListener { protected volatile boolean started = false; - protected final Map<SimpleString, TempQueueCleanerUpper> tempQueueCleannerUppers = new HashMap<SimpleString, TempQueueCleanerUpper>(); + protected final Map<SimpleString, TempQueueCleanerUpper> 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<SimpleString, Pair<UUID, AtomicLong>> targetAddressInfos = new HashMap<SimpleString, Pair<UUID, AtomicLong>>(); + protected final Map<SimpleString, Pair<UUID, AtomicLong>> targetAddressInfos = new HashMap<>(); private final long creationTime = System.currentTimeMillis(); @@ -311,7 +311,7 @@ public class ServerSessionImpl implements ServerSession, FailureListener { @Override public Set<ServerConsumer> getServerConsumers() { - Set<ServerConsumer> consumersClone = new HashSet<ServerConsumer>(consumers.values()); + Set<ServerConsumer> 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<ServerConsumer> consumersClone = new HashSet<ServerConsumer>(consumers.values()); + Set<ServerConsumer> 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<SimpleString> names = new ArrayList<SimpleString>(); + List<SimpleString> 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<Xid> xaGetInDoubtXids() { - List<Xid> xids = new ArrayList<Xid>(); + List<Xid> 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<ServerConsumer> consumersClone = new HashSet<ServerConsumer>(consumers.values()); + Set<ServerConsumer> 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<String, String>(); + metaData = new HashMap<>(); } metaData.put(key, data); } @@ -1511,11 +1511,11 @@ public class ServerSessionImpl implements ServerSession, FailureListener { } private Map<SimpleString, Pair<UUID, AtomicLong>> cloneTargetAddresses() { - return new HashMap<SimpleString, Pair<UUID, AtomicLong>>(targetAddressInfos); + return new HashMap<>(targetAddressInfos); } private void setStarted(final boolean s) { - Set<ServerConsumer> consumersClone = new HashSet<ServerConsumer>(consumers.values()); + Set<ServerConsumer> 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<MessageReference> toCancel = new ArrayList<MessageReference>(); + List<MessageReference> toCancel = new ArrayList<>(); for (ServerConsumer consumer : consumers.values()) { if (wasStarted) { @@ -1621,7 +1621,7 @@ public class ServerSessionImpl implements ServerSession, FailureListener { Pair<UUID, AtomicLong> value = targetAddressInfos.get(msg.getAddress()); if (value == null) { - targetAddressInfos.put(msg.getAddress(), new Pair<UUID, AtomicLong>(msg.getUserID(), new AtomicLong(1))); + targetAddressInfos.put(msg.getAddress(), new Pair<>(msg.getUserID(), new AtomicLong(1))); } else { value.setA(msg.getUserID()); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-server/src/main/java/org/apache/activemq/artemis/core/server/management/impl/ManagementServiceImpl.java ---------------------------------------------------------------------- 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 053f81d..891e719 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<NotificationListener> listeners = new ConcurrentHashSet<NotificationListener>(); + private final Set<NotificationListener> 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<String, Object>(); + 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<String> acceptors = new ArrayList<String>(); + List<String> 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<Object> resources = new ArrayList<Object>(); - Collection<Object> clone = new ArrayList<Object>(registry.values()); + List<Object> resources = new ArrayList<>(); + Collection<Object> 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<ObjectName> registeredNames = new HashSet<ObjectName>(); + private final Set<ObjectName> 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<String> resourceNames = new HashSet<String>(registry.keySet()); + Set<String> 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<String> unexpectedResourceNames = new ArrayList<String>(); + List<String> 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))) { http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-server/src/main/java/org/apache/activemq/artemis/core/settings/impl/HierarchicalObjectRepository.java ---------------------------------------------------------------------- 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 fa20293..ad375c4 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<T> implements HierarchicalRepository<T /** * all the matches */ - private final Map<String, Match<T>> matches = new HashMap<String, Match<T>>(); + private final Map<String, Match<T>> matches = new HashMap<>(); /** * Certain values cannot be removed after installed. @@ -58,7 +58,7 @@ public class HierarchicalObjectRepository<T> implements HierarchicalRepository<T * this could cause issues on shutdown. * Notice you can still change these values. You just can't remove them. */ - private final Set<String> immutables = new HashSet<String>(); + private final Set<String> immutables = new HashSet<>(); /** * a regex comparator @@ -68,7 +68,7 @@ public class HierarchicalObjectRepository<T> implements HierarchicalRepository<T /** * a cache */ - private final Map<String, T> cache = new ConcurrentHashMap<String, T>(); + private final Map<String, T> cache = new ConcurrentHashMap<>(); /** * Need a lock instead of using multiple {@link ConcurrentHashMap}s. @@ -89,7 +89,7 @@ public class HierarchicalObjectRepository<T> implements HierarchicalRepository<T /** * any registered listeners, these get fired on changes to the repository */ - private final ArrayList<HierarchicalRepositoryChangeListener> listeners = new ArrayList<HierarchicalRepositoryChangeListener>(); + private final ArrayList<HierarchicalRepositoryChangeListener> listeners = new ArrayList<>(); @Override public void disableListeners() { @@ -123,7 +123,7 @@ public class HierarchicalObjectRepository<T> implements HierarchicalRepository<T public List<T> values() { lock.readLock().lock(); try { - ArrayList<T> values = new ArrayList<T>(matches.size()); + ArrayList<T> values = new ArrayList<>(matches.size()); for (Match<T> matchValue : matches.values()) { values.add(matchValue.getValue()); @@ -152,7 +152,7 @@ public class HierarchicalObjectRepository<T> implements HierarchicalRepository<T immutables.add(match); } Match.verify(match); - Match<T> match1 = new Match<T>(match); + Match<T> match1 = new Match<>(match); match1.setValue(value); matches.put(match, match1); } @@ -228,9 +228,9 @@ public class HierarchicalObjectRepository<T> implements HierarchicalRepository<T * @return */ private List<Match<T>> sort(final Map<String, Match<T>> possibleMatches) { - List<String> keys = new ArrayList<String>(possibleMatches.keySet()); + List<String> keys = new ArrayList<>(possibleMatches.keySet()); Collections.sort(keys, matchComparator); - List<Match<T>> matches1 = new ArrayList<Match<T>>(possibleMatches.size()); + List<Match<T>> matches1 = new ArrayList<>(possibleMatches.size()); for (String key : keys) { matches1.add(possibleMatches.get(key)); } @@ -350,7 +350,7 @@ public class HierarchicalObjectRepository<T> implements HierarchicalRepository<T * @return */ private Map<String, Match<T>> getPossibleMatches(final String match) { - HashMap<String, Match<T>> possibleMatches = new HashMap<String, Match<T>>(); + HashMap<String, Match<T>> possibleMatches = new HashMap<>(); for (Entry<String, Match<T>> entry : matches.entrySet()) { Match<T> entryMatch = entry.getValue(); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-server/src/main/java/org/apache/activemq/artemis/core/transaction/impl/ResourceManagerImpl.java ---------------------------------------------------------------------- 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 e811dd0..0db783f 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<Xid, Transaction> transactions = new ConcurrentHashMap<Xid, Transaction>(); + private final ConcurrentMap<Xid, Transaction> transactions = new ConcurrentHashMap<>(); - private final List<HeuristicCompletionHolder> heuristicCompletions = new ArrayList<HeuristicCompletionHolder>(); + private final List<HeuristicCompletionHolder> heuristicCompletions = new ArrayList<>(); private final int defaultTimeoutSeconds; @@ -113,7 +113,7 @@ public class ResourceManagerImpl implements ResourceManager { @Override public List<Xid> getPreparedTransactions() { - List<Xid> xids = new ArrayList<Xid>(); + List<Xid> xids = new ArrayList<>(); for (Map.Entry<Xid, Transaction> entry : transactions.entrySet()) { if (entry.getValue().getState() == Transaction.State.PREPARED) { @@ -125,7 +125,7 @@ public class ResourceManagerImpl implements ResourceManager { @Override public Map<Xid, Long> getPreparedTransactionsWithCreationTime() { - Map<Xid, Long> xidsWithCreationTime = new HashMap<Xid, Long>(); + Map<Xid, Long> xidsWithCreationTime = new HashMap<>(); for (Map.Entry<Xid, Transaction> entry : transactions.entrySet()) { xidsWithCreationTime.put(entry.getKey(), entry.getValue().getCreateTime()); @@ -162,7 +162,7 @@ public class ResourceManagerImpl implements ResourceManager { } private List<Xid> getHeuristicCompletedTransactions(final boolean isCommit) { - List<Xid> xids = new ArrayList<Xid>(); + List<Xid> 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<Transaction> timedoutTransactions = new HashSet<Transaction>(); + Set<Transaction> timedoutTransactions = new HashSet<>(); long now = System.currentTimeMillis(); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-server/src/main/java/org/apache/activemq/artemis/core/transaction/impl/TransactionImpl.java ---------------------------------------------------------------------- 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 c84e6f0..3490fee 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<TransactionOperation> getAllOperations() { if (operations != null) { - return new ArrayList<TransactionOperation>(operations); + return new ArrayList<>(operations); } else { - return new ArrayList<TransactionOperation>(); + return new ArrayList<>(); } } @@ -430,7 +430,7 @@ public class TransactionImpl implements Transaction { private void checkCreateOperations() { if (operations == null) { - operations = new ArrayList<TransactionOperation>(); + operations = new ArrayList<>(); } } http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/CertificateLoginModule.java ---------------------------------------------------------------------- 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 20d107e..d2fe1fe 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<String> roles; - private Set<Principal> principals = new HashSet<Principal>(); + private Set<Principal> principals = new HashSet<>(); /** * Overriding to allow for proper initialization. Standard JAAS. http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/GuestLoginModule.java ---------------------------------------------------------------------- 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 22da502..a1b5964 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<Principal> principals = new HashSet<Principal>(); + private Set<Principal> principals = new HashSet<>(); private CallbackHandler callbackHandler; private boolean loginSucceeded; http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/InVMLoginModule.java ---------------------------------------------------------------------- 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 d91d639..b1b3b42 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<Principal> principals = new HashSet<Principal>(); + private Set<Principal> principals = new HashSet<>(); private CallbackHandler callbackHandler; private boolean loginSucceeded; http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/LDAPLoginModule.java ---------------------------------------------------------------------- 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 15346ac..7afb8e4 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<RolePrincipal> groups = new HashSet<RolePrincipal>(); + private Set<RolePrincipal> 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<String> list = new ArrayList<String>(); + List<String> 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<String>(); + 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<String> haveSeenNames = new HashSet<String>(); - Queue<String> pendingNameExpansion = new LinkedList<String>(); + HashSet<String> haveSeenNames = new HashSet<>(); + Queue<String> pendingNameExpansion = new LinkedList<>(); NamingEnumeration<SearchResult> 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<String>(); + 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<String, String> env = new Hashtable<String, String>(); + Hashtable<String, String> 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)); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/PropertiesLoader.java ---------------------------------------------------------------------- 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 a83ce0d..ba8839a 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<FileNameKey, ReloadableProperties> staticCache = new HashMap<FileNameKey, ReloadableProperties>(); + static Map<FileNameKey, ReloadableProperties> staticCache = new HashMap<>(); protected boolean debug; public void init(Map options) { http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/PropertiesLoginModule.java ---------------------------------------------------------------------- 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 0a75a24..c870b28 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<Principal> principals = new HashSet<Principal>(); + private final Set<Principal> principals = new HashSet<>(); private boolean loginSucceeded; @Override http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-server/src/main/java/org/apache/activemq/artemis/spi/core/security/jaas/TextFileCertificateLoginModule.java ---------------------------------------------------------------------- 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 b1e4ba7..8bfac9b 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<String> getUserRoles(String username) throws LoginException { - Set<String> userRoles = new HashSet<String>(); + Set<String> userRoles = new HashSet<>(); for (Enumeration<Object> enumeration = roles.keys(); enumeration.hasMoreElements(); ) { String groupName = (String) enumeration.nextElement(); String[] userList = (roles.getProperty(groupName) + "").split(","); http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/f8a1c5ba/artemis-server/src/test/java/org/apache/activemq/artemis/core/config/impl/FileConfigurationParserTest.java ---------------------------------------------------------------------- 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 e2d2f83..99a45ef 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<String, String> prop = new HashMap<String, String>(); + Map<String, String> prop = new HashMap<>(); prop.put("key", "newkey"); codec.init(prop);