cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmen...@apache.org
Subject svn commit: r614073 - in /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne: conn/PoolManager.java conn/PooledConnectionImpl.java tools/NamePatternMatcher.java xml/XMLDecoder.java xml/XMLMappingDescriptor.java
Date Tue, 22 Jan 2008 00:45:06 GMT
Author: kmenard
Date: Mon Jan 21 16:45:06 2008
New Revision: 614073

URL: http://svn.apache.org/viewvc?rev=614073&view=rev
Log:
Generics.

Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conn/PoolManager.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conn/PooledConnectionImpl.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/tools/NamePatternMatcher.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/xml/XMLDecoder.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/xml/XMLMappingDescriptor.java

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conn/PoolManager.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conn/PoolManager.java?rev=614073&r1=614072&r2=614073&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conn/PoolManager.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conn/PoolManager.java
Mon Jan 21 16:45:06 2008
@@ -58,8 +58,8 @@
     protected String password;
     protected String userName;
 
-    protected List unusedPool;
-    protected List usedPool;
+    protected List<PooledConnection> unusedPool;
+    protected List<PooledConnection> usedPool;
 
     private PoolMaintenanceThread poolMaintenanceThread;
 
@@ -161,8 +161,8 @@
         this.poolDataSource = poolDataSource;
 
         // init pool... use linked lists to use the queue in the FIFO manner
-        usedPool = new LinkedList();
-        unusedPool = new LinkedList();
+        usedPool = new LinkedList<PooledConnection>();
+        unusedPool = new LinkedList<PooledConnection>();
         growPool(minConnections, userName, password);
 
         startMaintenanceThread();
