cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r1408920 - in /cayenne/main/trunk/framework/cayenne-tools/src/main/java/org/apache/cayenne/tools: DbGeneratorTask.java DbImporterTask.java
Date Tue, 13 Nov 2012 19:50:36 GMT
Author: aadamchik
Date: Tue Nov 13 19:50:35 2012
New Revision: 1408920

URL: http://svn.apache.org/viewvc?rev=1408920&view=rev
Log:
cleanup - make sure injector is shutdown after task execution

Modified:
    cayenne/main/trunk/framework/cayenne-tools/src/main/java/org/apache/cayenne/tools/DbGeneratorTask.java
    cayenne/main/trunk/framework/cayenne-tools/src/main/java/org/apache/cayenne/tools/DbImporterTask.java

Modified: cayenne/main/trunk/framework/cayenne-tools/src/main/java/org/apache/cayenne/tools/DbGeneratorTask.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-tools/src/main/java/org/apache/cayenne/tools/DbGeneratorTask.java?rev=1408920&r1=1408919&r2=1408920&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-tools/src/main/java/org/apache/cayenne/tools/DbGeneratorTask.java
(original)
+++ cayenne/main/trunk/framework/cayenne-tools/src/main/java/org/apache/cayenne/tools/DbGeneratorTask.java
Tue Nov 13 19:50:35 2012
@@ -57,7 +57,7 @@ public class DbGeneratorTask extends Cay
     public void execute() {
 
         Log logger = new AntLogger(this);
-        Injector injector = DIBootstrap.createInjector(new ToolsModule(logger));
+       
 
         log(String.format("connection settings - [driver: %s, url: %s, username: %s]", driver,
url, userName),
                 Project.MSG_VERBOSE);
@@ -69,6 +69,7 @@ public class DbGeneratorTask extends Cay
         validateAttributes();
 
         ClassLoader loader = null;
+        Injector injector = DIBootstrap.createInjector(new ToolsModule(logger));
         try {
             loader = Thread.currentThread().getContextClassLoader();
             Thread.currentThread().setContextClassLoader(DbGeneratorTask.class.getClassLoader());
@@ -104,6 +105,7 @@ public class DbGeneratorTask extends Cay
             throw new BuildException(message, th);
         } finally {
             Thread.currentThread().setContextClassLoader(loader);
+            injector.shutdown();
         }
     }
 

Modified: cayenne/main/trunk/framework/cayenne-tools/src/main/java/org/apache/cayenne/tools/DbImporterTask.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-tools/src/main/java/org/apache/cayenne/tools/DbImporterTask.java?rev=1408920&r1=1408919&r2=1408920&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-tools/src/main/java/org/apache/cayenne/tools/DbImporterTask.java
(original)
+++ cayenne/main/trunk/framework/cayenne-tools/src/main/java/org/apache/cayenne/tools/DbImporterTask.java
Tue Nov 13 19:50:35 2012
@@ -81,6 +81,9 @@ public class DbImporterTask extends Task
             log(message, Project.MSG_ERR);
             throw new BuildException(message, th);
         }
+        finally {
+            injector.shutdown();
+        }
     }
 
     /**



Mime
View raw message