http://git-wip-us.apache.org/repos/asf/tomee/blob/bfb1ed40/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/CmpContainer.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/CmpContainer.java b/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/CmpContainer.java index 27a9454..c187e4b 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/CmpContainer.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/CmpContainer.java @@ -81,14 +81,14 @@ public class CmpContainer implements RpcContainer { /** * Index used for getDeployments() and getDeploymentInfo(deploymentId). */ - protected final Map<Object, BeanContext> deploymentsById = new HashMap<Object, BeanContext>(); + protected final Map<Object, BeanContext> deploymentsById = new HashMap<>(); /** * When events are fired from the CMP engine only an entity bean instance is returned. The type of the bean is used * to find the deployment info. This means that when the same type is used multiple ejb deployments a random deployment * will be selected to handle the ejb callback. */ - protected final Map<Class, BeanContext> beansByClass = new HashMap<Class, BeanContext>(); + protected final Map<Class, BeanContext> beansByClass = new HashMap<>(); /** * The CmpEngine which performs the actual persistence operations @@ -375,7 +375,7 @@ public class CmpContainer implements RpcContainer { //noinspection unchecked Set<EntityBean> registeredEntities = (LinkedHashSet<EntityBean>) synchronizationRegistry.getResource(ENTITIES_TO_STORE); if (registeredEntities == null) { - registeredEntities = new LinkedHashSet<EntityBean>(); + registeredEntities = new LinkedHashSet<>(); synchronizationRegistry.putResource(ENTITIES_TO_STORE, registeredEntities); synchronizationRegistry.registerInterposedSynchronization(new Synchronization() { @Override @@ -708,7 +708,7 @@ public class CmpContainer implements RpcContainer { // of ProxyInfo objects will be returned. If its a single-value find operation then a // single ProxyInfo object is returned. if (callMethod.getReturnType() == Collection.class || callMethod.getReturnType() == Enumeration.class) { - final List<ProxyInfo> proxies = new ArrayList<ProxyInfo>(); + final List<ProxyInfo> proxies = new ArrayList<>(); for (final Object value : results) { final EntityBean bean = (EntityBean) value; @@ -769,10 +769,10 @@ public class CmpContainer implements RpcContainer { final Collection<Object> proxies; if (returnType.equals("java.util.Set")) { // we collect values into a LinkedHashSet to preserve ordering - proxies = new LinkedHashSet<Object>(); + proxies = new LinkedHashSet<>(); } else { // otherwise use a simple array list - proxies = new ArrayList<Object>(); + proxies = new ArrayList<>(); } final boolean isSingleValued = !returnType.equals("java.util.Collection") && !returnType.equals("java.util.Set");
http://git-wip-us.apache.org/repos/asf/tomee/blob/bfb1ed40/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/ComplexKeyGenerator.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/ComplexKeyGenerator.java b/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/ComplexKeyGenerator.java index bfc0975..bd9ec4a 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/ComplexKeyGenerator.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/ComplexKeyGenerator.java @@ -32,7 +32,7 @@ public class ComplexKeyGenerator extends AbstractKeyGenerator { public ComplexKeyGenerator(final Class entityBeanClass, final Class pkClass) throws OpenEJBException { this.pkClass = pkClass; - final List<ComplexKeyGenerator.PkField> fields = new ArrayList<PkField>(); + final List<ComplexKeyGenerator.PkField> fields = new ArrayList<>(); for (final Field pkObjectField : pkClass.getFields()) { if (isValidPkField(pkObjectField)) { final Field entityBeanField = getField(entityBeanClass, pkObjectField.getName()); http://git-wip-us.apache.org/repos/asf/tomee/blob/bfb1ed40/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/Cmp2Generator.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/Cmp2Generator.java b/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/Cmp2Generator.java index 80d447a..f2225b6 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/Cmp2Generator.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/Cmp2Generator.java @@ -48,11 +48,11 @@ public class Cmp2Generator implements Opcodes { private final String implClassName; private final String beanClassName; private final ClassWriter cw; - private final Map<String, CmpField> cmpFields = new LinkedHashMap<String, CmpField>(); - private final Collection<CmrField> cmrFields = new ArrayList<CmrField>(); + private final Map<String, CmpField> cmpFields = new LinkedHashMap<>(); + private final Collection<CmrField> cmrFields = new ArrayList<>(); private final CmpField pkField; private final Class primKeyClass; - private final List<Method> selectMethods = new ArrayList<Method>(); + private final List<Method> selectMethods = new ArrayList<>(); private final Class beanClass; private final PostCreateGenerator postCreateGenerator; private static final String DELETED = "openejb_deleted"; @@ -1066,7 +1066,7 @@ public class Cmp2Generator implements Opcodes { } private static String[] getExceptionTypes(final Method method) { - final List<String> types = new ArrayList<String>(method.getExceptionTypes().length); + final List<String> types = new ArrayList<>(method.getExceptionTypes().length); for (final Class<?> exceptionType : method.getExceptionTypes()) { types.add(Type.getInternalName(exceptionType)); } http://git-wip-us.apache.org/repos/asf/tomee/blob/bfb1ed40/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/CmrSet.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/CmrSet.java b/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/CmrSet.java index 8d0dc85..20a3249 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/CmrSet.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/CmrSet.java @@ -214,7 +214,7 @@ public class CmrSet<Bean extends EntityBean, Proxy extends EJBLocalObject> exten return null; } - final Set<Bean> entities = new HashSet<Bean>(); + final Set<Bean> entities = new HashSet<>(); for (final Object value : proxies) { if (type != null && !type.isInstance(value)) { throw new IllegalArgumentException("Object is not an instance of " + type.getName() + http://git-wip-us.apache.org/repos/asf/tomee/blob/bfb1ed40/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/SetValuedCmr.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/SetValuedCmr.java b/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/SetValuedCmr.java index 9fe9671..b317a47 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/SetValuedCmr.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/cmp2/SetValuedCmr.java @@ -76,7 +76,7 @@ public class SetValuedCmr<Bean extends EntityBean, Proxy extends EJBLocalObject> } if (cmrSet == null) { - cmrSet = new CmrSet<Bean, Proxy>(source, sourceProperty, relatedInfo, relatedProperty, others); + cmrSet = new CmrSet<>(source, sourceProperty, relatedInfo, relatedProperty, others); try { transactionRegistry.putResource(this, cmrSet); } catch (final IllegalStateException ignored) { http://git-wip-us.apache.org/repos/asf/tomee/blob/bfb1ed40/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/jpa/JpaCmpEngine.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/jpa/JpaCmpEngine.java b/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/jpa/JpaCmpEngine.java index 2b4a885..97e0477 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/jpa/JpaCmpEngine.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/core/cmp/jpa/JpaCmpEngine.java @@ -68,7 +68,7 @@ public class JpaCmpEngine implements CmpEngine { */ private final ThreadLocal<Set<EntityBean>> creating = new ThreadLocal<Set<EntityBean>>() { protected Set<EntityBean> initialValue() { - return new HashSet<EntityBean>(); + return new HashSet<>(); } }; http://git-wip-us.apache.org/repos/asf/tomee/blob/bfb1ed40/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntityContainer.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntityContainer.java b/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntityContainer.java index 6b7f685..a4ba406 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntityContainer.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntityContainer.java @@ -69,7 +69,7 @@ public class EntityContainer implements RpcContainer { private final EntityInstanceManager instanceManager; - private final Map<String, BeanContext> deploymentRegistry = new HashMap<String, BeanContext>(); + private final Map<String, BeanContext> deploymentRegistry = new HashMap<>(); private final Object containerID; @@ -387,7 +387,7 @@ public class EntityContainer implements RpcContainer { */ if (returnValue instanceof Collection) { final Iterator keys = ((Collection) returnValue).iterator(); - final Vector<ProxyInfo> proxies = new Vector<ProxyInfo>(); + final Vector<ProxyInfo> proxies = new Vector<>(); while (keys.hasNext()) { final Object primaryKey = keys.next(); proxies.addElement(new ProxyInfo(beanContext, primaryKey)); @@ -395,7 +395,7 @@ public class EntityContainer implements RpcContainer { returnValue = proxies; } else if (returnValue instanceof Enumeration) { final Enumeration keys = (Enumeration) returnValue; - final Vector<ProxyInfo> proxies = new Vector<ProxyInfo>(); + final Vector<ProxyInfo> proxies = new Vector<>(); while (keys.hasMoreElements()) { final Object primaryKey = keys.nextElement(); proxies.addElement(new ProxyInfo(beanContext, primaryKey)); http://git-wip-us.apache.org/repos/asf/tomee/blob/bfb1ed40/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntityContext.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntityContext.java b/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntityContext.java index 6e31151..74b7554 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntityContext.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntityContext.java @@ -51,7 +51,7 @@ public class EntityContext extends BaseContext implements javax.ejb.EntityContex throw new IllegalStateException("EJB " + di.getDeploymentID() + " does not have a local interface"); } - final EjbObjectProxyHandler handler = new EntityEjbObjectHandler(di, threadContext.getPrimaryKey(), InterfaceType.EJB_LOCAL, new ArrayList<Class>(), di.getLocalInterface()); + final EjbObjectProxyHandler handler = new EntityEjbObjectHandler(di, threadContext.getPrimaryKey(), InterfaceType.EJB_LOCAL, new ArrayList<>(), di.getLocalInterface()); try { final Class[] interfaces = new Class[]{di.getLocalInterface(), IntraVmProxy.class}; @@ -71,7 +71,7 @@ public class EntityContext extends BaseContext implements javax.ejb.EntityContex throw new IllegalStateException("EJB " + di.getDeploymentID() + " does not have a remote interface"); } - final EjbObjectProxyHandler handler = new EntityEjbObjectHandler(di.getContainer().getBeanContext(di.getDeploymentID()), threadContext.getPrimaryKey(), InterfaceType.EJB_OBJECT, new ArrayList<Class>(), di.getRemoteInterface()); + final EjbObjectProxyHandler handler = new EntityEjbObjectHandler(di.getContainer().getBeanContext(di.getDeploymentID()), threadContext.getPrimaryKey(), InterfaceType.EJB_OBJECT, new ArrayList<>(), di.getRemoteInterface()); try { final Class[] interfaces = new Class[]{di.getRemoteInterface(), IntraVmProxy.class}; return (EJBObject) ProxyManager.newProxyInstance(interfaces, handler); http://git-wip-us.apache.org/repos/asf/tomee/blob/bfb1ed40/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntityInstanceManager.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntityInstanceManager.java b/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntityInstanceManager.java index 1c0e8da..6b4fd84 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntityInstanceManager.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntityInstanceManager.java @@ -61,7 +61,7 @@ public class EntityInstanceManager { public EntityInstanceManager(final EntityContainer container, final SecurityService securityService, final int poolSize) { this.securityService = securityService; this.poolsize = poolSize; - poolMap = new HashMap<Object, LinkedListStack>();// put size in later + poolMap = new HashMap<>();// put size in later final BeanContext[] beanContexts = container.getBeanContexts(); for (final BeanContext beanContext : beanContexts) { http://git-wip-us.apache.org/repos/asf/tomee/blob/bfb1ed40/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntrancyTracker.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntrancyTracker.java b/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntrancyTracker.java index 37a3b5d..eba1ea7 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntrancyTracker.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/core/entity/EntrancyTracker.java @@ -32,7 +32,7 @@ public class EntrancyTracker { */ private final ThreadLocal<Set<InstanceKey>> inCallThreadLocal = new ThreadLocal<Set<InstanceKey>>() { protected Set<InstanceKey> initialValue() { - return new HashSet<InstanceKey>(); + return new HashSet<>(); } }; @@ -56,7 +56,7 @@ public class EntrancyTracker { //noinspection unchecked inCall = (Set<InstanceKey>) synchronizationRegistry.getResource(EntrancyTracker.class); if (inCall == null) { - inCall = new HashSet<InstanceKey>(); + inCall = new HashSet<>(); synchronizationRegistry.putResource(EntrancyTracker.class, inCall); } } catch (final IllegalStateException e) { http://git-wip-us.apache.org/repos/asf/tomee/blob/bfb1ed40/container/openejb-core/src/main/java/org/apache/openejb/core/interceptor/InterceptorData.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/main/java/org/apache/openejb/core/interceptor/InterceptorData.java b/container/openejb-core/src/main/java/org/apache/openejb/core/interceptor/InterceptorData.java index 2af1735..a70f60f 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/core/interceptor/InterceptorData.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/core/interceptor/InterceptorData.java @@ -53,21 +53,21 @@ public class InterceptorData { private final Class clazz; private final CdiInterceptorBean cdiInterceptorBean; - private final Set<Method> aroundInvoke = new LinkedHashSet<Method>(); + private final Set<Method> aroundInvoke = new LinkedHashSet<>(); - private final Set<Method> postConstruct = new LinkedHashSet<Method>(); - private final Set<Method> preDestroy = new LinkedHashSet<Method>(); + private final Set<Method> postConstruct = new LinkedHashSet<>(); + private final Set<Method> preDestroy = new LinkedHashSet<>(); - private final Set<Method> postActivate = new LinkedHashSet<Method>(); - private final Set<Method> prePassivate = new LinkedHashSet<Method>(); + private final Set<Method> postActivate = new LinkedHashSet<>(); + private final Set<Method> prePassivate = new LinkedHashSet<>(); - private final Set<Method> afterBegin = new LinkedHashSet<Method>(); - private final Set<Method> beforeCompletion = new LinkedHashSet<Method>(); - private final Set<Method> afterCompletion = new LinkedHashSet<Method>(); + private final Set<Method> afterBegin = new LinkedHashSet<>(); + private final Set<Method> beforeCompletion = new LinkedHashSet<>(); + private final Set<Method> afterCompletion = new LinkedHashSet<>(); - private final Set<Method> aroundTimeout = new LinkedHashSet<Method>(); + private final Set<Method> aroundTimeout = new LinkedHashSet<>(); - private final Map<Class<?>, Object> data = new HashMap<Class<?>, Object>(); + private final Map<Class<?>, Object> data = new HashMap<>(); public InterceptorData(final Class clazz) { this.clazz = clazz; http://git-wip-us.apache.org/repos/asf/tomee/blob/bfb1ed40/container/openejb-core/src/main/java/org/apache/openejb/core/interceptor/InterceptorStack.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/main/java/org/apache/openejb/core/interceptor/InterceptorStack.java b/container/openejb-core/src/main/java/org/apache/openejb/core/interceptor/InterceptorStack.java index b718091..4efa91e 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/core/interceptor/InterceptorStack.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/core/interceptor/InterceptorStack.java @@ -48,7 +48,7 @@ public class InterceptorStack { this.targetMethod = targetMethod; this.operation = operation; - interceptors = new ArrayList<Interceptor>(interceptorDatas.size()); + interceptors = new ArrayList<>(interceptorDatas.size()); for (final InterceptorData interceptorData : interceptorDatas) { final Class interceptorClass = interceptorData.getInterceptorClass(); http://git-wip-us.apache.org/repos/asf/tomee/blob/bfb1ed40/container/openejb-core/src/main/java/org/apache/openejb/core/interceptor/ReflectionInvocationContext.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/main/java/org/apache/openejb/core/interceptor/ReflectionInvocationContext.java b/container/openejb-core/src/main/java/org/apache/openejb/core/interceptor/ReflectionInvocationContext.java index e1dd668..c97e653 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/core/interceptor/ReflectionInvocationContext.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/core/interceptor/ReflectionInvocationContext.java @@ -37,7 +37,7 @@ public class ReflectionInvocationContext implements InvocationContext { private final Object target; private final Method method; private final Object[] parameters; - private final Map<String, Object> contextData = new TreeMap<String, Object>(); + private final Map<String, Object> contextData = new TreeMap<>(); private final Class<?>[] parameterTypes; private final Operation operation; http://git-wip-us.apache.org/repos/asf/tomee/blob/bfb1ed40/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/BaseEjbProxyHandler.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/BaseEjbProxyHandler.java b/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/BaseEjbProxyHandler.java index 309b359..98189ab 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/BaseEjbProxyHandler.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/BaseEjbProxyHandler.java @@ -139,7 +139,7 @@ public abstract class BaseEjbProxyHandler implements InvocationHandler, Serializ if (interfaces == null || interfaces.size() == 0) { final InterfaceType objectInterfaceType = interfaceType.isHome() ? interfaceType.getCounterpart() : interfaceType; - interfaces = new ArrayList<Class>(beanContext.getInterfaces(objectInterfaceType)); + interfaces = new ArrayList<>(beanContext.getInterfaces(objectInterfaceType)); } if (mainInterface == null && interfaces.size() == 1) { @@ -226,12 +226,12 @@ public abstract class BaseEjbProxyHandler implements InvocationHandler, Serializ } private void setMainInterface(final Class referent) { - mainInterface = new WeakReference<Class>(referent); + mainInterface = new WeakReference<>(referent); } public List<Class> getInterfaces() { final Set<Class> classes = interfaces.keySet(); - final List<Class> list = new ArrayList<Class>(); + final List<Class> list = new ArrayList<>(); final ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); for (final Class<?> clazz : classes) { // convert interfaces with current classloader -> relevant for remote interfaces if (clazz.isInterface() && getBeanContext().getInterfaceType(clazz) == InterfaceType.BUSINESS_REMOTE) { @@ -248,7 +248,7 @@ public abstract class BaseEjbProxyHandler implements InvocationHandler, Serializ } private void setInterfaces(final List<Class> interfaces) { - this.interfaces = new WeakHashMap<Class, Object>(interfaces.size()); + this.interfaces = new WeakHashMap<>(interfaces.size()); for (final Class clazz : interfaces) { this.interfaces.put(clazz, null); } @@ -663,7 +663,7 @@ public abstract class BaseEjbProxyHandler implements InvocationHandler, Serializ } public void setBeanContext(final BeanContext beanContext) { - this.beanContextRef = new WeakReference<BeanContext>(beanContext); + this.beanContextRef = new WeakReference<>(beanContext); } public ConcurrentMap getLiveHandleRegistry() { http://git-wip-us.apache.org/repos/asf/tomee/blob/bfb1ed40/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/EjbHomeProxyHandler.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/EjbHomeProxyHandler.java b/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/EjbHomeProxyHandler.java index dc43d7c..5e3d344 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/EjbHomeProxyHandler.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/EjbHomeProxyHandler.java @@ -71,7 +71,7 @@ public abstract class EjbHomeProxyHandler extends BaseEjbProxyHandler { public EjbHomeProxyHandler(final BeanContext beanContext, final InterfaceType interfaceType, final List<Class> interfaces, final Class mainInterface) { super(beanContext, null, interfaceType, interfaces, mainInterface); - dispatchTable = new HashMap<String, MethodType>(); + dispatchTable = new HashMap<>(); dispatchTable.put("create", MethodType.CREATE); dispatchTable.put("getEJBMetaData", MethodType.META_DATA); dispatchTable.put("getHomeHandle", MethodType.HOME_HANDLE); @@ -129,7 +129,7 @@ public abstract class EjbHomeProxyHandler extends BaseEjbProxyHandler { try { final EjbHomeProxyHandler handler = createHomeHandler(beanContext, interfaceType, objectInterfaces, mainInterface); - final List<Class> proxyInterfaces = new ArrayList<Class>(2); + final List<Class> proxyInterfaces = new ArrayList<>(2); final Class homeInterface = beanContext.getInterface(interfaceType); proxyInterfaces.add(homeInterface); @@ -157,7 +157,7 @@ public abstract class EjbHomeProxyHandler extends BaseEjbProxyHandler { && !getBeanContext().isDynamicallyImplemented()) { return LocalBeanProxyFactory.constructProxy(handler.getBeanContext().get(BeanContext.ProxyClass.class).getProxy(), handler); } else { - final List<Class> proxyInterfaces = new ArrayList<Class>(handler.getInterfaces().size() + 2); + final List<Class> proxyInterfaces = new ArrayList<>(handler.getInterfaces().size() + 2); proxyInterfaces.addAll(handler.getInterfaces()); proxyInterfaces.add(Serializable.class); proxyInterfaces.add(IntraVmProxy.class); http://git-wip-us.apache.org/repos/asf/tomee/blob/bfb1ed40/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/EjbObjectProxyHandler.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/EjbObjectProxyHandler.java b/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/EjbObjectProxyHandler.java index f5a37a2..282e4f8 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/EjbObjectProxyHandler.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/EjbObjectProxyHandler.java @@ -50,7 +50,7 @@ public abstract class EjbObjectProxyHandler extends BaseEjbProxyHandler { static final Map<String, Integer> dispatchTable; static { - dispatchTable = new HashMap<String, Integer>(); + dispatchTable = new HashMap<>(); dispatchTable.put("getHandle", 1); dispatchTable.put("getPrimaryKey", 2); dispatchTable.put("isIdentical", 3); http://git-wip-us.apache.org/repos/asf/tomee/blob/bfb1ed40/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/IntraVmArtifact.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/IntraVmArtifact.java b/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/IntraVmArtifact.java index b053bb7..1800f11 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/IntraVmArtifact.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/IntraVmArtifact.java @@ -89,7 +89,7 @@ public class IntraVmArtifact implements Externalizable { } private static class Handles { - private final List<Object> list = new ArrayList<Object>(); + private final List<Object> list = new ArrayList<>(); public int add(final Object obj) { final int id = list.size(); http://git-wip-us.apache.org/repos/asf/tomee/blob/bfb1ed40/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/AbstractThreadLocalProxy.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/AbstractThreadLocalProxy.java b/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/AbstractThreadLocalProxy.java index 0e82ff8..e148b94 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/AbstractThreadLocalProxy.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/AbstractThreadLocalProxy.java @@ -22,7 +22,7 @@ package org.apache.openejb.core.ivm.naming; */ public class AbstractThreadLocalProxy<T> { - private final ThreadLocal<T> infos = new ThreadLocal<T>(); + private final ThreadLocal<T> infos = new ThreadLocal<>(); protected AbstractThreadLocalProxy() { // no-op http://git-wip-us.apache.org/repos/asf/tomee/blob/bfb1ed40/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/ContextualJndiReference.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/ContextualJndiReference.java b/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/ContextualJndiReference.java index 218efe8..f8da6b9 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/ContextualJndiReference.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/ContextualJndiReference.java @@ -40,7 +40,7 @@ public class ContextualJndiReference extends IntraVmJndiReference { }; private Object defaultValue; - private final List<String> prefixes = new CopyOnWriteArrayList<String>(); + private final List<String> prefixes = new CopyOnWriteArrayList<>(); public ContextualJndiReference(final String jndiName) { super(jndiName); @@ -104,7 +104,7 @@ public class ContextualJndiReference extends IntraVmJndiReference { } } - final Collection<Object> values = new ArrayList<Object>(); + final Collection<Object> values = new ArrayList<>(); for (final String p : prefixes) { if (p != null && !p.isEmpty()) { try { http://git-wip-us.apache.org/repos/asf/tomee/blob/bfb1ed40/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/IvmContext.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/IvmContext.java b/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/IvmContext.java index 087fbf9..3a6d985 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/IvmContext.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/IvmContext.java @@ -72,7 +72,7 @@ public class IvmContext implements Context, Serializable { private static final long serialVersionUID = -626353930051783641L; Hashtable<String, Object> myEnv; boolean readOnly; - Map<String, Object> fastCache = new ConcurrentHashMap<String, Object>(); + Map<String, Object> fastCache = new ConcurrentHashMap<>(); static final String JNDI_EXCEPTION_ON_FAILED_WRITE = "openejb.jndiExceptionOnFailedWrite"; public NameNode mynode; @@ -215,7 +215,7 @@ public class IvmContext implements Context, Serializable { public static ObjectFactory[] getFederatedFactories() throws NamingException { if (federatedFactories == null) { - final Set<ObjectFactory> factories = new HashSet<ObjectFactory>(); + final Set<ObjectFactory> factories = new HashSet<>(); final String urlPackagePrefixes = getUrlPackagePrefixes(); if (urlPackagePrefixes == null) { return new ObjectFactory[0]; @@ -471,7 +471,7 @@ public class IvmContext implements Context, Serializable { public Object addToEnvironment(final String propName, final Object propVal) throws NamingException { if (myEnv == null) { - myEnv = new Hashtable<String, Object>(5); + myEnv = new Hashtable<>(5); } return myEnv.put(propName, propVal); } http://git-wip-us.apache.org/repos/asf/tomee/blob/bfb1ed40/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/JaxWsServiceReference.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/JaxWsServiceReference.java b/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/JaxWsServiceReference.java index 3be9fb4..fbf0e80 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/JaxWsServiceReference.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/core/ivm/naming/JaxWsServiceReference.java @@ -51,11 +51,11 @@ public class JaxWsServiceReference extends Reference { private final Class<? extends Service> serviceClass; private final Class<?> referenceClass; private final URL wsdlUrl; - private final List<HandlerChainData> handlerChains = new ArrayList<HandlerChainData>(); + private final List<HandlerChainData> handlerChains = new ArrayList<>(); private final Collection<Injection> injections; private final Properties properties; private PortAddressRegistry portAddressRegistry; - private final List<PortRefData> portRefs = new ArrayList<PortRefData>(); + private final List<PortRefData> portRefs = new ArrayList<>(); public JaxWsServiceReference(final String id, final QName serviceQName, final Class<? extends Service> serviceClass, final QName portQName, final Class<?> referenceClass, final URL wsdlUrl, @@ -96,8 +96,8 @@ public class JaxWsServiceReference extends Reference { } // add the port addresses to the portRefData - final Map<QName, PortRefData> portsByQName = new HashMap<QName, PortRefData>(); - final List<PortRefData> ports = new ArrayList<PortRefData>(portRefs.size() + portAddresses.size()); + final Map<QName, PortRefData> portsByQName = new HashMap<>(); + final List<PortRefData> ports = new ArrayList<>(portRefs.size() + portAddresses.size()); for (final PortRefData portRef : portRefs) { final PortRefData port = new PortRefData(portRef); if (port.getQName() != null) { http://git-wip-us.apache.org/repos/asf/tomee/blob/bfb1ed40/container/openejb-core/src/main/java/org/apache/openejb/core/managed/Instance.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/main/java/org/apache/openejb/core/managed/Instance.java b/container/openejb-core/src/main/java/org/apache/openejb/core/managed/Instance.java index e02456b..5b1d4f5 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/core/managed/Instance.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/core/managed/Instance.java @@ -47,7 +47,7 @@ public class Instance implements Serializable { private boolean inUse; private SuspendedTransaction beanTransaction; - private final Stack<Transaction> transaction = new Stack<Transaction>(); + private final Stack<Transaction> transaction = new Stack<>(); private final ReentrantLock lock = new ReentrantLock(); // todo if we keyed by an entity manager factory id we would not have to make this transient and rebuild the index below @@ -162,7 +162,7 @@ public class Instance implements Serializable { bean = toSerializable(i.bean); creationalContext = i.creationalContext; - interceptors = new HashMap<String, Object>(i.interceptors.size()); + interceptors = new HashMap<>(i.interceptors.size()); for (final Map.Entry<String, Object> e : i.interceptors.entrySet()) { if (e.getValue() == i.bean) { // need to use the same wrapped reference or well get two copies. http://git-wip-us.apache.org/repos/asf/tomee/blob/bfb1ed40/container/openejb-core/src/main/java/org/apache/openejb/core/managed/ManagedContainer.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/main/java/org/apache/openejb/core/managed/ManagedContainer.java b/container/openejb-core/src/main/java/org/apache/openejb/core/managed/ManagedContainer.java index 90e0527..f52e9f0 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/core/managed/ManagedContainer.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/core/managed/ManagedContainer.java @@ -95,14 +95,14 @@ public class ManagedContainer implements RpcContainer { /** * Index used for getDeployments() and getDeploymentInfo(deploymentId). */ - protected final Map<Object, BeanContext> deploymentsById = new HashMap<Object, BeanContext>(); + protected final Map<Object, BeanContext> deploymentsById = new HashMap<>(); protected final Cache<Object, Instance> cache; - private final ConcurrentHashMap<Object, Instance> checkedOutInstances = new ConcurrentHashMap<Object, Instance>(); + private final ConcurrentHashMap<Object, Instance> checkedOutInstances = new ConcurrentHashMap<>(); private final SessionContext sessionContext; public ManagedContainer(final Object id, final SecurityService securityService) throws SystemException { - this.cache = new SimpleCache<Object, Instance>(null, new SimplePassivater(), 1000, 50, new Duration("1 hour")); + this.cache = new SimpleCache<>(null, new SimplePassivater(), 1000, 50, new Duration("1 hour")); this.containerID = id; this.securityService = securityService; cache.setListener(new StatefulCacheListener()); @@ -110,7 +110,7 @@ public class ManagedContainer implements RpcContainer { } private Map<Method, MethodType> getLifecycleMethodsOfInterface(final BeanContext beanContext) { - final Map<Method, MethodType> methods = new HashMap<Method, MethodType>(); + final Map<Method, MethodType> methods = new HashMap<>(); try { methods.put(BeanContext.Removable.class.getDeclaredMethod("$$remove"), MethodType.REMOVE); @@ -286,7 +286,7 @@ public class ManagedContainer implements RpcContainer { deploymentsById.put(beanContext.getDeploymentID(), beanContext); beanContext.setContainer(this); - final Data data = new Data(new Index<Method, MethodType>(methods)); + final Data data = new Data(new Index<>(methods)); beanContext.setContainerData(data); // Create stats interceptor @@ -418,7 +418,7 @@ public class ManagedContainer implements RpcContainer { createContext.set(Method.class, createOrInit); // Initialize interceptor stack - final InterceptorStack interceptorStack = new InterceptorStack(instance.bean, createOrInit, Operation.CREATE, new ArrayList<InterceptorData>(), new HashMap<String, Object>()); + final InterceptorStack interceptorStack = new InterceptorStack(instance.bean, createOrInit, Operation.CREATE, new ArrayList<>(), new HashMap<>()); // Invoke if (args == null) { @@ -780,7 +780,7 @@ public class ManagedContainer implements RpcContainer { final Index<EntityManagerFactory, BeanContext.EntityManagerConfiguration> factories = beanContext.getExtendedEntityManagerFactories(); Index<EntityManagerFactory, JtaEntityManagerRegistry.EntityManagerTracker> entityManagers = null; if (factories != null && factories.size() > 0) { - entityManagers = new Index<EntityManagerFactory, JtaEntityManagerRegistry.EntityManagerTracker>(new ArrayList<EntityManagerFactory>(factories.keySet())); + entityManagers = new Index<>(new ArrayList<>(factories.keySet())); for (final Map.Entry<EntityManagerFactory, BeanContext.EntityManagerConfiguration> entry : factories.entrySet()) { final EntityManagerFactory entityManagerFactory = entry.getKey(); @@ -879,7 +879,7 @@ public class ManagedContainer implements RpcContainer { */ private final class SessionSynchronizationCoordinator implements TransactionSynchronization { - private final Map<Object, Synchronization> registry = new HashMap<Object, Synchronization>(); + private final Map<Object, Synchronization> registry = new HashMap<>(); private final TransactionPolicy txPolicy; private SessionSynchronizationCoordinator(final TransactionPolicy txPolicy) { @@ -1119,7 +1119,7 @@ public class ManagedContainer implements RpcContainer { private static final class Data { private final Index<Method, MethodType> methodIndex; - private final List<ObjectName> jmxNames = new ArrayList<ObjectName>(); + private final List<ObjectName> jmxNames = new ArrayList<>(); private Data(final Index<Method, MethodType> methodIndex) { this.methodIndex = methodIndex; http://git-wip-us.apache.org/repos/asf/tomee/blob/bfb1ed40/container/openejb-core/src/main/java/org/apache/openejb/core/managed/SimpleCache.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/main/java/org/apache/openejb/core/managed/SimpleCache.java b/container/openejb-core/src/main/java/org/apache/openejb/core/managed/SimpleCache.java index c3a10ba..26db711 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/core/managed/SimpleCache.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/core/managed/SimpleCache.java @@ -39,12 +39,12 @@ public class SimpleCache<K, V> implements Cache<K, V> { /** * Map of all known values by key */ - private final ConcurrentHashMap<K, Entry> cache = new ConcurrentHashMap<K, Entry>(); + private final ConcurrentHashMap<K, Entry> cache = new ConcurrentHashMap<>(); /** * All values not in use in least resently used order */ - private final Queue<Entry> lru = new LinkedBlockingQueue<Entry>(); + private final Queue<Entry> lru = new LinkedBlockingQueue<>(); /** * Notified when values are loaded, stored, or timedOut @@ -346,8 +346,8 @@ public class SimpleCache<K, V> implements Cache<K, V> { // if there are to many beans in the lru, shink is by on bulkPassivate size // bulkPassivate size is just an estimate, as locked or timed out beans are skipped if (lru.size() >= getCapacity()) { - final Map<K, V> valuesToStore = new LinkedHashMap<K, V>(); - final List<Entry> entries = new ArrayList<Entry>(); + final Map<K, V> valuesToStore = new LinkedHashMap<>(); + final List<Entry> entries = new ArrayList<>(); int bulkPassivate = getBulkPassivate(); if (bulkPassivate < 1) { http://git-wip-us.apache.org/repos/asf/tomee/blob/bfb1ed40/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/EndpointFactory.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/EndpointFactory.java b/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/EndpointFactory.java index cc0b0e2..b785b07 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/EndpointFactory.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/EndpointFactory.java @@ -43,7 +43,7 @@ public class EndpointFactory implements MessageEndpointFactory { private final ClassLoader classLoader; private final Class[] interfaces; private final XAResourceWrapper xaResourceWrapper; - protected final List<ObjectName> jmxNames = new ArrayList<ObjectName>(); + protected final List<ObjectName> jmxNames = new ArrayList<>(); private final Class<?> proxy; private final boolean usePool; http://git-wip-us.apache.org/repos/asf/tomee/blob/bfb1ed40/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/MdbContainer.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/MdbContainer.java b/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/MdbContainer.java index bfbc65a..bbf1b4c 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/MdbContainer.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/MdbContainer.java @@ -103,7 +103,7 @@ public class MdbContainer implements RpcContainer, BaseMdbContainer { private final int instanceLimit; private final boolean failOnUnknownActivationSpec; - private final ConcurrentMap<Object, BeanContext> deployments = new ConcurrentHashMap<Object, BeanContext>(); + private final ConcurrentMap<Object, BeanContext> deployments = new ConcurrentHashMap<>(); private final XAResourceWrapper xaResourceWrapper; private final InboundRecovery inboundRecovery; @@ -272,7 +272,7 @@ public class MdbContainer implements RpcContainer, BaseMdbContainer { final ActivationSpec activationSpec = (ActivationSpec) objectRecipe.create(activationSpecClass.getClassLoader()); // verify all properties except "destination" and "destinationType" were consumed - final Set<String> unusedProperties = new TreeSet<String>(objectRecipe.getUnsetProperties().keySet()); + final Set<String> unusedProperties = new TreeSet<>(objectRecipe.getUnsetProperties().keySet()); unusedProperties.remove("destination"); unusedProperties.remove("destinationType"); unusedProperties.remove("destinationLookup"); http://git-wip-us.apache.org/repos/asf/tomee/blob/bfb1ed40/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/MdbInstanceManager.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/MdbInstanceManager.java b/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/MdbInstanceManager.java index 9210c7b..2dc885e 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/MdbInstanceManager.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/MdbInstanceManager.java @@ -112,7 +112,7 @@ public class MdbInstanceManager { private final Map<BeanContext, MdbPoolContainer.MdbActivationContext> activationContexts = new ConcurrentHashMap<>(); private final Map<BeanContext, ObjectName> mbeanNames = new ConcurrentHashMap<>(); - protected final List<ObjectName> jmxNames = new ArrayList<ObjectName>(); + protected final List<ObjectName> jmxNames = new ArrayList<>(); private final ResourceAdapter resourceAdapter; private final InboundRecovery inboundRecovery; private final Object containerID; @@ -142,7 +142,7 @@ public class MdbInstanceManager { final ThreadFactory threadFactory = new DaemonThreadFactory("InstanceManagerPool.worker."); this.executor = new ThreadPoolExecutor( callbackThreads, callbackThreads * 2, - 1L, TimeUnit.MINUTES, new LinkedBlockingQueue<Runnable>(qsize), threadFactory); + 1L, TimeUnit.MINUTES, new LinkedBlockingQueue<>(qsize), threadFactory); this.executor.setRejectedExecutionHandler(new RejectedExecutionHandler() { @Override @@ -665,7 +665,7 @@ public class MdbInstanceManager { private final Pool<Instance> pool; private final Duration accessTimeout; private final Duration closeTimeout; - private final List<ObjectName> jmxNames = new ArrayList<ObjectName>(); + private final List<ObjectName> jmxNames = new ArrayList<>(); private BaseContext baseContext; public Data(final Pool<Instance> pool, final Duration accessTimeout, final Duration closeTimeout) { http://git-wip-us.apache.org/repos/asf/tomee/blob/bfb1ed40/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/MdbPoolContainer.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/MdbPoolContainer.java b/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/MdbPoolContainer.java index d8d50b2..f4b1b94 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/MdbPoolContainer.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/MdbPoolContainer.java @@ -78,7 +78,7 @@ public class MdbPoolContainer implements RpcContainer, BaseMdbContainer { private final Class activationSpecClass; private final boolean failOnUnknownActivationSpec; private final MdbInstanceManager instanceManager; - private final ConcurrentMap<Object, BeanContext> deployments = new ConcurrentHashMap<Object, BeanContext>(); + private final ConcurrentMap<Object, BeanContext> deployments = new ConcurrentHashMap<>(); private final XAResourceWrapper xaResourceWrapper; private final InboundRecovery inboundRecovery; @@ -193,7 +193,7 @@ public class MdbPoolContainer implements RpcContainer, BaseMdbContainer { final ActivationSpec activationSpec = (ActivationSpec) objectRecipe.create(activationSpecClass.getClassLoader()); // verify all properties except "destination" and "destinationType" were consumed - final Set<String> unusedProperties = new TreeSet<String>(objectRecipe.getUnsetProperties().keySet()); + final Set<String> unusedProperties = new TreeSet<>(objectRecipe.getUnsetProperties().keySet()); unusedProperties.remove("destination"); unusedProperties.remove("destinationType"); unusedProperties.remove("destinationLookup"); http://git-wip-us.apache.org/repos/asf/tomee/blob/bfb1ed40/container/openejb-core/src/main/java/org/apache/openejb/core/security/AbstractSecurityService.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/main/java/org/apache/openejb/core/security/AbstractSecurityService.java b/container/openejb-core/src/main/java/org/apache/openejb/core/security/AbstractSecurityService.java index 233db15..ff62082 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/core/security/AbstractSecurityService.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/core/security/AbstractSecurityService.java @@ -136,7 +136,7 @@ public abstract class AbstractSecurityService implements DestroyableResource, Se @Override public Set<String> getLogicalRoles(final Principal[] principals, final Set<String> logicalRoles) { - final LinkedHashSet<String> roles = new LinkedHashSet<String>(principals.length); + final LinkedHashSet<String> roles = new LinkedHashSet<>(principals.length); for (final Principal principal : principals) { final String name = principal.getName(); if (logicalRoles.contains(name)) { @@ -379,7 +379,7 @@ public abstract class AbstractSecurityService implements DestroyableResource, Se final Group group = new Group(groupName); group.addMember(user); - final HashSet<Principal> principals = new HashSet<Principal>(); + final HashSet<Principal> principals = new HashSet<>(); principals.add(user); principals.add(group); @@ -455,7 +455,7 @@ public abstract class AbstractSecurityService implements DestroyableResource, Se public static class Group implements java.security.acl.Group { - private final List<Principal> members = new ArrayList<Principal>(); + private final List<Principal> members = new ArrayList<>(); private final String name; public Group(final String name) { http://git-wip-us.apache.org/repos/asf/tomee/blob/bfb1ed40/container/openejb-core/src/main/java/org/apache/openejb/core/security/jaas/SQLLoginModule.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/main/java/org/apache/openejb/core/security/jaas/SQLLoginModule.java b/container/openejb-core/src/main/java/org/apache/openejb/core/security/jaas/SQLLoginModule.java index b6093bd..af61231 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/core/security/jaas/SQLLoginModule.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/core/security/jaas/SQLLoginModule.java @@ -80,7 +80,7 @@ public class SQLLoginModule implements LoginModule { private static final Logger log = Logger.getInstance( LogCategory.OPENEJB_SECURITY, "org.apache.openejb.util.resources"); - private final EnumMap<Option, String> optionsMap = new EnumMap<Option, String>(Option.class); + private final EnumMap<Option, String> optionsMap = new EnumMap<>(Option.class); private String connectionURL; private Properties properties; private Driver driver; @@ -95,8 +95,8 @@ public class SQLLoginModule implements LoginModule { private CallbackHandler handler; private String cbUsername; private String cbPassword; - private final Set<String> groups = new HashSet<String>(); - private final Set<Principal> allPrincipals = new HashSet<Principal>(); + private final Set<String> groups = new HashSet<>(); + private final Set<Principal> allPrincipals = new HashSet<>(); public void initialize(final Subject subject, final CallbackHandler callbackHandler, final Map sharedState, final Map options) { this.subject = subject; http://git-wip-us.apache.org/repos/asf/tomee/blob/bfb1ed40/container/openejb-core/src/main/java/org/apache/openejb/core/security/jaas/ScriptLoginModule.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/main/java/org/apache/openejb/core/security/jaas/ScriptLoginModule.java b/container/openejb-core/src/main/java/org/apache/openejb/core/security/jaas/ScriptLoginModule.java index de13545..4c1a743 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/core/security/jaas/ScriptLoginModule.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/core/security/jaas/ScriptLoginModule.java @@ -56,14 +56,14 @@ public class ScriptLoginModule implements LoginModule { private Map<String, ?> options; - public Set<Principal> principals = new LinkedHashSet<Principal>(); + public Set<Principal> principals = new LinkedHashSet<>(); private UserData userData; private final class UserData { public final String user; public final String pass; - public final Set<String> groups = new HashSet<String>(); + public final Set<String> groups = new HashSet<>(); private UserData(final String user, final String pass) { this.user = user; http://git-wip-us.apache.org/repos/asf/tomee/blob/bfb1ed40/container/openejb-core/src/main/java/org/apache/openejb/core/security/jaas/ServiceProviderLoginModule.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/main/java/org/apache/openejb/core/security/jaas/ServiceProviderLoginModule.java b/container/openejb-core/src/main/java/org/apache/openejb/core/security/jaas/ServiceProviderLoginModule.java index 97c4687..61f4cbf 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/core/security/jaas/ServiceProviderLoginModule.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/core/security/jaas/ServiceProviderLoginModule.java @@ -46,14 +46,14 @@ public class ServiceProviderLoginModule implements LoginModule { private CallbackHandler callbackHandler; private ServiceLoader<LoginProvider> loader; - public Set<Principal> principals = new LinkedHashSet<Principal>(); + public Set<Principal> principals = new LinkedHashSet<>(); private UserData userData; private final class UserData { public final String user; public final String pass; - public final Set<String> groups = new HashSet<String>(); + public final Set<String> groups = new HashSet<>(); private UserData(final String user, final String pass) { this.user = user; http://git-wip-us.apache.org/repos/asf/tomee/blob/bfb1ed40/container/openejb-core/src/main/java/org/apache/openejb/core/security/jacc/BasicJaccProvider.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/main/java/org/apache/openejb/core/security/jacc/BasicJaccProvider.java b/container/openejb-core/src/main/java/org/apache/openejb/core/security/jacc/BasicJaccProvider.java index 4d59fa1..e4d965a 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/core/security/jacc/BasicJaccProvider.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/core/security/jacc/BasicJaccProvider.java @@ -42,7 +42,7 @@ public class BasicJaccProvider extends JaccProvider { } } - private final Map<String, BasicPolicyConfiguration> configurations = new HashMap<String, BasicPolicyConfiguration>(); + private final Map<String, BasicPolicyConfiguration> configurations = new HashMap<>(); private final java.security.Policy systemPolicy; http://git-wip-us.apache.org/repos/asf/tomee/blob/bfb1ed40/container/openejb-core/src/main/java/org/apache/openejb/core/security/jacc/BasicPolicyConfiguration.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/main/java/org/apache/openejb/core/security/jacc/BasicPolicyConfiguration.java b/container/openejb-core/src/main/java/org/apache/openejb/core/security/jacc/BasicPolicyConfiguration.java index 5e5504d..f1c832c 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/core/security/jacc/BasicPolicyConfiguration.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/core/security/jacc/BasicPolicyConfiguration.java @@ -41,7 +41,7 @@ public class BasicPolicyConfiguration implements PolicyConfiguration { private final String contextID; private int state; - protected final Map<String, PermissionCollection> rolePermissionsMap = new LinkedHashMap<String, PermissionCollection>(); + protected final Map<String, PermissionCollection> rolePermissionsMap = new LinkedHashMap<>(); protected PermissionCollection unchecked; protected PermissionCollection excluded; http://git-wip-us.apache.org/repos/asf/tomee/blob/bfb1ed40/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/SingletonContainer.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/SingletonContainer.java b/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/SingletonContainer.java index 87775ac..2c4a5f0 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/SingletonContainer.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/SingletonContainer.java @@ -68,9 +68,9 @@ public class SingletonContainer implements RpcContainer { private final SingletonInstanceManager instanceManager; - private final HashMap<String, BeanContext> deploymentRegistry = new HashMap<String, BeanContext>(); + private final HashMap<String, BeanContext> deploymentRegistry = new HashMap<>(); - private final ConcurrentMap<Class<?>, List<Method>> interceptorCache = new ConcurrentHashMap<Class<?>, List<Method>>(); + private final ConcurrentMap<Class<?>, List<Method>> interceptorCache = new ConcurrentHashMap<>(); private final Object containerID; private final SecurityService securityService; @@ -377,13 +377,13 @@ public class SingletonContainer implements RpcContainer { final Class<?> interceptorClass = interceptor.getClass(); // Add the webservice interceptor to the list of interceptor instances - final Map<String, Object> interceptors = new HashMap<String, Object>(instance.interceptors); + final Map<String, Object> interceptors = new HashMap<>(instance.interceptors); { interceptors.put(interceptorClass.getName(), interceptor); } // Create an InterceptorData for the webservice interceptor to the list of interceptorDatas for this method - final List<InterceptorData> interceptorDatas = new ArrayList<InterceptorData>(); + final List<InterceptorData> interceptorDatas = new ArrayList<>(); { final InterceptorData providerData = new InterceptorData(interceptorClass); @@ -391,7 +391,7 @@ public class SingletonContainer implements RpcContainer { if (aroundInvokes == null) { aroundInvokes = new ClassFinder(interceptorClass).findAnnotatedMethods(AroundInvoke.class); if (SingletonContainer.class.getClassLoader() == interceptorClass.getClassLoader()) { // use cache only for server classes - final List<Method> value = new CopyOnWriteArrayList<Method>(aroundInvokes); + final List<Method> value = new CopyOnWriteArrayList<>(aroundInvokes); aroundInvokes = interceptorCache.putIfAbsent(interceptorClass, value); // ensure it to be thread safe if (aroundInvokes == null) { aroundInvokes = value; http://git-wip-us.apache.org/repos/asf/tomee/blob/bfb1ed40/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/SingletonInstanceManager.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/SingletonInstanceManager.java b/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/SingletonInstanceManager.java index 92b0a38..2b11779 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/SingletonInstanceManager.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/core/singleton/SingletonInstanceManager.java @@ -184,7 +184,7 @@ public class SingletonInstanceManager { try { callContext.setCurrentOperation(Operation.CREATE); final Method create = beanContext.getCreateMethod(); - final InterceptorStack ejbCreate = new InterceptorStack(context.getBean(), create, Operation.CREATE, new ArrayList<InterceptorData>(), new HashMap()); + final InterceptorStack ejbCreate = new InterceptorStack(context.getBean(), create, Operation.CREATE, new ArrayList<>(), new HashMap()); ejbCreate.invoke(); } finally { callContext.setCurrentOperation(originalOperation); @@ -356,8 +356,8 @@ public class SingletonInstanceManager { } private final class Data { - private final AtomicReference<Future<Instance>> singleton = new AtomicReference<Future<Instance>>(); - private final List<ObjectName> jmxNames = new ArrayList<ObjectName>(); + private final AtomicReference<Future<Instance>> singleton = new AtomicReference<>(); + private final List<ObjectName> jmxNames = new ArrayList<>(); private final BeanContext info; public Data(final BeanContext info) { http://git-wip-us.apache.org/repos/asf/tomee/blob/bfb1ed40/container/openejb-core/src/main/java/org/apache/openejb/core/stateful/Instance.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/main/java/org/apache/openejb/core/stateful/Instance.java b/container/openejb-core/src/main/java/org/apache/openejb/core/stateful/Instance.java index 0e6b6f1..0c1c321 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/core/stateful/Instance.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/core/stateful/Instance.java @@ -46,7 +46,7 @@ public class Instance implements Serializable, Cache.TimeOut { private boolean inUse; private SuspendedTransaction beanTransaction; - private final Stack<Transaction> transaction = new Stack<Transaction>(); + private final Stack<Transaction> transaction = new Stack<>(); private final LockFactory.StatefulLock lock; // todo if we keyed by an entity manager factory id we would not have to make this transient and rebuild the index below @@ -172,7 +172,7 @@ public class Instance implements Serializable, Cache.TimeOut { bean = toSerializable(i.bean); creationalContext = i.creationalContext; - interceptors = new HashMap<String, Object>(i.interceptors.size()); + interceptors = new HashMap<>(i.interceptors.size()); for (final Map.Entry<String, Object> e : i.interceptors.entrySet()) { if (e.getValue() == i.bean) { // need to use the same wrapped reference or well get two copies. http://git-wip-us.apache.org/repos/asf/tomee/blob/bfb1ed40/container/openejb-core/src/main/java/org/apache/openejb/core/stateful/SimpleCache.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/main/java/org/apache/openejb/core/stateful/SimpleCache.java b/container/openejb-core/src/main/java/org/apache/openejb/core/stateful/SimpleCache.java index e1540cf..59b3163 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/core/stateful/SimpleCache.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/core/stateful/SimpleCache.java @@ -43,12 +43,12 @@ public class SimpleCache<K, V> implements Cache<K, V> { /** * Map of all known values by key */ - private final ConcurrentHashMap<K, Entry> cache = new ConcurrentHashMap<K, Entry>(); + private final ConcurrentHashMap<K, Entry> cache = new ConcurrentHashMap<>(); /** * All values not in use in least resently used order */ - private final Queue<Entry> lru = new LinkedBlockingQueue<Entry>(); + private final Queue<Entry> lru = new LinkedBlockingQueue<>(); /** * Notified when values are loaded, stored, or timedOut @@ -428,8 +428,8 @@ public class SimpleCache<K, V> implements Cache<K, V> { // if there are to many beans in the lru, shink is by on bulkPassivate size // bulkPassivate size is just an estimate, as locked or timed out beans are skipped if (lru.size() >= getCapacity()) { - final Map<K, V> valuesToStore = new LinkedHashMap<K, V>(); - final List<Entry> entries = new ArrayList<Entry>(); + final Map<K, V> valuesToStore = new LinkedHashMap<>(); + final List<Entry> entries = new ArrayList<>(); int bulkPassivate = getBulkPassivate(); if (bulkPassivate < 1) { http://git-wip-us.apache.org/repos/asf/tomee/blob/bfb1ed40/container/openejb-core/src/main/java/org/apache/openejb/core/stateful/StatefulContainer.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/main/java/org/apache/openejb/core/stateful/StatefulContainer.java b/container/openejb-core/src/main/java/org/apache/openejb/core/stateful/StatefulContainer.java index 9eca1d8..549b3db 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/core/stateful/StatefulContainer.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/core/stateful/StatefulContainer.java @@ -105,11 +105,11 @@ public class StatefulContainer implements RpcContainer { /** * Index used for getDeployments() and getDeploymentInfo(deploymentId). */ - protected final Map<Object, BeanContext> deploymentsById = new HashMap<Object, BeanContext>(); + protected final Map<Object, BeanContext> deploymentsById = new HashMap<>(); protected final Cache<Object, Instance> cache; protected final LockFactory lockFactory; - private final ConcurrentMap<Object, Instance> checkedOutInstances = new ConcurrentHashMap<Object, Instance>(); + private final ConcurrentMap<Object, Instance> checkedOutInstances = new ConcurrentHashMap<>(); private final SessionContext sessionContext; private final boolean preventExtendedEntityManagerSerialization; @@ -132,7 +132,7 @@ public class StatefulContainer implements RpcContainer { } private Map<Method, MethodType> getLifecycleMethodsOfInterface(final BeanContext beanContext) { - final Map<Method, MethodType> methods = new HashMap<Method, MethodType>(); + final Map<Method, MethodType> methods = new HashMap<>(); try { methods.put(BeanContext.Removable.class.getDeclaredMethod("$$remove"), MethodType.REMOVE); @@ -312,7 +312,7 @@ public class StatefulContainer implements RpcContainer { deploymentsById.put(beanContext.getDeploymentID(), beanContext); beanContext.setContainer(this); - final Data data = new Data(new Index<Method, MethodType>(methods)); + final Data data = new Data(new Index<>(methods)); beanContext.setContainerData(data); // Create stats interceptor @@ -461,7 +461,7 @@ public class StatefulContainer implements RpcContainer { createContext.set(Method.class, createOrInit); // Initialize interceptor stack - final InterceptorStack interceptorStack = new InterceptorStack(instance.bean, createOrInit, Operation.CREATE, new ArrayList<InterceptorData>(), new HashMap<String, Object>()); + final InterceptorStack interceptorStack = new InterceptorStack(instance.bean, createOrInit, Operation.CREATE, new ArrayList<>(), new HashMap<>()); // Invoke if (args == null) { @@ -1051,7 +1051,7 @@ public class StatefulContainer implements RpcContainer { */ private final class SessionSynchronizationCoordinator implements TransactionSynchronization { - private final Map<Object, Synchronization> registry = new HashMap<Object, Synchronization>(); + private final Map<Object, Synchronization> registry = new HashMap<>(); private final TransactionPolicy txPolicy; private SessionSynchronizationCoordinator(final TransactionPolicy txPolicy) { @@ -1291,7 +1291,7 @@ public class StatefulContainer implements RpcContainer { private static final class Data { private final Index<Method, MethodType> methodIndex; - private final List<ObjectName> jmxNames = new ArrayList<ObjectName>(); + private final List<ObjectName> jmxNames = new ArrayList<>(); private Data(final Index<Method, MethodType> methodIndex) { this.methodIndex = methodIndex; http://git-wip-us.apache.org/repos/asf/tomee/blob/bfb1ed40/container/openejb-core/src/main/java/org/apache/openejb/core/stateless/StatelessContainer.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/main/java/org/apache/openejb/core/stateless/StatelessContainer.java b/container/openejb-core/src/main/java/org/apache/openejb/core/stateless/StatelessContainer.java index ea44ea4..000bb7a 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/core/stateless/StatelessContainer.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/core/stateless/StatelessContainer.java @@ -64,9 +64,9 @@ import static org.apache.openejb.core.transaction.EjbTransactionUtil.handleSyste */ public class StatelessContainer implements org.apache.openejb.RpcContainer, DestroyableResource { - private final ConcurrentMap<Class<?>, List<Method>> interceptorCache = new ConcurrentHashMap<Class<?>, List<Method>>(); + private final ConcurrentMap<Class<?>, List<Method>> interceptorCache = new ConcurrentHashMap<>(); private final StatelessInstanceManager instanceManager; - private final Map<String, BeanContext> deploymentRegistry = new ConcurrentHashMap<String, BeanContext>(); + private final Map<String, BeanContext> deploymentRegistry = new ConcurrentHashMap<>(); private final Object containerID; private final SecurityService securityService; @@ -294,11 +294,11 @@ public class StatelessContainer implements org.apache.openejb.RpcContainer, Dest final Class<?> interceptorClass = interceptor.getClass(); // Add the webservice interceptor to the list of interceptor instances - final Map<String, Object> interceptors = new HashMap<String, Object>(instance.interceptors); + final Map<String, Object> interceptors = new HashMap<>(instance.interceptors); interceptors.put(interceptor.getClass().getName(), interceptor); // Create an InterceptorData for the webservice interceptor to the list of interceptorDatas for this method - final List<InterceptorData> interceptorDatas = new ArrayList<InterceptorData>(); + final List<InterceptorData> interceptorDatas = new ArrayList<>(); final InterceptorData providerData = new InterceptorData(interceptorClass); providerData.getAroundInvoke().addAll(retrieveAroundInvokes(interceptorClass)); interceptorDatas.add(0, providerData); @@ -334,7 +334,7 @@ public class StatelessContainer implements org.apache.openejb.RpcContainer, Dest final ClassFinder finder = new ClassFinder(interceptorClass); List<Method> annotated = finder.findAnnotatedMethods(AroundInvoke.class); if (StatelessContainer.class.getClassLoader() == interceptorClass.getClassLoader()) { // use cache only for server classes - final List<Method> value = new CopyOnWriteArrayList<Method>(annotated); + final List<Method> value = new CopyOnWriteArrayList<>(annotated); annotated = this.interceptorCache.putIfAbsent(interceptorClass, annotated); // ensure it to be thread safe if (annotated == null) { annotated = value; http://git-wip-us.apache.org/repos/asf/tomee/blob/bfb1ed40/container/openejb-core/src/main/java/org/apache/openejb/core/stateless/StatelessInstanceManager.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/main/java/org/apache/openejb/core/stateless/StatelessInstanceManager.java b/container/openejb-core/src/main/java/org/apache/openejb/core/stateless/StatelessInstanceManager.java index aaa91d3..3cfe7ed 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/core/stateless/StatelessInstanceManager.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/core/stateless/StatelessInstanceManager.java @@ -115,7 +115,7 @@ public class StatelessInstanceManager { final ThreadFactory threadFactory = new DaemonThreadFactory("StatelessPool.worker."); this.executor = new ThreadPoolExecutor( callbackThreads, callbackThreads * 2, - 1L, TimeUnit.MINUTES, new LinkedBlockingQueue<Runnable>(qsize), threadFactory); + 1L, TimeUnit.MINUTES, new LinkedBlockingQueue<>(qsize), threadFactory); this.executor.setRejectedExecutionHandler(new RejectedExecutionHandler() { @Override @@ -489,7 +489,7 @@ public class StatelessInstanceManager { private final Pool<Instance> pool; private final Duration accessTimeout; private final Duration closeTimeout; - private final List<ObjectName> jmxNames = new ArrayList<ObjectName>(); + private final List<ObjectName> jmxNames = new ArrayList<>(); private final SessionContext sessionContext; private Data(final Pool<Instance> pool, final Duration accessTimeout, final Duration closeTimeout) { http://git-wip-us.apache.org/repos/asf/tomee/blob/bfb1ed40/container/openejb-core/src/main/java/org/apache/openejb/core/timer/EJBCronTrigger.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/main/java/org/apache/openejb/core/timer/EJBCronTrigger.java b/container/openejb-core/src/main/java/org/apache/openejb/core/timer/EJBCronTrigger.java index 49a9b76..83cc0e0 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/core/timer/EJBCronTrigger.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/core/timer/EJBCronTrigger.java @@ -107,7 +107,7 @@ public class EJBCronTrigger extends CronTriggerImpl { public EJBCronTrigger(final ScheduleExpression expr) throws ParseException { - final Map<Integer, String> fieldValues = new LinkedHashMap<Integer, String>(); + final Map<Integer, String> fieldValues = new LinkedHashMap<>(); fieldValues.put(Calendar.YEAR, expr.getYear()); fieldValues.put(Calendar.MONTH, expr.getMonth()); fieldValues.put(Calendar.DAY_OF_MONTH, expr.getDayOfMonth()); @@ -121,7 +121,7 @@ public class EJBCronTrigger extends CronTriggerImpl { setEndTime(expr.getEnd()); // If parsing fails on a field, record the error and move to the next field - final Map<Integer, ParseException> errors = new HashMap<Integer, ParseException>(); + final Map<Integer, ParseException> errors = new HashMap<>(); int index = 0; for (final Entry<Integer, String> entry : fieldValues.entrySet()) { final int field = entry.getKey(); @@ -879,7 +879,7 @@ public class EJBCronTrigger extends CronTriggerImpl { public List<Integer> getAllValuesInRange(final Calendar calendar) { - final List<Integer> values = new ArrayList<Integer>(); + final List<Integer> values = new ArrayList<>(); if (isDynamicRangeExpression) { try { @@ -914,13 +914,13 @@ public class EJBCronTrigger extends CronTriggerImpl { */ private static class ListExpression extends FieldExpression { - private final Set<Integer> values = new TreeSet<Integer>(); + private final Set<Integer> values = new TreeSet<>(); - private final List<RangeExpression> weekDayRangeExpressions = new ArrayList<RangeExpression>(); + private final List<RangeExpression> weekDayRangeExpressions = new ArrayList<>(); - private final List<WeekdayExpression> weekDayExpressions = new ArrayList<WeekdayExpression>(); + private final List<WeekdayExpression> weekDayExpressions = new ArrayList<>(); - private final List<DaysFromLastDayExpression> daysFromLastDayExpressions = new ArrayList<DaysFromLastDayExpression>(); + private final List<DaysFromLastDayExpression> daysFromLastDayExpressions = new ArrayList<>(); ; public ListExpression(final Matcher m, final int field) throws ParseException { @@ -971,7 +971,7 @@ public class EJBCronTrigger extends CronTriggerImpl { private TreeSet<Integer> getNewValuesFromDynamicExpressions(final Calendar calendar) { - final TreeSet<Integer> newValues = new TreeSet<Integer>(); + final TreeSet<Integer> newValues = new TreeSet<>(); newValues.addAll(values); http://git-wip-us.apache.org/repos/asf/tomee/blob/bfb1ed40/container/openejb-core/src/main/java/org/apache/openejb/core/timer/EjbTimerServiceImpl.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/main/java/org/apache/openejb/core/timer/EjbTimerServiceImpl.java b/container/openejb-core/src/main/java/org/apache/openejb/core/timer/EjbTimerServiceImpl.java index b22d20d..05b4e39 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/core/timer/EjbTimerServiceImpl.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/core/timer/EjbTimerServiceImpl.java @@ -386,7 +386,7 @@ public class EjbTimerServiceImpl implements EjbTimerService, Serializable { } final CountDownLatch shutdownWait = new CountDownLatch(1); - final AtomicReference<Throwable> ex = new AtomicReference<Throwable>(); + final AtomicReference<Throwable> ex = new AtomicReference<>(); String n = "Unknown"; try { @@ -584,7 +584,7 @@ public class EjbTimerServiceImpl implements EjbTimerService, Serializable { public Collection<Timer> getTimers(final Object primaryKey) throws IllegalStateException { checkState(); - final Collection<Timer> timers = new ArrayList<Timer>(); + final Collection<Timer> timers = new ArrayList<>(); for (final TimerData timerData : timerStore.getTimers((String) deployment.getDeploymentID())) { // if (!CalendarTimerData.class.isInstance(timerData) || !CalendarTimerData.class.cast(timerData).isAutoCreated()) { timers.add(timerData.getTimer()); http://git-wip-us.apache.org/repos/asf/tomee/blob/bfb1ed40/container/openejb-core/src/main/java/org/apache/openejb/core/timer/MemoryTimerStore.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/main/java/org/apache/openejb/core/timer/MemoryTimerStore.java b/container/openejb-core/src/main/java/org/apache/openejb/core/timer/MemoryTimerStore.java index edb3068..ab110d5 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/core/timer/MemoryTimerStore.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/core/timer/MemoryTimerStore.java @@ -47,8 +47,8 @@ import java.util.concurrent.locks.ReentrantLock; public class MemoryTimerStore implements TimerStore { private static final long serialVersionUID = 1L; private static final Logger log = Logger.getInstance(LogCategory.TIMER, "org.apache.openejb.util.resources"); - private final Map<Long, TimerData> taskStore = new ConcurrentHashMap<Long, TimerData>(); - private final Map<Transaction, TimerDataView> tasksByTransaction = new ConcurrentHashMap<Transaction, TimerDataView>(); + private final Map<Long, TimerData> taskStore = new ConcurrentHashMap<>(); + private final Map<Transaction, TimerDataView> tasksByTransaction = new ConcurrentHashMap<>(); private final AtomicLong counter = new AtomicLong(0); private final TransactionManager transactionManager; @@ -71,7 +71,7 @@ public class MemoryTimerStore implements TimerStore { public Collection<TimerData> getTimers(final String deploymentId) { try { final TimerDataView tasks = getTasks(); - return new ArrayList<TimerData>(tasks.getTasks().values()); + return new ArrayList<>(tasks.getTasks().values()); } catch (final TimerStoreException e) { return Collections.emptySet(); } @@ -80,7 +80,7 @@ public class MemoryTimerStore implements TimerStore { @Override public Collection<TimerData> loadTimers(final EjbTimerServiceImpl timerService, final String deploymentId) throws TimerStoreException { final TimerDataView tasks = getTasks(); - final Collection<TimerData> out = new LinkedList<TimerData>(); + final Collection<TimerData> out = new LinkedList<>(); for (final TimerData data : tasks.getTasks().values()) { if (deploymentId == null || deploymentId.equals(data.getDeploymentId())) { out.add(data); @@ -169,7 +169,7 @@ public class MemoryTimerStore implements TimerStore { private class LiveTimerDataView implements TimerDataView { @Override public Map<Long, TimerData> getTasks() { - return new TreeMap<Long, TimerData>(taskStore); + return new TreeMap<>(taskStore); } @Override @@ -184,8 +184,8 @@ public class MemoryTimerStore implements TimerStore { } private class TxTimerDataView implements Synchronization, TimerDataView { - private final Map<Long, TimerData> add = new TreeMap<Long, TimerData>(); - private final Set<Long> remove = new TreeSet<Long>(); + private final Map<Long, TimerData> add = new TreeMap<>(); + private final Set<Long> remove = new TreeSet<>(); private final Lock lock = new ReentrantLock(); private final RuntimeException concurentException; private final WeakReference<Transaction> tansactionReference; @@ -208,7 +208,7 @@ public class MemoryTimerStore implements TimerStore { concurentException.fillInStackTrace(); try { transaction.registerSynchronization(this); - tansactionReference = new WeakReference<Transaction>(transaction); + tansactionReference = new WeakReference<>(transaction); } catch (final RollbackException e) { throw new TimerStoreException("Transaction has been rolled back"); } catch (final SystemException e) { @@ -225,7 +225,7 @@ public class MemoryTimerStore implements TimerStore { @Override public Map<Long, TimerData> getTasks() { checkThread(); - final TreeMap<Long, TimerData> allTasks = new TreeMap<Long, TimerData>(); + final TreeMap<Long, TimerData> allTasks = new TreeMap<>(); allTasks.putAll(taskStore); for (final Long key : remove) { allTasks.remove(key); http://git-wip-us.apache.org/repos/asf/tomee/blob/bfb1ed40/container/openejb-core/src/main/java/org/apache/openejb/core/transaction/JtaTransactionPolicy.java ---------------------------------------------------------------------- diff --git a/container/openejb-core/src/main/java/org/apache/openejb/core/transaction/JtaTransactionPolicy.java b/container/openejb-core/src/main/java/org/apache/openejb/core/transaction/JtaTransactionPolicy.java index b4e7c00..2b11150 100644 --- a/container/openejb-core/src/main/java/org/apache/openejb/core/transaction/JtaTransactionPolicy.java +++ b/container/openejb-core/src/main/java/org/apache/openejb/core/transaction/JtaTransactionPolicy.java @@ -50,7 +50,7 @@ public abstract class JtaTransactionPolicy implements TransactionPolicy { protected final TransactionManager transactionManager; private final TransactionSynchronizationRegistry synchronizationRegistry; private Map<Object, Object> resources; - private final List<TransactionSynchronization> synchronizations = new LinkedList<TransactionSynchronization>(); + private final List<TransactionSynchronization> synchronizations = new LinkedList<>(); private boolean rollbackOnly; public JtaTransactionPolicy(final TransactionType transactionType, final TransactionManager transactionManager) { @@ -124,7 +124,7 @@ public abstract class JtaTransactionPolicy implements TransactionPolicy { } if (resources == null) { - resources = new LinkedHashMap<Object, Object>(); + resources = new LinkedHashMap<>(); } resources.put(key, value); } @@ -168,7 +168,7 @@ public abstract class JtaTransactionPolicy implements TransactionPolicy { } protected void fireNonTransactionalCompletion() { - for (final TransactionSynchronization synchronization : new ArrayList<TransactionSynchronization>(synchronizations)) { + for (final TransactionSynchronization synchronization : new ArrayList<>(synchronizations)) { try { synchronization.beforeCompletion(); } catch (final Throwable e) { @@ -176,7 +176,7 @@ public abstract class JtaTransactionPolicy implements TransactionPolicy { } } final TransactionSynchronization.Status status = isRollbackOnly() ? TransactionSynchronization.Status.ROLLEDBACK : TransactionSynchronization.Status.COMMITTED; - for (final TransactionSynchronization synchronization : new ArrayList<TransactionSynchronization>(synchronizations)) { + for (final TransactionSynchronization synchronization : new ArrayList<>(synchronizations)) { try { synchronization.afterCompletion(status); } catch (final Exception e) {