You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by cw...@apache.org on 2015/01/20 17:36:14 UTC

svn commit: r1653287 - /uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/configurator/jp/AgentSession.java

Author: cwiklik
Date: Tue Jan 20 16:36:13 2015
New Revision: 1653287

URL: http://svn.apache.org/r1653287
Log:
UIMA-4066 added boolean to keep the state of the component. If it is stopped dont allow notifictions to agent as the underling transport is not viable (already stopped)

Modified:
    uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/configurator/jp/AgentSession.java

Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/configurator/jp/AgentSession.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/configurator/jp/AgentSession.java?rev=1653287&r1=1653286&r2=1653287&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/configurator/jp/AgentSession.java (original)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-transport/src/main/java/org/apache/uima/ducc/transport/configurator/jp/AgentSession.java Tue Jan 20 16:36:13 2015
@@ -52,6 +52,8 @@ implements IAgentSession, IJobProcessMan
 	
 	private Object stateLock = new Object();
 	
+	private volatile boolean stopped=false;
+	
 	/**
 	 * JMS based adapter C'tor
 	 * 
@@ -92,18 +94,21 @@ implements IAgentSession, IJobProcessMan
 	 * 
 	 */
 	public void notify(ProcessStateUpdate state) {
+		if ( stopped ) {
+			return;
+		}
 		try {
-			ProcessStateUpdateDuccEvent duccEvent = 
+		    ProcessStateUpdateDuccEvent duccEvent = 
 				new ProcessStateUpdateDuccEvent(state);
-      logger.info("notifyAgentWithStatus",null," >>>>>>> UIMA AS Service Deployed - PID:"+pid);
+            //logger.info("notifyAgentWithStatus",null," >>>>>>> UIMA AS Service Deployed - PID:"+pid);
 
-      if (endpoint != null ) {
-        state.setSocketEndpoint(endpoint);
-      }
+            if (endpoint != null ) {
+              state.setSocketEndpoint(endpoint);
+            }
 			//	send the process update to the remote
 			dispatcher.dispatch(duccEvent, System.getenv("IP"));
 			String jmx = state.getProcessJmxUrl() == null ? "N/A" : state.getProcessJmxUrl();
-			logger.info("notifyAgentWithStatus",null,"... UIMA AS Service Deployed - PID:"+pid+". Service State: "+state+". JMX Url:"+jmx+" Dispatched State Update Event to Agent with IP:"+System.getenv("IP"));
+			logger.info("notifyAgentWithStatus",null,"... Job Process State Changed - PID:"+pid+". Process State: "+state.getState().toString()+". JMX Url:"+jmx+" Dispatched State Update Event to Agent with IP:"+System.getenv("IP"));
 		} catch( Exception e) {
 			e.printStackTrace();
 		}
@@ -123,6 +128,7 @@ implements IAgentSession, IJobProcessMan
 	   }
 	}
 	public void stop() throws Exception {
+		stopped = true;
 		dispatcher.stop();
 	}
 }