From: fhanik Date: Tue, 28 Oct 2008 22:26:03 +0000 (+0000) Subject: stupid eclipse X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=247fb1c311c25dc38f3fa7d768fcc5b3cebafce9;p=tomcat7.0 stupid eclipse git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@708702 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java b/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java index 03c4d9e3a..e66355a14 100644 --- a/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java +++ b/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java @@ -489,12 +489,12 @@ public class ConnectionPool { 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 @@ public class ConnectionPool { //if the connection pool is closed //close the connection instead of returning it release(con); - return; + return; } //end if if (con != null) { diff --git a/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/FairBlockingQueue.java b/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/FairBlockingQueue.java index 97a10dd8d..f60a7a25b 100644 --- a/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/FairBlockingQueue.java +++ b/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/FairBlockingQueue.java @@ -25,28 +25,28 @@ import java.util.concurrent.TimeUnit; 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 implements BlockingQueue { ReentrantLock lock = new ReentrantLock(); - + LinkedList items = null; - + LinkedList> waiters = null; - + public FairBlockingQueue() { items = new LinkedList(); waiters = new LinkedList>(); } - - //------------------------------------------------------------------ + + //------------------------------------------------------------------ // USED BY CONPOOL IMPLEMENTATION - //------------------------------------------------------------------ + //------------------------------------------------------------------ public boolean offer(E e) { final ReentrantLock lock = this.lock; lock.lock(); @@ -67,7 +67,7 @@ public class FairBlockingQueue implements BlockingQueue { 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 @@ public class FairBlockingQueue implements BlockingQueue { } return result; } - + public boolean remove(Object e) { final ReentrantLock lock = this.lock; lock.lock(); @@ -106,15 +106,15 @@ public class FairBlockingQueue implements BlockingQueue { lock.unlock(); } } - + public int size() { return items.size(); } - + public Iterator iterator() { return new FairIterator(); } - + public E poll() { final ReentrantLock lock = this.lock; lock.lock(); @@ -124,7 +124,7 @@ public class FairBlockingQueue implements BlockingQueue { lock.unlock(); } } - + public boolean contains(Object e) { final ReentrantLock lock = this.lock; lock.lock(); @@ -134,43 +134,36 @@ public class FairBlockingQueue implements BlockingQueue { lock.unlock(); } } - - //------------------------------------------------------------------ + + //------------------------------------------------------------------ // NOT USED BY CONPOOL IMPLEMENTATION - //------------------------------------------------------------------ - - @Override + //------------------------------------------------------------------ + public boolean add(E e) { return offer(e); } - @Override public int drainTo(Collection c, int maxElements) { throw new UnsupportedOperationException("int drainTo(Collection c, int maxElements)"); } - @Override public int drainTo(Collection 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 c) { Iterator i = c.iterator(); while (i.hasNext()) { @@ -180,53 +173,43 @@ public class FairBlockingQueue implements BlockingQueue { 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[] toArray(T[] a) { throw new UnsupportedOperationException(" 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 @@ public class FairBlockingQueue implements BlockingQueue { - //------------------------------------------------------------------ + //------------------------------------------------------------------ // Count down latch that can be used to exchange information - //------------------------------------------------------------------ + //------------------------------------------------------------------ protected class ExchangeCountDownLatch extends CountDownLatch { protected T item; public ExchangeCountDownLatch(int i) { @@ -250,15 +233,15 @@ public class FairBlockingQueue implements BlockingQueue { this.item = item; } } - - //------------------------------------------------------------------ + + //------------------------------------------------------------------ // Iterator safe from concurrent modification exceptions - //------------------------------------------------------------------ + //------------------------------------------------------------------ protected class FairIterator implements Iterator { E[] elements = null; int index; E element = null; - + public FairIterator() { final ReentrantLock lock = FairBlockingQueue.this.lock; lock.lock(); @@ -270,18 +253,15 @@ public class FairBlockingQueue implements BlockingQueue { lock.unlock(); } } - @Override public boolean hasNext() { return index implements BlockingQueue { lock.unlock(); } } - + } }