fixed launch config for GWT; fixed threading for TrackedRaceImpl

This commit is contained in:
Axel Uhl committed 2012-01-03 18:18:05 +01:00
1 parent 4ecc03cba2
commit f97b20613d
3 files changed
+20 -14

No files matched your search

@@ -9,6 +9,8 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.NavigableSet; import java.util.NavigableSet;
import java.util.concurrent.ConcurrentSkipListSet; import java.util.concurrent.ConcurrentSkipListSet;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;
import java.util.logging.Logger; import java.util.logging.Logger;
import com.sap.sailing.domain.base.Bearing; import com.sap.sailing.domain.base.Bearing;
@@ -103,7 +105,9 @@ public abstract class TrackedRaceImpl implements TrackedRace, CourseListener {
private final Map<Buoy, GPSFixTrack<Buoy, GPSFix>> buoyTracks; private final Map<Buoy, GPSFixTrack<Buoy, GPSFix>> buoyTracks;
private final long millisecondsOverWhichToAverageSpeed; private final long millisecondsOverWhichToAverageSpeed;
private static final Executor executor = Executors.newSingleThreadExecutor();
public TrackedRaceImpl(TrackedEvent trackedEvent, RaceDefinition race, WindStore windStore, public TrackedRaceImpl(TrackedEvent trackedEvent, RaceDefinition race, WindStore windStore,
long millisecondsOverWhichToAverageWind, long millisecondsOverWhichToAverageSpeed) { long millisecondsOverWhichToAverageWind, long millisecondsOverWhichToAverageSpeed) {
super(); super();
@@ -140,6 +144,10 @@ public abstract class TrackedRaceImpl implements TrackedRace, CourseListener {
this.trackedEvent = trackedEvent; this.trackedEvent = trackedEvent;
competitorRankings = new HashMap<TimePoint, List<Competitor>>(); competitorRankings = new HashMap<TimePoint, List<Competitor>>();
} }
private Executor getExecutor() {
return executor;
}
/** /**
* Precondition: race has already been set, e.g., in constructor before this methocd is called * 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 // the track's listeners about the receipt of a new GPS fix which leads to the
// invalidation of the TrackBasedEstimationWindTrackImpl's cache which requests // invalidation of the TrackBasedEstimationWindTrackImpl's cache which requests
// the TrackBasedEstimationWindTrackImpl's monitor. --> deadlock // 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() { public void run() {
synchronized (directionFromStartToNextMarkCacheLock) { synchronized (directionFromStartToNextMarkCacheLock) {
// FIXME don't we have to expect that after cache invalidation the listeners are still subscribed?
addDirectionFromStartToNextMarkCacheInvalidationListener(); addDirectionFromStartToNextMarkCacheInvalidationListener();
directionFromStartToNextMarkCache = finalResult; directionFromStartToNextMarkCache = finalResult;
} }
} }
}.start(); });
} else { } else {
result = null; result = null;
} }
@@ -891,27 +898,26 @@ public abstract class TrackedRaceImpl implements TrackedRace, CourseListener {
@Override @Override
public void gpsFixReceived(GPSFix fix, Buoy buoy) { public void gpsFixReceived(GPSFix fix, Buoy buoy) {
new Thread("StartToNextMarkCacheInvalidationListener.gpsFixReceived for buoy " + buoy.getName()) { getExecutor().execute(new Runnable() {
public void run() { public void run() {
synchronized (directionFromStartToNextMarkCacheLock) { synchronized (directionFromStartToNextMarkCacheLock) {
directionFromStartToNextMarkCache = null; directionFromStartToNextMarkCache = null;
listeningTo.removeListener(StartToNextMarkCacheInvalidationListener.this); listeningTo.removeListener(StartToNextMarkCacheInvalidationListener.this);
} }
} }
}.start(); });
} }
@Override @Override
public void speedAveragingChanged(long oldMillisecondsOverWhichToAverage, long newMillisecondsOverWhichToAverage) { public void speedAveragingChanged(long oldMillisecondsOverWhichToAverage, long newMillisecondsOverWhichToAverage) {
new Thread("StartToNextMarkCacheInvalidationListener.gpsFixReceived for buoy " getExecutor().execute(new Runnable() {
+ listeningTo.getTrackedItem().getName()) {
public void run() { public void run() {
synchronized (directionFromStartToNextMarkCacheLock) { synchronized (directionFromStartToNextMarkCacheLock) {
directionFromStartToNextMarkCache = null; directionFromStartToNextMarkCache = null;
listeningTo.removeListener(StartToNextMarkCacheInvalidationListener.this); listeningTo.removeListener(StartToNextMarkCacheInvalidationListener.this);
} }
} }
}.start(); });
} }
} }
} }
@@ -1,7 +1,7 @@
#Tue Jan 03 14:27:36 CET 2012 #Tue Jan 03 17:31:35 CET 2012
eclipse.preferences.version=1 eclipse.preferences.version=1
jarsExcludedFromWebInfLib= jarsExcludedFromWebInfLib=
lastWarOutDir=C\:/data/SAP/sailing/workspace/java/com.sap.sailing.gwt.ui lastWarOutDir=C\:/data/SAP/sailing/workspace/java/com.sap.sailing.gwt.ui
launchConfigExternalUrlPrefix= launchConfigExternalUrlPrefix=
warSrcDir=war warSrcDir=
warSrcDirIsOutput=false warSrcDirIsOutput=false
+3 -3
View File
@@ -1,10 +1,10 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="com.google.gdt.eclipse.suite.webapp"> <launchConfiguration type="com.google.gdt.eclipse.suite.webapp">
<booleanAttribute key="com.google.gdt.eclipse.core.RUN_SERVER" value="false"/> <booleanAttribute key="com.google.gdt.eclipse.core.RUN_SERVER" value="false"/>
<stringAttribute key="com.google.gdt.eclipse.suiteMainTypeProcessor.PREVIOUSLY_SET_MAIN_TYPE_NAME" value="com.google.gwt.dev.DevMode"/> <stringAttribute key="com.google.gdt.eclipse.suiteMainTypeProcessor.PREVIOUSLY_SET_MAIN_TYPE_NAME" value="com.google.gwt.dev.GWTShell"/>
<booleanAttribute key="com.google.gdt.eclipse.suiteWarArgumentProcessor.IS_WAR_FROM_PROJECT_PROPERTIES" value="true"/> <booleanAttribute key="com.google.gdt.eclipse.suiteWarArgumentProcessor.IS_WAR_FROM_PROJECT_PROPERTIES" value="true"/>
<listAttribute key="com.google.gwt.eclipse.core.ENTRY_POINT_MODULES"> <listAttribute key="com.google.gwt.eclipse.core.ENTRY_POINT_MODULES">
<listEntry value="com.sap.sailing.gwt.ui.UserManagement"/> <listEntry value="com.sap.sailing.gwt.ui.Leaderboard"/>
</listAttribute> </listAttribute>
<stringAttribute key="com.google.gwt.eclipse.core.URL" value="/gwt/AdminConsole.html"/> <stringAttribute key="com.google.gwt.eclipse.core.URL" value="/gwt/AdminConsole.html"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS"> <listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
@@ -19,7 +19,7 @@
</listAttribute> </listAttribute>
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="com.google.gwt.eclipse.core.moduleClasspathProvider"/> <stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="com.google.gwt.eclipse.core.moduleClasspathProvider"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.google.gwt.dev.DevMode"/> <stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.google.gwt.dev.DevMode"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-war &quot;${project_loc:com.sap.sailing.gwt.ui}&quot; -noserver -remoteUI &quot;${gwt_remote_ui_server_port}:${unique_id}&quot; -logLevel INFO -codeServerPort 9997 -startupUrl /gwt/AdminConsole.html com.sap.sailing.gwt.ui.AdminConsole -startupUrl /gwt/Leaderboard.html com.sap.sailing.gwt.ui.Leaderboard -startupUrl /gwt/LeaderboardEditing.html com.sap.sailing.gwt.ui.LeaderboardEditing -startupUrl /gwt/UserManagement.html com.sap.sailing.gwt.ui.UserManagement"/> <stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-war C:\data\SAP\sailing\workspace\java\com.sap.sailing.gwt.ui -noserver -remoteUI &quot;${gwt_remote_ui_server_port}:${unique_id}&quot; -logLevel INFO -codeServerPort 9997 -startupUrl /gwt/AdminConsole.html com.sap.sailing.gwt.ui.AdminConsole -startupUrl /gwt/LeaderboardEditing.html com.sap.sailing.gwt.ui.LeaderboardEditing -startupUrl /gwt/UserManagement.html com.sap.sailing.gwt.ui.UserManagement -startupUrl /gwt/Leaderboard.html com.sap.sailing.gwt.ui.Leaderboard"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.sap.sailing.gwt.ui"/> <stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.sap.sailing.gwt.ui"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx512m"/> <stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx512m"/>
</launchConfiguration> </launchConfiguration>