uima-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sc...@apache.org
Subject svn commit: r619507 - /incubator/uima/sandbox/trunk/uima-ee/uimaj-ee-core/src/main/java/org/apache/uima/aae/controller/UimacppServiceController.java
Date Thu, 07 Feb 2008 17:01:24 GMT
Author: schor
Date: Thu Feb  7 09:01:23 2008
New Revision: 619507

URL: http://svn.apache.org/viewvc?rev=619507&view=rev
Log:
[UIMA-748]

Modified:
    incubator/uima/sandbox/trunk/uima-ee/uimaj-ee-core/src/main/java/org/apache/uima/aae/controller/UimacppServiceController.java

Modified: incubator/uima/sandbox/trunk/uima-ee/uimaj-ee-core/src/main/java/org/apache/uima/aae/controller/UimacppServiceController.java
URL: http://svn.apache.org/viewvc/incubator/uima/sandbox/trunk/uima-ee/uimaj-ee-core/src/main/java/org/apache/uima/aae/controller/UimacppServiceController.java?rev=619507&r1=619506&r2=619507&view=diff
==============================================================================
--- incubator/uima/sandbox/trunk/uima-ee/uimaj-ee-core/src/main/java/org/apache/uima/aae/controller/UimacppServiceController.java
(original)
+++ incubator/uima/sandbox/trunk/uima-ee/uimaj-ee-core/src/main/java/org/apache/uima/aae/controller/UimacppServiceController.java
Thu Feb  7 09:01:23 2008
@@ -96,9 +96,7 @@
 
   private int initialFsHeapSize;
   
-  //private ControllerCallbackListener listener;
-  
-  private List listeners = new ArrayList();
+  private ArrayList<ControllerCallbackListener> listeners = new ArrayList<ControllerCallbackListener>();
   
   /**
    * Configure and start a Uima C++ service that connects to an ActiveMG
@@ -577,19 +575,20 @@
     mbean.shutdown();
     if (jmxMgmt != null) {
       try {
-		    this.jmxMgmt.destroy();
-		    if (listeners != null) {
-		      for (int i=0;i < listeners.size(); i++) {
-		        ControllerCallbackListener listener = (ControllerCallbackListener) listeners.get(i);
-		        if (listener != null) {
-		          listener.notifyOnTermination("Uima C++ service shutdown.");
-		        }
-		      }
-		    }
+		    this.jmxMgmt.destroy();		    
 	    } catch (Exception e) {
 		    throw new IOException(e.getMessage());
 	    }
     }
+    if (listeners != null) {
+      for (int i=0;i < listeners.size(); i++) {
+        ControllerCallbackListener listener = (ControllerCallbackListener) listeners.get(i);
+        if (listener != null) {
+          listener.notifyOnTermination("Uima C++ service shutdown.");
+        }
+      }
+      listeners.clear();
+    }
     loggerConnection.close();
     commandConnection.close();
     server.close();
@@ -617,27 +616,14 @@
     }
   }
 
-  /**
-   * 
-   */
-/**
-  public void finalize() throws UIMAException, IOException,
-      InterruptedException {
-    System.out.println("finalize ");
-    this.listeners=null; // prevent calling of listeners.
-    shutdown();
-    loggerConnection.close();
-    commandConnection.close();
-    server.close();
-  }
-**/
+ 
   /**
    * test
    * 
    * @param args
    */
   public static void main(String[] args) {
-    HashMap<String, String> envVarMap = new HashMap();
+    HashMap<String, String> envVarMap = new HashMap<String, String>();
     
     try {
     	if (System.getProperty("os.name").startsWith("Windows")) {
@@ -926,15 +912,14 @@
     try {
       rc = uimacppProcess.waitFor();
       message += "rc=" + rc;
-      System.out.println(message);
       if (listeners != null) {
-          for (int i=0;i < listeners.size(); i++) {
-            ControllerCallbackListener listener = (ControllerCallbackListener) listeners.get(i);
-            if (listener != null) {
-              listener.notifyOnTermination(message);
-            }
+        for (int i=0;i < listeners.size(); i++) {
+          ControllerCallbackListener listener = (ControllerCallbackListener) listeners.get(i);
+          if (listener != null) {
+            listener.notifyOnTermination(message);
           }
-          listeners = null;
+        }
+        listeners.clear();
       }
     } catch (InterruptedException e) {
       this.uimaLogger.log(Level.INFO, e.getMessage());
@@ -946,7 +931,7 @@
              listener.notifyOnTermination(message);
            }
          }
-         listeners = null;
+         listeners.clear(); 
        }
     }
     



Mime
View raw message