Revision: 17897
          http://sourceforge.net/p/gate/code/17897
Author:   markagreenwood
Date:     2014-04-24 10:36:26 +0000 (Thu, 24 Apr 2014)
Log Message:
-----------
split the reinit from the duplication code to make things easier to understand 
and to prevent possible classloader leakage

Modified Paths:
--------------
    gate/trunk/plugins/JAPE_Plus/src/gate/jape/plus/Transducer.java

Modified: gate/trunk/plugins/JAPE_Plus/src/gate/jape/plus/Transducer.java
===================================================================
--- gate/trunk/plugins/JAPE_Plus/src/gate/jape/plus/Transducer.java     
2014-04-24 07:21:34 UTC (rev 17896)
+++ gate/trunk/plugins/JAPE_Plus/src/gate/jape/plus/Transducer.java     
2014-04-24 10:36:26 UTC (rev 17897)
@@ -569,7 +569,19 @@
     }
   }
 
- 
+  @Override
+  public void reInit() throws ResourceInstantiationException {
+    existingTransducer = null;
+    
+    if(classLoaderRefCount.decrementAndGet() == 0) {
+      Gate.getClassLoader().forgetClassLoader(classLoader);
+    }
+    
+    classLoaderRefCount = new AtomicInteger(0);
+    classLoader = null;
+    
+    init();
+  }
   
   @Override
   public Resource init() throws ResourceInstantiationException {
@@ -599,12 +611,6 @@
           }
         }
       } else {
-        if (classLoader != null) {
-          if(classLoaderRefCount.decrementAndGet() == 0) {
-            Gate.getClassLoader().forgetClassLoader(classLoader);
-          }
-        }
-        
         // sanity check parameters
         if(binaryGrammarURL == null && grammarURL == null) {
           throw new ResourceInstantiationException(
@@ -641,7 +647,7 @@
       actionContext = initActionContext();
       return this;
     } catch(Exception e) {
-      if(classLoaderRefCount.decrementAndGet() == 0) {
+      if(classLoaderRefCount.decrementAndGet() <= 0) {
         Gate.getClassLoader().forgetClassLoader(classLoader);
       }
       if(e instanceof ResourceInstantiationException) {

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Start Your Social Network Today - Download eXo Platform
Build your Enterprise Intranet with eXo Platform Software
Java Based Open Source Intranet - Social, Extensible, Cloud Ready
Get Started Now And Turn Your Intranet Into A Collaboration Platform
http://p.sf.net/sfu/ExoPlatform
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs

Reply via email to