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 2012/05/08 17:33:56 UTC
svn commit: r1335594 -
/uima/uima-as/trunk/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/service/UIMA_Service.java
Author: cwiklik
Date: Tue May 8 15:33:55 2012
New Revision: 1335594
URL: http://svn.apache.org/viewvc?rev=1335594&view=rev
Log:
UIMA-2396 Modified to stop jmx monitor thread when user types 's' or 'q'
Modified:
uima/uima-as/trunk/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/service/UIMA_Service.java
Modified: uima/uima-as/trunk/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/service/UIMA_Service.java
URL: http://svn.apache.org/viewvc/uima/uima-as/trunk/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/service/UIMA_Service.java?rev=1335594&r1=1335593&r2=1335594&view=diff
==============================================================================
--- uima/uima-as/trunk/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/service/UIMA_Service.java (original)
+++ uima/uima-as/trunk/uimaj-as-activemq/src/main/java/org/apache/uima/adapter/jms/service/UIMA_Service.java Tue May 8 15:33:55 2012
@@ -273,7 +273,24 @@ public class UIMA_Service implements App
}
}
-
+ /**
+ * Creates an instance of a {@link JmxMonitor}, initializes it with the JMX Server URI and
+ * checkpoint frequency, and finally starts the monitor.
+ *
+ * @param samplingFrequency
+ * - how often the JmxMonitor should checkpoint to fetch service metrics
+ *
+ * @throws Exception
+ * - error on monitor initialization or startup
+ */
+ public void stopMonitor() throws Exception {
+ if ( monitor != null ) {
+ monitor.doStop();
+ }
+ if ( monitorThread != null ) {
+ monitorThread.interrupt(); // the thread may be in wait()
+ }
+ }
/**
* scan args for a particular arg, return the following token or the empty string if not found
*
@@ -422,8 +439,10 @@ public class UIMA_Service implements App
if (System.in.available() > 0) {
int c = System.in.read();
if (c == 's') {
+ service.stopMonitor();
serviceDeployer.undeploy(SpringContainerDeployer.STOP_NOW);
} else if (c == 'q') {
+ service.stopMonitor();
serviceDeployer.undeploy(SpringContainerDeployer.QUIESCE_AND_STOP);
} else if (Character.isLetter(c) || Character.isDigit(c)) {
System.out.println(prompt);