@@ -192,9 +192,9 @@
     public void dispose() throws SQLException {
         synchronized (this) {
             // clean connections from the pool
-            ListIterator unusedIterator = unusedPool.listIterator();
+            ListIterator<PooledConnection> unusedIterator = unusedPool.listIterator();
             while (unusedIterator.hasNext()) {
-                PooledConnection con = (PooledConnection) unusedIterator.next();
+                PooledConnection con = unusedIterator.next();
                 // close connection
                 con.close();
                 // remove connection from the list
@@ -202,9 +202,9 @@
             }
 
             // clean used connections
-            ListIterator usedIterator = usedPool.listIterator();
+            ListIterator<PooledConnection> usedIterator = usedPool.listIterator();
             while (usedIterator.hasNext()) {
-                PooledConnection con = (PooledConnection) usedIterator.next();
+                PooledConnection con = usedIterator.next();
                 // stop listening for connection events
                 con.removeConnectionEventListener(this);
                 // close connection
@@ -255,7 +255,7 @@
     protected synchronized void shrinkPool(int closeConnections) {
         int idleSize = unusedPool.size();
         for (int i = 0; i < closeConnections && i < idleSize; i++) {
-            PooledConnection con = (PooledConnection) unusedPool.remove(i);
+            PooledConnection con = unusedPool.remove(i);
 
             try {
                 con.close();
@@ -426,7 +426,7 @@
         }
 
         // get first connection... lets cycle them in FIFO manner
-        return (PooledConnection) unusedPool.remove(0);
+        return unusedPool.remove(0);
     }
 
     public int getLoginTimeout() throws java.sql.SQLException {

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conn/PooledConnectionImpl.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conn/PooledConnectionImpl.java?rev=614073&r1=614072&r2=614073&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conn/PooledConnectionImpl.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/conn/PooledConnectionImpl.java
Mon Jan 21 16:45:06 2008
@@ -42,7 +42,7 @@
 public class PooledConnectionImpl implements PooledConnection {
 
     private Connection connectionObj;
-    private List connectionEventListeners;
+    private List<ConnectionEventListener> connectionEventListeners;
     private boolean hadErrors;
     private DataSource connectionSource;
     private String userName;
@@ -52,7 +52,7 @@
         // TODO: maybe remove synchronization and use
         // FastArrayList from commons-collections? After
         // all the only listener is usually pool manager.
-        this.connectionEventListeners = Collections.synchronizedList(new ArrayList(10));
+        this.connectionEventListeners = Collections.synchronizedList(new ArrayList<ConnectionEventListener>(10));
     }
 
     /** Creates new PooledConnection */
@@ -161,9 +161,9 @@
                 return;
 
             ConnectionEvent closedEvent = new ConnectionEvent(this, exception);
-            Iterator listeners = connectionEventListeners.iterator();
+            Iterator<ConnectionEventListener> listeners = connectionEventListeners.iterator();
             while (listeners.hasNext()) {
-                ConnectionEventListener nextListener = (ConnectionEventListener) listeners
+                ConnectionEventListener nextListener = listeners
                         .next();
                 nextListener.connectionErrorOccurred(closedEvent);
             }
@@ -180,10 +180,10 @@
                 return;
 
             ConnectionEvent closedEvent = new ConnectionEvent(this);
-            Iterator listeners = connectionEventListeners.iterator();
+            Iterator<ConnectionEventListener> listeners = connectionEventListeners.iterator();
 
             while (listeners.hasNext()) {
-                ConnectionEventListener nextListener = (ConnectionEventListener) listeners
+                ConnectionEventListener nextListener = listeners
                         .next();
                 nextListener.connectionClosed(closedEvent);
             }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/tools/NamePatternMatcher.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/tools/NamePatternMatcher.java?rev=614073&r1=614072&r2=614073&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/tools/NamePatternMatcher.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/tools/NamePatternMatcher.java
Mon Jan 21 16:45:06 2008
@@ -59,7 +59,7 @@
      */
     public Pattern[] createPatterns(String patternString) {
         String[] patternStrings = tokenizePattern(patternString);
-        List patterns = new ArrayList(patternStrings.length);
+        List<Pattern> patterns = new ArrayList<Pattern>(patternStrings.length);
 
         for (int i = 0; i < patternStrings.length; i++) {
 
@@ -100,7 +100,7 @@
                 return new String[0];
             }
 
-            List patterns = new ArrayList(len);
+            List<String> patterns = new ArrayList<String>(len);
             for (int i = 0; i < len; i++) {
                 String nextPattern = toks.nextToken();
                 StringBuffer buffer = new StringBuffer();

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/xml/XMLDecoder.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/xml/XMLDecoder.java?rev=614073&r1=614072&r2=614073&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/xml/XMLDecoder.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/xml/XMLDecoder.java
Mon Jan 21 16:45:06 2008
@@ -71,7 +71,7 @@
     private DataContext dataContext;
 
     // TODO: H to the A to the C to the K
-    private List decodedCollections = new ArrayList();
+    private List<Element> decodedCollections = new ArrayList<Element>();
 
     /**
      * Default constructor. This will create an XMLDecoder instance that will decode

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/xml/XMLMappingDescriptor.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/xml/XMLMappingDescriptor.java?rev=614073&r1=614072&r2=614073&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/xml/XMLMappingDescriptor.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/xml/XMLMappingDescriptor.java
Mon Jan 21 16:45:06 2008
@@ -45,7 +45,7 @@
 final class XMLMappingDescriptor {
 
     private SerializableEntity rootEntity;
-    private Map entities;
+    private Map<String, SerializableEntity> entities;
     private DataContext dataContext;
 
     /**
@@ -74,7 +74,7 @@
                     "Root of the mapping model must be \"model\"");
         }
 
-        Map entities = new HashMap();
+        Map<String, SerializableEntity> entities = new HashMap<String, SerializableEntity>();
         Iterator it = XMLUtil.getChildren(root).iterator();
         while (it.hasNext()) {
             Element e = (Element) it.next();
@@ -130,7 +130,7 @@
      * @return The entity with "xmlTag" equal to the passed in name.
      */
     SerializableEntity getEntity(String name) {
-        return (SerializableEntity) entities.get(name);
+        return entities.get(name);
     }
 
     /**



Mime
View raw message