From 88b7b90971765ac11f6375d357ee5d0cf604a798 Mon Sep 17 00:00:00 2001 From: Axel Uhl Date: Fri, 7 Feb 2014 16:42:27 +0100 Subject: [PATCH 1/3] added comment on why it's now 8 tolerated process decreases in the TracTrac connector; update Proxy/8889 launch config --- .../impl/TracTracRaceTrackerImpl.java | 72 +++++++++++++++---- ...ailingServer (Proxy, Jetty on 8889).launch | 4 +- 2 files changed, 62 insertions(+), 14 deletions(-) diff --git a/java/com.sap.sailing.domain.tractracadapter/src/com/sap/sailing/domain/tractracadapter/impl/TracTracRaceTrackerImpl.java b/java/com.sap.sailing.domain.tractracadapter/src/com/sap/sailing/domain/tractracadapter/impl/TracTracRaceTrackerImpl.java index 3b5f28e8a3a..88b855b530f 100755 --- a/java/com.sap.sailing.domain.tractracadapter/src/com/sap/sailing/domain/tractracadapter/impl/TracTracRaceTrackerImpl.java +++ b/java/com.sap.sailing.domain.tractracadapter/src/com/sap/sailing/domain/tractracadapter/impl/TracTracRaceTrackerImpl.java @@ -98,7 +98,9 @@ public class TracTracRaceTrackerImpl extends AbstractRaceTrackerImpl implements * reported by the threads. The function that calculates the total progress is: * *
-     *   total_progress = sum(progress(thread_i)) / sum(weight(thread_i))
+ * total_progress = sum(progress(thread_i)) / sum(weight(thread_i)) + * + * * The weight is also the maximum individual progress that a thread can send: if a thread has a weight = 10 its * progress only can be between 0 and 10, e.g,: *

@@ -112,35 +114,81 @@ public class TracTracRaceTrackerImpl extends AbstractRaceTrackerImpl implements * The total progress that you receive is: * *

-     *   total_progress = 0 + 0 / 10 + 1 = 0 / 11 = 0
+ * total_progress = 0 + 0 / 10 + 1 = 0 / 11 = 0 + * * * Then, the "Course thread" retrieves the course from the server and it sends a new progress message to the system: * *
-     *   Course thread -> weight = 1, progress = 1  ---> total_progress = 0 + 1 /  10 + 1 = 1 / 11 = 0.090909091
+ * Course thread -> weight = 1, progress = 1 ---> total_progress = 0 + 1 / 10 + 1 = 1 / 11 = 0.090909091 + * * * Then, the "Competitor positions thread" goes to the server and it checks that there is a high number of positions * for the competitors. It decides to change its weight: * *
-     *   Competitor positions thread -> weight = 50, progress = 0 --> total_progress = 0 + 1 / 50 + 1 = 1 / 51 = 0.019607843
+ * Competitor positions thread -> weight = 50, progress = 0 --> total_progress = 0 + 1 / 50 + 1 = 1 / 51 = 0.019607843 + * * * Then, the "Competitor positions thread" starts to retrieve positions and it sends several messages updating the * progress: * * * This example shows that is possible to receive more that 3 values of the progress lower than one already - * received. It happens because the weight of the threads changes."

+ * received. It happens because the weight of the threads changes." + *

* - * We assume that there won't be more than six threads in TTCM receiving data for the same race. + * We assume that there won't be more than eight threads in TTCM receiving data for the same race, based on Jorge's + * statement from 2014-02-06: "One thread per subscription where the subscriptions are: + *

+ * Potentially, you can create 8 threads per TTCM (connecting only with one single race)." */ - static final Integer MAX_STORED_PACKET_HOP_ALLOWANCE = 6; + static final Integer MAX_STORED_PACKET_HOP_ALLOWANCE = 8; private final Event tractracEvent; private final com.sap.sailing.domain.base.Regatta regatta; diff --git a/java/com.sap.sailing.server/SailingServer (Proxy, Jetty on 8889).launch b/java/com.sap.sailing.server/SailingServer (Proxy, Jetty on 8889).launch index d017174feb0..58ccb8d7909 100755 --- a/java/com.sap.sailing.server/SailingServer (Proxy, Jetty on 8889).launch +++ b/java/com.sap.sailing.server/SailingServer (Proxy, Jetty on 8889).launch @@ -22,10 +22,10 @@ - + - + From 64a0cc981cb2e04336ba7f9f747c4c06ab020222 Mon Sep 17 00:00:00 2001 From: Axel Uhl Date: Fri, 7 Feb 2014 18:09:12 +0100 Subject: [PATCH 2/3] avoid redundant specification of TracTrac mtb cache dir property name --- .../domain/tractracadapter/impl/TracTracRaceTrackerImpl.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/java/com.sap.sailing.domain.tractracadapter/src/com/sap/sailing/domain/tractracadapter/impl/TracTracRaceTrackerImpl.java b/java/com.sap.sailing.domain.tractracadapter/src/com/sap/sailing/domain/tractracadapter/impl/TracTracRaceTrackerImpl.java index 03c17f8bddf..b95e6e40d46 100755 --- a/java/com.sap.sailing.domain.tractracadapter/src/com/sap/sailing/domain/tractracadapter/impl/TracTracRaceTrackerImpl.java +++ b/java/com.sap.sailing.domain.tractracadapter/src/com/sap/sailing/domain/tractracadapter/impl/TracTracRaceTrackerImpl.java @@ -363,8 +363,9 @@ public class TracTracRaceTrackerImpl extends AbstractRaceTrackerImpl implements } private URI checkForCachedStoredData(URI storedURI){ - if (System.getProperty("tractrac.mtb.cache.dir") != null) { - final String directory = System.getProperty("tractrac.mtb.cache.dir"); + final String CACHE_DIR_PROPERTY = "tractrac.mtb.cache.dir"; + if (System.getProperty(CACHE_DIR_PROPERTY) != null) { + final String directory = System.getProperty(CACHE_DIR_PROPERTY); if (new File(directory).exists()) { final String[] pathFragments = storedURI.getPath().split("\\/"); final String mtbFileName = pathFragments[pathFragments.length-1]; From e7a6bb32297dd29fec0996ba75967b6f0e6d1169 Mon Sep 17 00:00:00 2001 From: Axel Uhl Date: Fri, 7 Feb 2014 18:10:48 +0100 Subject: [PATCH 3/3] null-check for new raceStatus flag --- .../domain/tractracadapter/impl/TracTracRaceTrackerImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/java/com.sap.sailing.domain.tractracadapter/src/com/sap/sailing/domain/tractracadapter/impl/TracTracRaceTrackerImpl.java b/java/com.sap.sailing.domain.tractracadapter/src/com/sap/sailing/domain/tractracadapter/impl/TracTracRaceTrackerImpl.java index b95e6e40d46..540193145d4 100755 --- a/java/com.sap.sailing.domain.tractracadapter/src/com/sap/sailing/domain/tractracadapter/impl/TracTracRaceTrackerImpl.java +++ b/java/com.sap.sailing.domain.tractracadapter/src/com/sap/sailing/domain/tractracadapter/impl/TracTracRaceTrackerImpl.java @@ -317,7 +317,7 @@ public class TracTracRaceTrackerImpl extends AbstractRaceTrackerImpl implements // check if there is a directory configured where stored data files can be cached // only cache files for races in REPLAY state - if (raceStatus.equals(TracTracConnectionConstants.REPLAY_STATUS)) { + if (raceStatus != null && raceStatus.equals(TracTracConnectionConstants.REPLAY_STATUS)) { storedURI = checkForCachedStoredData(storedURI); }