You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by cd...@apache.org on 2018/01/06 16:19:38 UTC

[incubator-plc4x] branch master updated: SONAR Make the programs terminate (getting rid of the two blocker issues)

This is an automated email from the ASF dual-hosted git repository.

cdutz pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git


The following commit(s) were added to refs/heads/master by this push:
     new 7df5be8  SONAR Make the programs terminate (getting rid of the two blocker issues)
7df5be8 is described below

commit 7df5be858c68f664b1dc0d4660517b8d48af3ed1
Author: Christofer Dutz <ch...@c-ware.de>
AuthorDate: Sat Jan 6 17:19:34 2018 +0100

    SONAR
    Make the programs terminate (getting rid of the two blocker issues)
---
 .../main/java/org/apache/plc4x/java/applications/iotree/IoTree.java    | 3 ++-
 .../java/org/apache/plc4x/java/applications/plclogger/PlcLogger.java   | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/applications/iotree/src/main/java/org/apache/plc4x/java/applications/iotree/IoTree.java b/applications/iotree/src/main/java/org/apache/plc4x/java/applications/iotree/IoTree.java
index 9543a6d..f43bfb0 100644
--- a/applications/iotree/src/main/java/org/apache/plc4x/java/applications/iotree/IoTree.java
+++ b/applications/iotree/src/main/java/org/apache/plc4x/java/applications/iotree/IoTree.java
@@ -74,11 +74,12 @@ public class IoTree {
         // Start logging ...
         dp.submit(top);
 
-        while (true) {
+        while (System.in.available() == 0) {
             Thread.sleep(1000);
             System.out.println(String.format("Internal Variables: %d Digital In: %d Analog In: %d Amplifictaion: %d Max Value: %d Digital Out: %d",
                 internalVariables.get(), digitalInput.get(), analogInput.get(), amplification.get(), maxValue.get(), digitalOutput.get()));
         }
+        System.exit(0);
     }
 
     public static void main(String[] args) {
diff --git a/applications/plclogger/src/main/java/org/apache/plc4x/java/applications/plclogger/PlcLogger.java b/applications/plclogger/src/main/java/org/apache/plc4x/java/applications/plclogger/PlcLogger.java
index 87c37c9..f8e79ea 100644
--- a/applications/plclogger/src/main/java/org/apache/plc4x/java/applications/plclogger/PlcLogger.java
+++ b/applications/plclogger/src/main/java/org/apache/plc4x/java/applications/plclogger/PlcLogger.java
@@ -87,7 +87,7 @@ public class PlcLogger {
             logger.run();
 
             // Yeah ... well prevent the application from exiting ;-)
-            while (true) {
+            while (System.in.available() == 0) {
                 Thread.sleep(1000);
             }
         } catch (Exception e) {

-- 
To stop receiving notification emails like this one, please contact
['"commits@plc4x.apache.org" <co...@plc4x.apache.org>'].