Explicit type can be replaced by <>
Issue: SPR-13188
This commit is contained in:
@@ -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.
|
||||
@@ -34,7 +34,7 @@ import org.springframework.util.Assert;
|
||||
public class ChainedPersistenceExceptionTranslator implements PersistenceExceptionTranslator {
|
||||
|
||||
/** List of PersistenceExceptionTranslators */
|
||||
private final List<PersistenceExceptionTranslator> delegates = new ArrayList<PersistenceExceptionTranslator>(4);
|
||||
private final List<PersistenceExceptionTranslator> delegates = new ArrayList<>(4);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -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.
|
||||
@@ -68,7 +68,7 @@ public class ConnectionSpecConnectionFactoryAdapter extends DelegatingConnection
|
||||
private ConnectionSpec connectionSpec;
|
||||
|
||||
private final ThreadLocal<ConnectionSpec> threadBoundSpec =
|
||||
new NamedThreadLocal<ConnectionSpec>("Current CCI ConnectionSpec");
|
||||
new NamedThreadLocal<>("Current CCI ConnectionSpec");
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -258,28 +258,28 @@ public class WorkManagerTaskExecutor extends JndiLocatorSupport
|
||||
|
||||
@Override
|
||||
public Future<?> submit(Runnable task) {
|
||||
FutureTask<Object> future = new FutureTask<Object>(task, null);
|
||||
FutureTask<Object> future = new FutureTask<>(task, null);
|
||||
execute(future, TIMEOUT_INDEFINITE);
|
||||
return future;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> Future<T> submit(Callable<T> task) {
|
||||
FutureTask<T> future = new FutureTask<T>(task);
|
||||
FutureTask<T> future = new FutureTask<>(task);
|
||||
execute(future, TIMEOUT_INDEFINITE);
|
||||
return future;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ListenableFuture<?> submitListenable(Runnable task) {
|
||||
ListenableFutureTask<Object> future = new ListenableFutureTask<Object>(task, null);
|
||||
ListenableFutureTask<Object> future = new ListenableFutureTask<>(task, null);
|
||||
execute(future, TIMEOUT_INDEFINITE);
|
||||
return future;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> ListenableFuture<T> submitListenable(Callable<T> task) {
|
||||
ListenableFutureTask<T> future = new ListenableFutureTask<T>(task);
|
||||
ListenableFutureTask<T> future = new ListenableFutureTask<>(task);
|
||||
execute(future, TIMEOUT_INDEFINITE);
|
||||
return future;
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -85,7 +85,7 @@ public class AnnotationTransactionAttributeSource extends AbstractFallbackTransa
|
||||
*/
|
||||
public AnnotationTransactionAttributeSource(boolean publicMethodsOnly) {
|
||||
this.publicMethodsOnly = publicMethodsOnly;
|
||||
this.annotationParsers = new LinkedHashSet<TransactionAnnotationParser>(2);
|
||||
this.annotationParsers = new LinkedHashSet<>(2);
|
||||
this.annotationParsers.add(new SpringTransactionAnnotationParser());
|
||||
if (jta12Present) {
|
||||
this.annotationParsers.add(new JtaTransactionAnnotationParser());
|
||||
@@ -112,7 +112,7 @@ public class AnnotationTransactionAttributeSource extends AbstractFallbackTransa
|
||||
public AnnotationTransactionAttributeSource(TransactionAnnotationParser... annotationParsers) {
|
||||
this.publicMethodsOnly = true;
|
||||
Assert.notEmpty(annotationParsers, "At least one TransactionAnnotationParser needs to be specified");
|
||||
Set<TransactionAnnotationParser> parsers = new LinkedHashSet<TransactionAnnotationParser>(annotationParsers.length);
|
||||
Set<TransactionAnnotationParser> parsers = new LinkedHashSet<>(annotationParsers.length);
|
||||
Collections.addAll(parsers, annotationParsers);
|
||||
this.annotationParsers = parsers;
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -56,7 +56,7 @@ public class JtaTransactionAnnotationParser implements TransactionAnnotationPars
|
||||
RuleBasedTransactionAttribute rbta = new RuleBasedTransactionAttribute();
|
||||
rbta.setPropagationBehaviorName(
|
||||
RuleBasedTransactionAttribute.PREFIX_PROPAGATION + attributes.getEnum("value").toString());
|
||||
ArrayList<RollbackRuleAttribute> rollBackRules = new ArrayList<RollbackRuleAttribute>();
|
||||
ArrayList<RollbackRuleAttribute> rollBackRules = new ArrayList<>();
|
||||
Class<?>[] rbf = attributes.getClassArray("rollbackOn");
|
||||
for (Class<?> rbRule : rbf) {
|
||||
RollbackRuleAttribute rule = new RollbackRuleAttribute(rbRule);
|
||||
|
||||
@@ -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.
|
||||
@@ -61,7 +61,7 @@ public class SpringTransactionAnnotationParser implements TransactionAnnotationP
|
||||
rbta.setTimeout(attributes.getNumber("timeout").intValue());
|
||||
rbta.setReadOnly(attributes.getBoolean("readOnly"));
|
||||
rbta.setQualifier(attributes.getString("value"));
|
||||
ArrayList<RollbackRuleAttribute> rollBackRules = new ArrayList<RollbackRuleAttribute>();
|
||||
ArrayList<RollbackRuleAttribute> rollBackRules = new ArrayList<>();
|
||||
Class<?>[] rbf = attributes.getClassArray("rollbackFor");
|
||||
for (Class<?> rbRule : rbf) {
|
||||
RollbackRuleAttribute rule = new RollbackRuleAttribute(rbRule);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 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.
|
||||
@@ -96,7 +96,7 @@ class TxAdviceBeanDefinitionParser extends AbstractSingleBeanDefinitionParser {
|
||||
private RootBeanDefinition parseAttributeSource(Element attrEle, ParserContext parserContext) {
|
||||
List<Element> methods = DomUtils.getChildElementsByTagName(attrEle, METHOD_ELEMENT);
|
||||
ManagedMap<TypedStringValue, RuleBasedTransactionAttribute> transactionAttributeMap =
|
||||
new ManagedMap<TypedStringValue, RuleBasedTransactionAttribute>(methods.size());
|
||||
new ManagedMap<>(methods.size());
|
||||
transactionAttributeMap.setSource(parserContext.extractSource(attrEle));
|
||||
|
||||
for (Element methodEle : methods) {
|
||||
@@ -127,7 +127,7 @@ class TxAdviceBeanDefinitionParser extends AbstractSingleBeanDefinitionParser {
|
||||
attribute.setReadOnly(Boolean.valueOf(methodEle.getAttribute(READ_ONLY_ATTRIBUTE)));
|
||||
}
|
||||
|
||||
List<RollbackRuleAttribute> rollbackRules = new LinkedList<RollbackRuleAttribute>();
|
||||
List<RollbackRuleAttribute> rollbackRules = new LinkedList<>();
|
||||
if (methodEle.hasAttribute(ROLLBACK_FOR_ATTRIBUTE)) {
|
||||
String rollbackForValue = methodEle.getAttribute(ROLLBACK_FOR_ATTRIBUTE);
|
||||
addRollbackRuleAttributesTo(rollbackRules,rollbackForValue);
|
||||
|
||||
@@ -69,7 +69,7 @@ public abstract class AbstractFallbackTransactionAttributeSource implements Tran
|
||||
* <p>As this base class is not marked Serializable, the cache will be recreated
|
||||
* after serialization - provided that the concrete subclass is Serializable.
|
||||
*/
|
||||
final Map<Object, TransactionAttribute> attributeCache = new ConcurrentHashMap<Object, TransactionAttribute>(1024);
|
||||
final Map<Object, TransactionAttribute> attributeCache = new ConcurrentHashMap<>(1024);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -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.
|
||||
@@ -59,10 +59,10 @@ public class MethodMapTransactionAttributeSource
|
||||
|
||||
/** Map from Method to TransactionAttribute */
|
||||
private final Map<Method, TransactionAttribute> transactionAttributeMap =
|
||||
new HashMap<Method, TransactionAttribute>();
|
||||
new HashMap<>();
|
||||
|
||||
/** Map from Method to name pattern used for registration */
|
||||
private final Map<Method, String> methodNameMap = new HashMap<Method, String>();
|
||||
private final Map<Method, String> methodNameMap = new HashMap<>();
|
||||
|
||||
|
||||
/**
|
||||
@@ -145,7 +145,7 @@ public class MethodMapTransactionAttributeSource
|
||||
String name = clazz.getName() + '.' + mappedName;
|
||||
|
||||
Method[] methods = clazz.getDeclaredMethods();
|
||||
List<Method> matchingMethods = new ArrayList<Method>();
|
||||
List<Method> matchingMethods = new ArrayList<>();
|
||||
for (Method method : methods) {
|
||||
if (isMatch(method.getName(), mappedName)) {
|
||||
matchingMethods.add(method);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 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.
|
||||
@@ -49,7 +49,7 @@ public class NameMatchTransactionAttributeSource implements TransactionAttribute
|
||||
protected static final Log logger = LogFactory.getLog(NameMatchTransactionAttributeSource.class);
|
||||
|
||||
/** Keys are method names; values are TransactionAttributes */
|
||||
private Map<String, TransactionAttribute> nameMap = new HashMap<String, TransactionAttribute>();
|
||||
private Map<String, TransactionAttribute> nameMap = new HashMap<>();
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -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.
|
||||
@@ -78,7 +78,7 @@ public class RuleBasedTransactionAttribute extends DefaultTransactionAttribute i
|
||||
*/
|
||||
public RuleBasedTransactionAttribute(RuleBasedTransactionAttribute other) {
|
||||
super(other);
|
||||
this.rollbackRules = new ArrayList<RollbackRuleAttribute>(other.rollbackRules);
|
||||
this.rollbackRules = new ArrayList<>(other.rollbackRules);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -113,7 +113,7 @@ public class RuleBasedTransactionAttribute extends DefaultTransactionAttribute i
|
||||
*/
|
||||
public List<RollbackRuleAttribute> getRollbackRules() {
|
||||
if (this.rollbackRules == null) {
|
||||
this.rollbackRules = new LinkedList<RollbackRuleAttribute>();
|
||||
this.rollbackRules = new LinkedList<>();
|
||||
}
|
||||
return this.rollbackRules;
|
||||
}
|
||||
|
||||
@@ -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.
|
||||
@@ -82,11 +82,11 @@ public abstract class TransactionAspectSupport implements BeanFactoryAware, Init
|
||||
* single method (as will be the case for around advice).
|
||||
*/
|
||||
private static final ThreadLocal<TransactionInfo> transactionInfoHolder =
|
||||
new NamedThreadLocal<TransactionInfo>("Current aspect-driven transaction");
|
||||
new NamedThreadLocal<>("Current aspect-driven transaction");
|
||||
|
||||
|
||||
private final ConcurrentHashMap<Object, PlatformTransactionManager> transactionManagerCache =
|
||||
new ConcurrentHashMap<Object, PlatformTransactionManager>();
|
||||
new ConcurrentHashMap<>();
|
||||
|
||||
/**
|
||||
* Subclasses can use this to return the current TransactionInfo.
|
||||
|
||||
@@ -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.
|
||||
@@ -285,7 +285,7 @@ public class WebSphereUowTransactionManager extends JtaTransactionManager
|
||||
if (debug) {
|
||||
logger.debug("Invoking WebSphere UOW action: type=" + uowType + ", join=" + joinTx);
|
||||
}
|
||||
UOWActionAdapter<T> action = new UOWActionAdapter<T>(
|
||||
UOWActionAdapter<T> action = new UOWActionAdapter<>(
|
||||
definition, callback, (uowType == UOWManager.UOW_TYPE_GLOBAL_TRANSACTION), !joinTx, newSynch, debug);
|
||||
this.uowManager.runUnderUOW(uowType, joinTx, action);
|
||||
if (debug) {
|
||||
|
||||
@@ -90,9 +90,9 @@ public class SimpleTransactionScope implements Scope {
|
||||
|
||||
static class ScopedObjectsHolder {
|
||||
|
||||
final Map<String, Object> scopedInstances = new HashMap<String, Object>();
|
||||
final Map<String, Object> scopedInstances = new HashMap<>();
|
||||
|
||||
final Map<String, Runnable> destructionCallbacks = new LinkedHashMap<String, Runnable>();
|
||||
final Map<String, Runnable> destructionCallbacks = new LinkedHashMap<>();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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.
|
||||
@@ -78,22 +78,22 @@ public abstract class TransactionSynchronizationManager {
|
||||
private static final Log logger = LogFactory.getLog(TransactionSynchronizationManager.class);
|
||||
|
||||
private static final ThreadLocal<Map<Object, Object>> resources =
|
||||
new NamedThreadLocal<Map<Object, Object>>("Transactional resources");
|
||||
new NamedThreadLocal<>("Transactional resources");
|
||||
|
||||
private static final ThreadLocal<Set<TransactionSynchronization>> synchronizations =
|
||||
new NamedThreadLocal<Set<TransactionSynchronization>>("Transaction synchronizations");
|
||||
new NamedThreadLocal<>("Transaction synchronizations");
|
||||
|
||||
private static final ThreadLocal<String> currentTransactionName =
|
||||
new NamedThreadLocal<String>("Current transaction name");
|
||||
new NamedThreadLocal<>("Current transaction name");
|
||||
|
||||
private static final ThreadLocal<Boolean> currentTransactionReadOnly =
|
||||
new NamedThreadLocal<Boolean>("Current transaction read-only status");
|
||||
new NamedThreadLocal<>("Current transaction read-only status");
|
||||
|
||||
private static final ThreadLocal<Integer> currentTransactionIsolationLevel =
|
||||
new NamedThreadLocal<Integer>("Current transaction isolation level");
|
||||
new NamedThreadLocal<>("Current transaction isolation level");
|
||||
|
||||
private static final ThreadLocal<Boolean> actualTransactionActive =
|
||||
new NamedThreadLocal<Boolean>("Actual transaction active");
|
||||
new NamedThreadLocal<>("Actual transaction active");
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
@@ -177,7 +177,7 @@ public abstract class TransactionSynchronizationManager {
|
||||
Map<Object, Object> map = resources.get();
|
||||
// set ThreadLocal Map if none found
|
||||
if (map == null) {
|
||||
map = new HashMap<Object, Object>();
|
||||
map = new HashMap<>();
|
||||
resources.set(map);
|
||||
}
|
||||
Object oldValue = map.put(actualKey, value);
|
||||
@@ -270,7 +270,7 @@ public abstract class TransactionSynchronizationManager {
|
||||
throw new IllegalStateException("Cannot activate transaction synchronization - already active");
|
||||
}
|
||||
logger.trace("Initializing transaction synchronization");
|
||||
synchronizations.set(new LinkedHashSet<TransactionSynchronization>());
|
||||
synchronizations.set(new LinkedHashSet<>());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -313,7 +313,7 @@ public abstract class TransactionSynchronizationManager {
|
||||
}
|
||||
else {
|
||||
// Sort lazily here, not in registerSynchronization.
|
||||
List<TransactionSynchronization> sortedSynchs = new ArrayList<TransactionSynchronization>(synchs);
|
||||
List<TransactionSynchronization> sortedSynchs = new ArrayList<>(synchs);
|
||||
AnnotationAwareOrderComparator.sort(sortedSynchs);
|
||||
return Collections.unmodifiableList(sortedSynchs);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user