Repository: cloudslang/cloud-slang
Issue: Sporadic test failures - Travis

SimpleFlowTest.testFlowWithGlobalSession
DataFlowTest.testBindingsFlow

detailed log here: https://gist.github.com/Bonczidai/864f936c36238b5c903b


Changed files:
cloudslang-all/src/test/java/io/cloudslang/lang/api/SlangImplTest.java
cloudslang-cli/src/main/java/io/cloudslang/lang/cli/SlangCLI.java
cloudslang-tests/src/main/java/io/cloudslang/lang/systemtests/TriggerFlows.java
cloudslang-content-verifier/src/main/java/io/cloudslang/lang/tools/build/SlangBuildMain.java

diff --git a/cloudslang-all/src/test/java/io/cloudslang/lang/api/SlangImplTest.java b/cloudslang-all/src/test/java/io/cloudslang/lang/api/SlangImplTest.java
index 4c3951725..81ae20b96 100644
--- a/cloudslang-all/src/test/java/io/cloudslang/lang/api/SlangImplTest.java
+++ b/cloudslang-all/src/test/java/io/cloudslang/lang/api/SlangImplTest.java
@@ -214,7 +214,7 @@ public class SlangImplTest {
     private class EventListener implements ScoreEventListener{
 
         @Override
-        public void onEvent(ScoreEvent event) throws InterruptedException {
+        public synchronized void onEvent(ScoreEvent event) throws InterruptedException {
 
         }
     }
diff --git a/cloudslang-cli/src/main/java/io/cloudslang/lang/cli/SlangCLI.java b/cloudslang-cli/src/main/java/io/cloudslang/lang/cli/SlangCLI.java
index 872301ac6..a7ae45c3f 100644
--- a/cloudslang-cli/src/main/java/io/cloudslang/lang/cli/SlangCLI.java
+++ b/cloudslang-cli/src/main/java/io/cloudslang/lang/cli/SlangCLI.java
@@ -156,7 +156,7 @@ public class SlangCLI implements CommandMarker {
         handlerTypes.add(ScoreLangConstants.EVENT_EXECUTION_FINISHED);
         scoreServices.subscribe(new ScoreEventListener() {
             @Override
-            public void onEvent(ScoreEvent event) {
+            public synchronized void onEvent(ScoreEvent event) {
                 logEvent(event);
             }
         }, handlerTypes);
diff --git a/cloudslang-content-verifier/src/main/java/io/cloudslang/lang/tools/build/SlangBuildMain.java b/cloudslang-content-verifier/src/main/java/io/cloudslang/lang/tools/build/SlangBuildMain.java
index 8efd31825..033a35a48 100644
--- a/cloudslang-content-verifier/src/main/java/io/cloudslang/lang/tools/build/SlangBuildMain.java
+++ b/cloudslang-content-verifier/src/main/java/io/cloudslang/lang/tools/build/SlangBuildMain.java
@@ -233,7 +233,7 @@ public class SlangBuildMain {
     private static void registerEventHandlers(Slang slang) {
         slang.subscribeOnAllEvents(new ScoreEventListener() {
             @Override
-            public void onEvent(ScoreEvent event) {
+            public synchronized void onEvent(ScoreEvent event) {
                 logEvent(event);
             }
         });
diff --git a/cloudslang-tests/src/main/java/io/cloudslang/lang/systemtests/TriggerFlows.java b/cloudslang-tests/src/main/java/io/cloudslang/lang/systemtests/TriggerFlows.java
index bad0014bd..fd2aeb7ad 100644
--- a/cloudslang-tests/src/main/java/io/cloudslang/lang/systemtests/TriggerFlows.java
+++ b/cloudslang-tests/src/main/java/io/cloudslang/lang/systemtests/TriggerFlows.java
@@ -47,7 +47,7 @@ public class TriggerFlows {
         final BlockingQueue<ScoreEvent> finishEvent = new LinkedBlockingQueue<>();
         ScoreEventListener finishListener = new ScoreEventListener() {
             @Override
-            public void onEvent(ScoreEvent event) throws InterruptedException {
+            public synchronized void onEvent(ScoreEvent event) throws InterruptedException {
                 finishEvent.add(event);
             }
         };