From e066e4431bb4aed0812e2f33c6faf12e244bbc8b Mon Sep 17 00:00:00 2001 From: Ziver Koc Date: Thu, 7 Aug 2014 15:23:41 +0200 Subject: [PATCH] Fixed issue where empty list was freezing the app --- .../com/ericsson/uecontrol/core/UeControlExecutor.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/ericsson/uecontrol/core/UeControlExecutor.java b/app/src/main/java/com/ericsson/uecontrol/core/UeControlExecutor.java index 9a0e53e..c2d0333 100755 --- a/app/src/main/java/com/ericsson/uecontrol/core/UeControlExecutor.java +++ b/app/src/main/java/com/ericsson/uecontrol/core/UeControlExecutor.java @@ -72,12 +72,17 @@ public class UeControlExecutor implements Runnable, UeBehaviour.DataHandledListe try { thread.wait(); }catch(InterruptedException e) {log.error(null,e);} } } + // Sleep for some time to get correct status + try{ Thread.sleep(20); }catch(Exception e){log.error(null,e);} } - public synchronized void terminate(){ + private void terminateNonBlock(){ terminate = true; if(currentlyActive != null) currentlyActive.terminate(); + } + public synchronized void terminate(){ + terminateNonBlock(); // Wait for the execution to finnish if(isRunning()){ @@ -108,7 +113,7 @@ public class UeControlExecutor implements Runnable, UeBehaviour.DataHandledListe while(!terminate) { if(behaviours.isEmpty()) { currentlyActive = null; - terminate(); + terminateNonBlock(); synchronized (thread){thread.notifyAll();} break; }