diff --git a/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerService.java b/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerService.java index 7f06bd979a..9d75f28618 100644 --- a/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerService.java +++ b/activemq-broker/src/main/java/org/apache/activemq/broker/BrokerService.java @@ -180,11 +180,11 @@ public class BrokerService implements Service { private PersistenceAdapterFactory persistenceFactory; protected DestinationFactory destinationFactory; private MessageAuthorizationPolicy messageAuthorizationPolicy; - private final List transportConnectors = new CopyOnWriteArrayList(); - private final List networkConnectors = new CopyOnWriteArrayList(); - private final List proxyConnectors = new CopyOnWriteArrayList(); - private final List jmsConnectors = new CopyOnWriteArrayList(); - private final List services = new ArrayList(); + private final List transportConnectors = new CopyOnWriteArrayList<>(); + private final List networkConnectors = new CopyOnWriteArrayList<>(); + private final List proxyConnectors = new CopyOnWriteArrayList<>(); + private final List jmsConnectors = new CopyOnWriteArrayList<>(); + private final List services = new ArrayList<>(); private transient Thread shutdownHook; private String[] transportConnectorURIs; private String[] networkConnectorURIs; @@ -229,7 +229,7 @@ public class BrokerService implements Service { private boolean dedicatedTaskRunner; private boolean cacheTempDestinations = false;// useful for failover private int timeBeforePurgeTempDestinations = 5000; - private final List shutdownHooks = new ArrayList(); + private final List shutdownHooks = new ArrayList<>(); private boolean systemExitOnShutdown; private int systemExitOnShutdownExitCode; private SslContext sslContext; @@ -623,7 +623,7 @@ public class BrokerService implements Service { startBroker(startAsync); brokerRegistry.bind(getBrokerName(), BrokerService.this); } catch (Exception e) { - LOG.error("Failed to start Apache ActiveMQ ({}, {})", new Object[]{ getBrokerName(), brokerId }, e); + LOG.error("Failed to start Apache ActiveMQ ({}, {})", getBrokerName(), brokerId, e); try { if (!stopped.get()) { stop(); @@ -1374,7 +1374,7 @@ public class BrokerService implements Service { } public Map getTransportConnectorURIsAsMap() { - Map answer = new HashMap(); + Map answer = new HashMap<>(); for (TransportConnector connector : transportConnectors) { try { URI uri = connector.getConnectUri(); @@ -1495,7 +1495,7 @@ public class BrokerService implements Service { } public List getTransportConnectors() { - return new ArrayList(transportConnectors); + return new ArrayList<>(transportConnectors); } /** @@ -1530,11 +1530,11 @@ public class BrokerService implements Service { } public List getNetworkConnectors() { - return new ArrayList(networkConnectors); + return new ArrayList<>(networkConnectors); } public List getProxyConnectors() { - return new ArrayList(proxyConnectors); + return new ArrayList<>(proxyConnectors); } /** @@ -2390,7 +2390,7 @@ public class BrokerService implements Service { * Create the default destination interceptor */ protected DestinationInterceptor[] createDefaultDestinationInterceptor() { - List answer = new ArrayList(); + List answer = new ArrayList<>(); if (isUseVirtualTopics()) { VirtualDestinationInterceptor interceptor = new VirtualDestinationInterceptor(); VirtualTopic virtualTopic = new VirtualTopic(); @@ -2604,7 +2604,7 @@ public class BrokerService implements Service { */ public void startAllConnectors() throws Exception { Set durableDestinations = getBroker().getDurableDestinations(); - List al = new ArrayList(); + List al = new ArrayList<>(); for (Iterator iter = getTransportConnectors().iterator(); iter.hasNext();) { TransportConnector connector = iter.next(); al.add(startTransportConnector(connector)); @@ -2617,7 +2617,7 @@ public class BrokerService implements Service { } this.slave = false; URI uri = getVmConnectorURI(); - Map map = new HashMap(URISupport.parseParameters(uri)); + Map map = new HashMap<>(URISupport.parseParameters(uri)); map.put("async", "false"); map.put("create","false"); uri = URISupport.createURIWithQuery(uri, URISupport.createQueryString(map)); @@ -2742,7 +2742,7 @@ public class BrokerService implements Service { private DestinationFilter getVirtualTopicConsumerDestinationFilter() { // created at startup, so no sync needed if (virtualConsumerDestinationFilter == null) { - Set consumerDestinations = new HashSet(); + Set consumerDestinations = new HashSet<>(); if (destinationInterceptors != null) { for (DestinationInterceptor interceptor : destinationInterceptors) { if (interceptor instanceof VirtualDestinationInterceptor) {