You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by mb...@apache.org on 2012/03/15 23:17:10 UTC

svn commit: r1301245 - /commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/dsl/ParserEntityFactory.java

Author: mbenson
Date: Thu Mar 15 22:17:10 2012
New Revision: 1301245

URL: http://svn.apache.org/viewvc?rev=1301245&view=rev
Log:
pool 1.6

Modified:
    commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/dsl/ParserEntityFactory.java

Modified: commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/dsl/ParserEntityFactory.java
URL: http://svn.apache.org/viewvc/commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/dsl/ParserEntityFactory.java?rev=1301245&r1=1301244&r2=1301245&view=diff
==============================================================================
--- commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/dsl/ParserEntityFactory.java (original)
+++ commons/sandbox/flatfile/trunk/src/main/java/org/apache/commons/flatfile/dsl/ParserEntityFactory.java Thu Mar 15 22:17:10 2012
@@ -89,15 +89,17 @@ public class ParserEntityFactory impleme
     private InputStream[] sources;
     private EntityFactory parent;
 
-    private final ObjectPool treeParserPool = new StackObjectPool(new BasePoolableObjectFactory() {
-
-        @Override
-        public Object makeObject() throws Exception {
-            EntityTreeParser result = new EntityTreeParser();
-            result.setEntityFactory(ParserEntityFactory.this);
-            return result;
-        }
-    }, 1);
+    private final ObjectPool<EntityTreeParser> treeParserPool =
+        new StackObjectPool<EntityTreeParser>(
+            new BasePoolableObjectFactory<EntityTreeParser>() {
+
+                @Override
+                public EntityTreeParser makeObject() throws Exception {
+                    EntityTreeParser result = new EntityTreeParser();
+                    result.setEntityFactory(ParserEntityFactory.this);
+                    return result;
+                }
+            }, 1);
 
     /**
      * Create a new ParserEntityFactory.
@@ -300,7 +302,6 @@ public class ParserEntityFactory impleme
                                         : new RuntimeException(e);
                             }
                         }
-                        // TODO Auto-generated method stub
                         return null;
                     }
                 });
@@ -313,9 +314,9 @@ public class ParserEntityFactory impleme
     }
 
     private Object doWithPooledTreeParser(Transformer t) {
-        EntityTreeParser entityTreeParser = null;
+        EntityTreeParser entityTreeParser;
         try {
-            entityTreeParser = (EntityTreeParser) treeParserPool.borrowObject();
+            entityTreeParser = treeParserPool.borrowObject();
         } catch (Exception e) {
             throw e instanceof RuntimeException ? (RuntimeException) e : new RuntimeException(e);
         }