You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by tv...@apache.org on 2014/05/15 18:14:09 UTC

svn commit: r1594962 - in /tomee/tomee/trunk: ./ container/openejb-core/ container/openejb-core/src/main/java/org/apache/openejb/cipher/ container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/cipher/ container/openejb-core/src/main/java/...

Author: tveronezi
Date: Thu May 15 16:14:08 2014
New Revision: 1594962

URL: http://svn.apache.org/r1594962
Log:
*updating pmd plugin
*minor improvements in the *Cipher.java and util/Pool.java classes

Modified:
    tomee/tomee/trunk/container/openejb-core/pom.xml
    tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cipher/StaticDESPasswordCipher.java
    tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/cipher/StaticDESPasswordCipher.java
    tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/util/Pool.java
    tomee/tomee/trunk/pom.xml
    tomee/tomee/trunk/tomee/pom.xml

Modified: tomee/tomee/trunk/container/openejb-core/pom.xml
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/pom.xml?rev=1594962&r1=1594961&r2=1594962&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/pom.xml (original)
+++ tomee/tomee/trunk/container/openejb-core/pom.xml Thu May 15 16:14:08 2014
@@ -268,7 +268,6 @@
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-pmd-plugin</artifactId>
-        <version>3.0.1</version>
         <configuration>
           <linkXRef>true</linkXRef>
           <sourceEncoding>utf-8</sourceEncoding>

Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cipher/StaticDESPasswordCipher.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cipher/StaticDESPasswordCipher.java?rev=1594962&r1=1594961&r2=1594962&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cipher/StaticDESPasswordCipher.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/cipher/StaticDESPasswordCipher.java Thu May 15 16:14:08 2014
@@ -40,7 +40,7 @@ public class StaticDESPasswordCipher imp
     /**
      * The name of the transformation defines Triple-DES encryption
      */
-    private static final String TRANSFORMATION = new String("DESede");
+    private static final String TRANSFORMATION = "DESede";
 
     /**
      * @see org.apache.openejb.cipher.PasswordCipher#encrypt(String)
@@ -88,8 +88,7 @@ public class StaticDESPasswordCipher imp
             cipher.init(Cipher.DECRYPT_MODE, KEY);
 
             // Decrypt data
-            final String plainText = new String(cipher.doFinal(cipherText));
-            return plainText;
+            return new String(cipher.doFinal(cipherText));
 
         } catch (final Exception e) {
             throw new OpenEJBRuntimeException(e);

Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/cipher/StaticDESPasswordCipher.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/cipher/StaticDESPasswordCipher.java?rev=1594962&r1=1594961&r2=1594962&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/cipher/StaticDESPasswordCipher.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/resource/jdbc/cipher/StaticDESPasswordCipher.java Thu May 15 16:14:08 2014
@@ -17,5 +17,6 @@
 package org.apache.openejb.resource.jdbc.cipher;
 
 @Deprecated
+@SuppressWarnings("deprecation")
 public class StaticDESPasswordCipher extends org.apache.openejb.cipher.StaticDESPasswordCipher implements PasswordCipher {
 }

Modified: tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/util/Pool.java
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/util/Pool.java?rev=1594962&r1=1594961&r2=1594962&view=diff
==============================================================================
--- tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/util/Pool.java (original)
+++ tomee/tomee/trunk/container/openejb-core/src/main/java/org/apache/openejb/util/Pool.java Thu May 15 16:14:08 2014
@@ -24,7 +24,6 @@ import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.LinkedList;
 import java.util.List;
-import java.util.NoSuchElementException;
 import java.util.concurrent.Executor;
 import java.util.concurrent.Executors;
 import java.util.concurrent.LinkedBlockingQueue;
@@ -105,7 +104,7 @@ public class Pool<T> {
             greater("MaxAge", maxAge, "IdleTimeout", idleTimeout);
         }
         this.executor = executor != null ? executor : createExecutor();
-        this.supplier = supplier != null ? supplier : new NoSupplier();
+        this.supplier = supplier != null ? supplier : new NoSupplier<T>();
         this.available = strict ? new Semaphore(max) : new Overdraft(max);
         this.minimum = new Semaphore(min);
         this.instances = new Semaphore(max);
@@ -202,34 +201,21 @@ public class Pool<T> {
             throw new TimeoutException("Waited " + timeout + " " + unit);
         }
 
-        Entry entry = null;
-        while (entry == null) {
-
-            synchronized (pool) {
-                try {
-                    entry = pool.removeFirst();
-                } catch (final NoSuchElementException e) {
-                    return null;
-                }
-            }
-
-            final Pool<T>.Entry.Instance instance = entry.soft.get();
-
-            if (instance != null) {
-
-                final boolean notBusy = entry.active.compareAndSet(null, instance);
-
-                if (notBusy) {
-                    return entry;
+        synchronized (pool) {
+            while (!pool.isEmpty()) {
+                final Entry entry = pool.removeFirst();
+                final Pool<T>.Entry.Instance instance = entry.soft.get();
+                if (instance != null) {
+                    final boolean notBusy = entry.active.compareAndSet(null, instance);
+                    if (notBusy) {
+                        return entry;
+                    }
+                } else {
+                    // the SoftReference was garbage collected
+                    instances.release();
                 }
-            } else {
-                // the SoftReference was garbage collected
-                instances.release();
             }
-
-            entry = null;
         }
-
         return null;
     }
 
@@ -880,13 +866,13 @@ public class Pool<T> {
 
     }
 
-    private static class NoSupplier implements Supplier {
+    private static class NoSupplier<T> implements Supplier<T> {
         @Override
         public void discard(final Object o, final Event reason) {
         }
 
         @Override
-        public Object create() {
+        public T create() {
             return null;
         }
     }

Modified: tomee/tomee/trunk/pom.xml
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/pom.xml?rev=1594962&r1=1594961&r2=1594962&view=diff
==============================================================================
--- tomee/tomee/trunk/pom.xml (original)
+++ tomee/tomee/trunk/pom.xml Thu May 15 16:14:08 2014
@@ -259,7 +259,7 @@
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-pmd-plugin</artifactId>
-          <version>3.0.1</version>
+          <version>3.1</version>
         </plugin>
         <plugin>
           <groupId>org.codehaus.mojo</groupId>
@@ -284,7 +284,7 @@
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-checkstyle-plugin</artifactId>
-          <version>2.12</version>
+            <version>2.12.1</version>
         </plugin>
 		<plugin>
 		  <groupId>org.apache.maven.plugins</groupId>

Modified: tomee/tomee/trunk/tomee/pom.xml
URL: http://svn.apache.org/viewvc/tomee/tomee/trunk/tomee/pom.xml?rev=1594962&r1=1594961&r2=1594962&view=diff
==============================================================================
--- tomee/tomee/trunk/tomee/pom.xml (original)
+++ tomee/tomee/trunk/tomee/pom.xml Thu May 15 16:14:08 2014
@@ -209,7 +209,6 @@
         <plugin>
           <groupId>org.apache.maven.plugins</groupId>
           <artifactId>maven-pmd-plugin</artifactId>
-          <version>3.0.1</version>
         </plugin>
       </plugins>
     </pluginManagement>