From f97b20613d98a6b117e3cf7d8719eca329d26b6b Mon Sep 17 00:00:00 2001 From: Axel Uhl Date: Tue, 3 Jan 2012 18:18:05 +0100 Subject: [PATCH] fixed launch config for GWT; fixed threading for TrackedRaceImpl --- .../domain/tracking/impl/TrackedRaceImpl.java | 24 ++++++++++++------- .../com.google.gdt.eclipse.core.prefs | 4 ++-- java/com.sap.sailing.gwt.ui/SailingGWT.launch | 6 ++--- 3 files changed, 20 insertions(+), 14 deletions(-) mode change 100644 => 100755 java/com.sap.sailing.gwt.ui/SailingGWT.launch diff --git a/java/com.sap.sailing.domain/src/com/sap/sailing/domain/tracking/impl/TrackedRaceImpl.java b/java/com.sap.sailing.domain/src/com/sap/sailing/domain/tracking/impl/TrackedRaceImpl.java index 7c4f3b3c9b1..ea8a8ab585d 100644 --- a/java/com.sap.sailing.domain/src/com/sap/sailing/domain/tracking/impl/TrackedRaceImpl.java +++ b/java/com.sap.sailing.domain/src/com/sap/sailing/domain/tracking/impl/TrackedRaceImpl.java @@ -9,6 +9,8 @@ import java.util.List; import java.util.Map; import java.util.NavigableSet; import java.util.concurrent.ConcurrentSkipListSet; +import java.util.concurrent.Executor; +import java.util.concurrent.Executors; import java.util.logging.Logger; import com.sap.sailing.domain.base.Bearing; @@ -103,7 +105,9 @@ public abstract class TrackedRaceImpl implements TrackedRace, CourseListener { private final Map> buoyTracks; private final long millisecondsOverWhichToAverageSpeed; - + + private static final Executor executor = Executors.newSingleThreadExecutor(); + public TrackedRaceImpl(TrackedEvent trackedEvent, RaceDefinition race, WindStore windStore, long millisecondsOverWhichToAverageWind, long millisecondsOverWhichToAverageSpeed) { super(); @@ -140,6 +144,10 @@ public abstract class TrackedRaceImpl implements TrackedRace, CourseListener { this.trackedEvent = trackedEvent; competitorRankings = new HashMap>(); } + + private Executor getExecutor() { + return executor; + } /** * Precondition: race has already been set, e.g., in constructor before this methocd is called @@ -430,15 +438,14 @@ public abstract class TrackedRaceImpl implements TrackedRace, CourseListener { // the track's listeners about the receipt of a new GPS fix which leads to the // invalidation of the TrackBasedEstimationWindTrackImpl's cache which requests // the TrackBasedEstimationWindTrackImpl's monitor. --> deadlock - new Thread("Adding cache invalidation listener for start/first-mark direction for "+getRace().getName()) { + getExecutor().execute(new Runnable() { public void run() { synchronized (directionFromStartToNextMarkCacheLock) { - // FIXME don't we have to expect that after cache invalidation the listeners are still subscribed? addDirectionFromStartToNextMarkCacheInvalidationListener(); directionFromStartToNextMarkCache = finalResult; } } - }.start(); + }); } else { result = null; } @@ -891,27 +898,26 @@ public abstract class TrackedRaceImpl implements TrackedRace, CourseListener { @Override public void gpsFixReceived(GPSFix fix, Buoy buoy) { - new Thread("StartToNextMarkCacheInvalidationListener.gpsFixReceived for buoy " + buoy.getName()) { + getExecutor().execute(new Runnable() { public void run() { synchronized (directionFromStartToNextMarkCacheLock) { directionFromStartToNextMarkCache = null; listeningTo.removeListener(StartToNextMarkCacheInvalidationListener.this); } } - }.start(); + }); } @Override public void speedAveragingChanged(long oldMillisecondsOverWhichToAverage, long newMillisecondsOverWhichToAverage) { - new Thread("StartToNextMarkCacheInvalidationListener.gpsFixReceived for buoy " - + listeningTo.getTrackedItem().getName()) { + getExecutor().execute(new Runnable() { public void run() { synchronized (directionFromStartToNextMarkCacheLock) { directionFromStartToNextMarkCache = null; listeningTo.removeListener(StartToNextMarkCacheInvalidationListener.this); } } - }.start(); + }); } } } diff --git a/java/com.sap.sailing.gwt.ui/.settings/com.google.gdt.eclipse.core.prefs b/java/com.sap.sailing.gwt.ui/.settings/com.google.gdt.eclipse.core.prefs index 034fcacfb0d..00efca0d4af 100644 --- a/java/com.sap.sailing.gwt.ui/.settings/com.google.gdt.eclipse.core.prefs +++ b/java/com.sap.sailing.gwt.ui/.settings/com.google.gdt.eclipse.core.prefs @@ -1,7 +1,7 @@ -#Tue Jan 03 14:27:36 CET 2012 +#Tue Jan 03 17:31:35 CET 2012 eclipse.preferences.version=1 jarsExcludedFromWebInfLib= lastWarOutDir=C\:/data/SAP/sailing/workspace/java/com.sap.sailing.gwt.ui launchConfigExternalUrlPrefix= -warSrcDir=war +warSrcDir= warSrcDirIsOutput=false diff --git a/java/com.sap.sailing.gwt.ui/SailingGWT.launch b/java/com.sap.sailing.gwt.ui/SailingGWT.launch old mode 100644 new mode 100755 index cabc0fce0ca..82d266e2a38 --- a/java/com.sap.sailing.gwt.ui/SailingGWT.launch +++ b/java/com.sap.sailing.gwt.ui/SailingGWT.launch @@ -1,10 +1,10 @@ - + - + @@ -19,7 +19,7 @@ - +