tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fha...@apache.org
Subject svn commit: r708702 - in /tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool: ConnectionPool.java FairBlockingQueue.java
Date Tue, 28 Oct 2008 22:26:04 GMT
Author: fhanik
Date: Tue Oct 28 15:26:03 2008
New Revision: 708702

URL: http://svn.apache.org/viewvc?rev=708702&view=rev
Log:
stupid eclipse

Modified:
    tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java
    tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/FairBlockingQueue.java

Modified: tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java?rev=708702&r1=708701&r2=708702&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java (original)
+++ tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java Tue
Oct 28 15:26:03 2008
@@ -489,12 +489,12 @@
                     throw new SQLException("Failed to validate a newly established connection.");
                 }
             } catch (Exception x) {
-                release(con);                
+                release(con);
                 setToNull = true;
                 if (x instanceof SQLException) {
                     throw (SQLException)x;
                 } else {
-                    throw new SQLException(x);
+                    throw new SQLException(getStackTrace(x));
                 }
             }
         } finally {
@@ -514,7 +514,7 @@
             //if the connection pool is closed
             //close the connection instead of returning it
             release(con);
-            return; 
+            return;
         } //end if
 
         if (con != null) {

Modified: tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/FairBlockingQueue.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/FairBlockingQueue.java?rev=708702&r1=708701&r2=708702&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/FairBlockingQueue.java
(original)
+++ tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/FairBlockingQueue.java
Tue Oct 28 15:26:03 2008
@@ -25,28 +25,28 @@
 import java.util.concurrent.locks.ReentrantLock;
 
 /**
- * 
+ *
  * A simple implementation of a blocking queue with fairness waiting.
  * invocations to method poll(...) will get handed out in the order they were received.
  * @author Filip Hanik
- * 
+ *
  */
 
 public class FairBlockingQueue<E> implements BlockingQueue<E> {
     ReentrantLock lock = new ReentrantLock();
-    
+
     LinkedList<E> items = null;
-    
+
     LinkedList<ExchangeCountDownLatch<E>> waiters = null;
-    
+
     public FairBlockingQueue() {
         items = new LinkedList<E>();
         waiters = new LinkedList<ExchangeCountDownLatch<E>>();
     }
-    
-    //------------------------------------------------------------------    
+
+    //------------------------------------------------------------------
     // USED BY CONPOOL IMPLEMENTATION
-    //------------------------------------------------------------------    
+    //------------------------------------------------------------------
     public boolean offer(E e) {
         final ReentrantLock lock = this.lock;
         lock.lock();
@@ -67,7 +67,7 @@
     public boolean offer(E e, long timeout, TimeUnit unit) throws InterruptedException {
         return offer(e);
     }
-    
+
     public E poll(long timeout, TimeUnit unit) throws InterruptedException {
         E result = null;
         final ReentrantLock lock = this.lock;
@@ -96,7 +96,7 @@
         }
         return result;
     }
-    
+
     public boolean remove(Object e) {
         final ReentrantLock lock = this.lock;
         lock.lock();
@@ -106,15 +106,15 @@
             lock.unlock();
         }
     }
-    
+
     public int size() {
         return items.size();
     }
-    
+
     public Iterator<E> iterator() {
         return new FairIterator();
     }
-    
+
     public E poll() {
         final ReentrantLock lock = this.lock;
         lock.lock();
@@ -124,7 +124,7 @@
             lock.unlock();
         }
     }
-    
+
     public boolean contains(Object e) {
         final ReentrantLock lock = this.lock;
         lock.lock();
@@ -134,43 +134,36 @@
             lock.unlock();
         }
     }
-    
 
-    //------------------------------------------------------------------    
+
+    //------------------------------------------------------------------
     // NOT USED BY CONPOOL IMPLEMENTATION
-    //------------------------------------------------------------------    
-    
-    @Override
+    //------------------------------------------------------------------
+
     public boolean add(E e) {
         return offer(e);
     }
 
-    @Override
     public int drainTo(Collection<? super E> c, int maxElements) {
         throw new UnsupportedOperationException("int drainTo(Collection<? super E>
c, int maxElements)");
     }
 
-    @Override
     public int drainTo(Collection<? super E> c) {
         return drainTo(c,Integer.MAX_VALUE);
     }
 
-    @Override
     public void put(E e) throws InterruptedException {
         offer(e);
     }
 
-    @Override
     public int remainingCapacity() {
         return Integer.MAX_VALUE - size();
     }
 
-    @Override
     public E take() throws InterruptedException {
         return this.poll(Long.MAX_VALUE, TimeUnit.MILLISECONDS);
     }
 
-    @Override
     public boolean addAll(Collection<? extends E> c) {
         Iterator i = c.iterator();
         while (i.hasNext()) {
@@ -180,53 +173,43 @@
         return true;
     }
 
-    @Override
     public void clear() {
         throw new UnsupportedOperationException("void clear()");
-        
+
     }
 
-    @Override
     public boolean containsAll(Collection<?> c) {
         throw new UnsupportedOperationException("boolean containsAll(Collection<?>
c)");
     }
 
-    @Override
     public boolean isEmpty() {
         return size() == 0;
     }
 
-    @Override
     public boolean removeAll(Collection<?> c) {
         throw new UnsupportedOperationException("boolean removeAll(Collection<?> c)");
     }
 
-    @Override
     public boolean retainAll(Collection<?> c) {
         throw new UnsupportedOperationException("boolean retainAll(Collection<?> c)");
     }
 
-    @Override
     public Object[] toArray() {
         throw new UnsupportedOperationException("Object[] toArray()");
     }
 
-    @Override
     public <T> T[] toArray(T[] a) {
         throw new UnsupportedOperationException("<T> T[] toArray(T[] a)");
     }
 
-    @Override
     public E element() {
         throw new UnsupportedOperationException("E element()");
     }
 
-    @Override
     public E peek() {
         throw new UnsupportedOperationException("E peek()");
     }
 
-    @Override
     public E remove() {
         throw new UnsupportedOperationException("E remove()");
     }
@@ -235,9 +218,9 @@
 
 
 
-    //------------------------------------------------------------------    
+    //------------------------------------------------------------------
     // Count down latch that can be used to exchange information
-    //------------------------------------------------------------------    
+    //------------------------------------------------------------------
     protected class ExchangeCountDownLatch<T> extends CountDownLatch {
         protected T item;
         public ExchangeCountDownLatch(int i) {
@@ -250,15 +233,15 @@
             this.item = item;
         }
     }
-    
-    //------------------------------------------------------------------    
+
+    //------------------------------------------------------------------
     // Iterator safe from concurrent modification exceptions
-    //------------------------------------------------------------------    
+    //------------------------------------------------------------------
     protected class FairIterator implements Iterator<E> {
         E[] elements = null;
         int index;
         E element = null;
-        
+
         public FairIterator() {
             final ReentrantLock lock = FairBlockingQueue.this.lock;
             lock.lock();
@@ -270,18 +253,15 @@
                 lock.unlock();
             }
         }
-        @Override
         public boolean hasNext() {
             return index<elements.length;
         }
 
-        @Override
         public E next() {
             element = elements[index++];
             return element;
         }
 
-        @Override
         public void remove() {
             final ReentrantLock lock = FairBlockingQueue.this.lock;
             lock.lock();
@@ -293,6 +273,6 @@
                 lock.unlock();
             }
         }
-        
+
     }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message