Explicit type can be replaced by <>
Issue: SPR-13188
This commit is contained in:
@@ -49,7 +49,7 @@ public class JmsListenerEndpointRegistrar implements BeanFactoryAware, Initializ
|
||||
private BeanFactory beanFactory;
|
||||
|
||||
private final List<JmsListenerEndpointDescriptor> endpointDescriptors =
|
||||
new ArrayList<JmsListenerEndpointDescriptor>();
|
||||
new ArrayList<>();
|
||||
|
||||
private boolean startImmediately;
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ public class JmsListenerEndpointRegistry implements DisposableBean, SmartLifecyc
|
||||
protected final Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
private final Map<String, MessageListenerContainer> listenerContainers =
|
||||
new ConcurrentHashMap<String, MessageListenerContainer>();
|
||||
new ConcurrentHashMap<>();
|
||||
|
||||
private int phase = Integer.MAX_VALUE;
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ public class CachingConnectionFactory extends SingleConnectionFactory {
|
||||
private volatile boolean active = true;
|
||||
|
||||
private final Map<Integer, LinkedList<Session>> cachedSessions =
|
||||
new HashMap<Integer, LinkedList<Session>>();
|
||||
new HashMap<>();
|
||||
|
||||
|
||||
/**
|
||||
@@ -216,7 +216,7 @@ public class CachingConnectionFactory extends SingleConnectionFactory {
|
||||
synchronized (this.cachedSessions) {
|
||||
sessionList = this.cachedSessions.get(mode);
|
||||
if (sessionList == null) {
|
||||
sessionList = new LinkedList<Session>();
|
||||
sessionList = new LinkedList<>();
|
||||
this.cachedSessions.put(mode, sessionList);
|
||||
}
|
||||
}
|
||||
@@ -251,7 +251,7 @@ public class CachingConnectionFactory extends SingleConnectionFactory {
|
||||
* @return the wrapped Session
|
||||
*/
|
||||
protected Session getCachedSessionProxy(Session target, LinkedList<Session> sessionList) {
|
||||
List<Class<?>> classes = new ArrayList<Class<?>>(3);
|
||||
List<Class<?>> classes = new ArrayList<>(3);
|
||||
classes.add(SessionProxy.class);
|
||||
if (target instanceof QueueSession) {
|
||||
classes.add(QueueSession.class);
|
||||
@@ -276,10 +276,10 @@ public class CachingConnectionFactory extends SingleConnectionFactory {
|
||||
private final LinkedList<Session> sessionList;
|
||||
|
||||
private final Map<DestinationCacheKey, MessageProducer> cachedProducers =
|
||||
new HashMap<DestinationCacheKey, MessageProducer>();
|
||||
new HashMap<>();
|
||||
|
||||
private final Map<ConsumerCacheKey, MessageConsumer> cachedConsumers =
|
||||
new HashMap<ConsumerCacheKey, MessageConsumer>();
|
||||
new HashMap<>();
|
||||
|
||||
private boolean transactionOpen = false;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -33,7 +33,7 @@ import org.springframework.util.Assert;
|
||||
public class ChainedExceptionListener implements ExceptionListener {
|
||||
|
||||
/** List of ExceptionListeners */
|
||||
private final List<ExceptionListener> delegates = new ArrayList<ExceptionListener>(2);
|
||||
private final List<ExceptionListener> delegates = new ArrayList<>(2);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -56,12 +56,12 @@ public class JmsResourceHolder extends ResourceHolderSupport {
|
||||
|
||||
private boolean frozen = false;
|
||||
|
||||
private final List<Connection> connections = new LinkedList<Connection>();
|
||||
private final List<Connection> connections = new LinkedList<>();
|
||||
|
||||
private final List<Session> sessions = new LinkedList<Session>();
|
||||
private final List<Session> sessions = new LinkedList<>();
|
||||
|
||||
private final Map<Connection, List<Session>> sessionsPerConnection =
|
||||
new HashMap<Connection, List<Session>>();
|
||||
new HashMap<>();
|
||||
|
||||
|
||||
/**
|
||||
@@ -140,7 +140,7 @@ public class JmsResourceHolder extends ResourceHolderSupport {
|
||||
if (connection != null) {
|
||||
List<Session> sessions = this.sessionsPerConnection.get(connection);
|
||||
if (sessions == null) {
|
||||
sessions = new LinkedList<Session>();
|
||||
sessions = new LinkedList<>();
|
||||
this.sessionsPerConnection.put(connection, sessions);
|
||||
}
|
||||
sessions.add(session);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -473,7 +473,7 @@ public class SingleConnectionFactory implements ConnectionFactory, QueueConnecti
|
||||
* @return the wrapped Connection
|
||||
*/
|
||||
protected Connection getSharedConnectionProxy(Connection target) {
|
||||
List<Class<?>> classes = new ArrayList<Class<?>>(3);
|
||||
List<Class<?>> classes = new ArrayList<>(3);
|
||||
classes.add(Connection.class);
|
||||
if (target instanceof QueueConnection) {
|
||||
classes.add(QueueConnection.class);
|
||||
@@ -662,14 +662,14 @@ public class SingleConnectionFactory implements ConnectionFactory, QueueConnecti
|
||||
*/
|
||||
private class AggregatedExceptionListener implements ExceptionListener {
|
||||
|
||||
final Set<ExceptionListener> delegates = new LinkedHashSet<ExceptionListener>(2);
|
||||
final Set<ExceptionListener> delegates = new LinkedHashSet<>(2);
|
||||
|
||||
@Override
|
||||
public void onException(JMSException ex) {
|
||||
synchronized (connectionMonitor) {
|
||||
// Iterate over temporary copy in order to avoid ConcurrentModificationException,
|
||||
// since listener invocations may in turn trigger registration of listeners...
|
||||
for (ExceptionListener listener : new LinkedHashSet<ExceptionListener>(this.delegates)) {
|
||||
for (ExceptionListener listener : new LinkedHashSet<>(this.delegates)) {
|
||||
listener.onException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -196,7 +196,7 @@ public class TransactionAwareConnectionFactoryProxy
|
||||
* @return the wrapped Connection
|
||||
*/
|
||||
protected Connection getTransactionAwareConnectionProxy(Connection target) {
|
||||
List<Class<?>> classes = new ArrayList<Class<?>>(3);
|
||||
List<Class<?>> classes = new ArrayList<>(3);
|
||||
classes.add(Connection.class);
|
||||
if (target instanceof QueueConnection) {
|
||||
classes.add(QueueConnection.class);
|
||||
@@ -268,7 +268,7 @@ public class TransactionAwareConnectionFactoryProxy
|
||||
}
|
||||
|
||||
private Session getCloseSuppressingSessionProxy(Session target) {
|
||||
List<Class<?>> classes = new ArrayList<Class<?>>(3);
|
||||
List<Class<?>> classes = new ArrayList<>(3);
|
||||
classes.add(SessionProxy.class);
|
||||
if (target instanceof QueueSession) {
|
||||
classes.add(QueueSession.class);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -77,7 +77,7 @@ public class UserCredentialsConnectionFactoryAdapter
|
||||
private String password;
|
||||
|
||||
private final ThreadLocal<JmsUserCredentials> threadBoundCredentials =
|
||||
new NamedThreadLocal<JmsUserCredentials>("Current JMS user credentials");
|
||||
new NamedThreadLocal<>("Current JMS user credentials");
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -78,7 +78,7 @@ public abstract class AbstractJmsListeningContainer extends JmsDestinationAccess
|
||||
|
||||
private boolean running = false;
|
||||
|
||||
private final List<Object> pausedTasks = new LinkedList<Object>();
|
||||
private final List<Object> pausedTasks = new LinkedList<>();
|
||||
|
||||
protected final Object lifecycleMonitor = new Object();
|
||||
|
||||
|
||||
@@ -189,7 +189,7 @@ public class DefaultMessageListenerContainer extends AbstractPollingMessageListe
|
||||
|
||||
private int idleTaskExecutionLimit = 1;
|
||||
|
||||
private final Set<AsyncMessageListenerInvoker> scheduledInvokers = new HashSet<AsyncMessageListenerInvoker>();
|
||||
private final Set<AsyncMessageListenerInvoker> scheduledInvokers = new HashSet<>();
|
||||
|
||||
private int activeInvokerCount = 0;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -258,8 +258,8 @@ public class SimpleMessageListenerContainer extends AbstractMessageListenerConta
|
||||
// Register Sessions and MessageConsumers.
|
||||
synchronized (this.consumersMonitor) {
|
||||
if (this.consumers == null) {
|
||||
this.sessions = new HashSet<Session>(this.concurrentConsumers);
|
||||
this.consumers = new HashSet<MessageConsumer>(this.concurrentConsumers);
|
||||
this.sessions = new HashSet<>(this.concurrentConsumers);
|
||||
this.consumers = new HashSet<>(this.concurrentConsumers);
|
||||
Connection con = getSharedConnection();
|
||||
for (int i = 0; i < this.concurrentConsumers; i++) {
|
||||
Session session = createSession(con);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -111,7 +111,7 @@ public class JmsResponse<T> {
|
||||
*/
|
||||
public static <T> JmsResponse<T> forQueue(T result, String queueName) {
|
||||
Assert.notNull(queueName, "Queue name must not be null");
|
||||
return new JmsResponse<T>(result, new DestinationNameHolder(queueName, false));
|
||||
return new JmsResponse<>(result, new DestinationNameHolder(queueName, false));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -119,7 +119,7 @@ public class JmsResponse<T> {
|
||||
*/
|
||||
public static <T> JmsResponse<T> forTopic(T result, String topicName) {
|
||||
Assert.notNull(topicName, "Topic name must not be null");
|
||||
return new JmsResponse<T>(result, new DestinationNameHolder(topicName, true));
|
||||
return new JmsResponse<>(result, new DestinationNameHolder(topicName, true));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -127,7 +127,7 @@ public class JmsResponse<T> {
|
||||
*/
|
||||
public static <T> JmsResponse<T> forDestination(T result, Destination destination) {
|
||||
Assert.notNull(destination, "Destination must not be null");
|
||||
return new JmsResponse<T>(result, destination);
|
||||
return new JmsResponse<>(result, destination);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -55,7 +55,7 @@ import org.springframework.util.StringUtils;
|
||||
*/
|
||||
public class SimpleJmsHeaderMapper extends AbstractHeaderMapper<Message> implements JmsHeaderMapper {
|
||||
|
||||
private static Set<Class<?>> SUPPORTED_PROPERTY_TYPES = new HashSet<Class<?>>(Arrays.asList(new Class<?>[] {
|
||||
private static Set<Class<?>> SUPPORTED_PROPERTY_TYPES = new HashSet<>(Arrays.asList(new Class<?>[] {
|
||||
Boolean.class, Byte.class, Double.class, Float.class, Integer.class, Long.class, Short.class, String.class}));
|
||||
|
||||
|
||||
@@ -124,7 +124,7 @@ public class SimpleJmsHeaderMapper extends AbstractHeaderMapper<Message> impleme
|
||||
|
||||
@Override
|
||||
public MessageHeaders toHeaders(javax.jms.Message jmsMessage) {
|
||||
Map<String, Object> headers = new HashMap<String, Object>();
|
||||
Map<String, Object> headers = new HashMap<>();
|
||||
try {
|
||||
try {
|
||||
String correlationId = jmsMessage.getJMSCorrelationID();
|
||||
|
||||
@@ -79,9 +79,9 @@ public class MappingJackson2MessageConverter implements SmartMessageConverter, B
|
||||
|
||||
private String typeIdPropertyName;
|
||||
|
||||
private Map<String, Class<?>> idClassMappings = new HashMap<String, Class<?>>();
|
||||
private Map<String, Class<?>> idClassMappings = new HashMap<>();
|
||||
|
||||
private Map<Class<?>, String> classIdMappings = new HashMap<Class<?>, String>();
|
||||
private Map<Class<?>, String> classIdMappings = new HashMap<>();
|
||||
|
||||
private ClassLoader beanClassLoader;
|
||||
|
||||
@@ -156,7 +156,7 @@ public class MappingJackson2MessageConverter implements SmartMessageConverter, B
|
||||
* @param typeIdMappings a Map with type id values as keys and Java classes as values
|
||||
*/
|
||||
public void setTypeIdMappings(Map<String, Class<?>> typeIdMappings) {
|
||||
this.idClassMappings = new HashMap<String, Class<?>>();
|
||||
this.idClassMappings = new HashMap<>();
|
||||
for (Map.Entry<String, Class<?>> entry : typeIdMappings.entrySet()) {
|
||||
String id = entry.getKey();
|
||||
Class<?> clazz = entry.getValue();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -199,7 +199,7 @@ public class SimpleMessageConverter implements MessageConverter {
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
protected Map<String, Object> extractMapFromMessage(MapMessage message) throws JMSException {
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
Enumeration<String> en = message.getMapNames();
|
||||
while (en.hasMoreElements()) {
|
||||
String key = en.nextElement();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -60,7 +60,7 @@ public class JndiDestinationResolver extends JndiLocatorSupport implements Cachi
|
||||
|
||||
private DestinationResolver dynamicDestinationResolver = new DynamicDestinationResolver();
|
||||
|
||||
private final Map<String, Destination> destinationCache = new ConcurrentHashMap<String, Destination>(16);
|
||||
private final Map<String, Destination> destinationCache = new ConcurrentHashMap<>(16);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user