Repository: incubator-systemml
Updated Branches:
  refs/heads/master 27298766a -> 472e47a5f


Fix DMLAppMasterStatusReporter thread cancel bug.

Closes #122.


Project: http://git-wip-us.apache.org/repos/asf/incubator-systemml/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-systemml/commit/472e47a5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-systemml/tree/472e47a5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-systemml/diff/472e47a5

Branch: refs/heads/master
Commit: 472e47a5f4cbceb283b7aa487f505d85e504ea2e
Parents: 2729876
Author: grapebaba <[email protected]>
Authored: Fri Apr 22 16:45:48 2016 -0700
Committer: Deron Eriksson <[email protected]>
Committed: Fri Apr 22 16:45:48 2016 -0700

----------------------------------------------------------------------
 .../org/apache/sysml/yarn/DMLAppMasterStatusReporter.java    | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-systemml/blob/472e47a5/src/main/java/org/apache/sysml/yarn/DMLAppMasterStatusReporter.java
----------------------------------------------------------------------
diff --git 
a/src/main/java/org/apache/sysml/yarn/DMLAppMasterStatusReporter.java 
b/src/main/java/org/apache/sysml/yarn/DMLAppMasterStatusReporter.java
index bdc4a28..73b6441 100644
--- a/src/main/java/org/apache/sysml/yarn/DMLAppMasterStatusReporter.java
+++ b/src/main/java/org/apache/sysml/yarn/DMLAppMasterStatusReporter.java
@@ -33,7 +33,7 @@ public class DMLAppMasterStatusReporter extends Thread
        
        private AMRMClient<ContainerRequest> _rmClient;
        private long _interval; //in ms
-       private boolean _stop;  
+       private volatile boolean _stop;
        
        
        public DMLAppMasterStatusReporter(AMRMClient<ContainerRequest> 
rmClient, long interval) 
@@ -46,12 +46,13 @@ public class DMLAppMasterStatusReporter extends Thread
        public void stopStatusReporter()
        {
                _stop = true;
+               interrupt();
        }
        
        @Override
        public void run() 
        {
-               while( !_stop ) 
+               while( !_stop && !Thread.currentThread().isInterrupted())
                {
                        try
                        {
@@ -61,6 +62,9 @@ public class DMLAppMasterStatusReporter extends Thread
                                //sleep for interval ms until next report
                                Thread.sleep( _interval );
                        }
+                       catch(InterruptedException ex){
+                               LOG.warn("Status reporter interrupted with 
stop=" + _stop);
+                       }
                        catch(Exception ex)
                        {
                                LOG.error("Failed to report status to 
ResourceManager.", ex);

Reply via email to