Merge branch 'master' into racecommittee_app

This commit is contained in:
Armin Zamani committed 2013-05-23 22:46:58 +02:00
commit 3f453acd1d
20 files changed
+487 -367

No files matched your search

@@ -84,13 +84,16 @@ public class SmartFutureCacheDeadlockTest {
public void testBasicLockingAndUnlockingWithScripts() throws InterruptedException {
logger.info("starting testBasicLockingAndUnlockingWithScripts");
assertFalse(lock.getReaders().contains(readerThread));
reader.performAndWait(Command.LOCK_FOR_READ);
assertTrue(lock.getReaders().contains(readerThread));
writer.perform(Command.LOCK_FOR_WRITE);
assertNull(lock.getWriter());
reader.performAndWait(Command.UNLOCK_AFTER_READ);
assertFalse(lock.getReaders().contains(readerThread));
writer.performAndWait(Command.UNLOCK_AFTER_WRITE);
try {
reader.performAndWait(Command.LOCK_FOR_READ);
assertTrue(lock.getReaders().contains(readerThread));
writer.perform(Command.LOCK_FOR_WRITE);
assertNull(lock.getWriter());
} finally {
reader.performAndWait(Command.UNLOCK_AFTER_READ);
assertFalse(lock.getReaders().contains(readerThread));
writer.performAndWait(Command.UNLOCK_AFTER_WRITE);
}
}
@Test
@@ -114,10 +117,13 @@ public class SmartFutureCacheDeadlockTest {
// in suspended mode, the following will trigger a re-calculation immediately,
// and the locks from the readerThread will be propagated to the computing thread
reader.performAndWait(Command.GET_LATEST_FROM_CACHE);
assertNotNull(computingThread);
reader.performAndWait(Command.UNLOCK_AFTER_READ); // this shall unblock the writer
writer.performAndWait(Command.UNLOCK_AFTER_WRITE);
assertTrue(System.currentTimeMillis()-start < 5000); // must not take longer than 5s, otherwise a locking conflict must have occurred;
try {
assertNotNull(computingThread);
} finally {
reader.performAndWait(Command.UNLOCK_AFTER_READ); // this shall unblock the writer
writer.performAndWait(Command.UNLOCK_AFTER_WRITE);
assertTrue(System.currentTimeMillis()-start < 5000); // must not take longer than 5s, otherwise a locking conflict must have occurred;
}
// see also LockUtil.NUMBER_OF_SECONDS_TO_WAIT_FOR_LOCK
}
@@ -129,10 +135,13 @@ public class SmartFutureCacheDeadlockTest {
writer.perform(Command.LOCK_FOR_WRITE);
reader.performAndWait(Command.LOCK_FOR_READ);
reader.performAndWait(Command.UNLOCK_AFTER_READ);
assertNull(lock.getWriter());
reader.performAndWait(Command.UNLOCK_AFTER_READ); // this shall unblock the writer
writer.performAndWait(Command.UNLOCK_AFTER_WRITE);
assertTrue(System.currentTimeMillis()-start < 5000); // must not take longer than 5s, otherwise a locking conflict must have occurred;
try {
assertNull(lock.getWriter());
} finally {
reader.performAndWait(Command.UNLOCK_AFTER_READ); // this shall unblock the writer
writer.performAndWait(Command.UNLOCK_AFTER_WRITE);
assertTrue(System.currentTimeMillis()-start < 5000); // must not take longer than 5s, otherwise a locking conflict must have occurred;
}
// see also LockUtil.NUMBER_OF_SECONDS_TO_WAIT_FOR_LOCK
}
@@ -140,17 +149,21 @@ public class SmartFutureCacheDeadlockTest {
public void testReadReadDeadlockBetweenGetterAndTriggerInAsynchronousScenario() throws InterruptedException {
logger.info("starting testReadReadDeadlockBetweenGetterAndTriggerInAsynchronousScenario");
long start = System.currentTimeMillis();
reader.performAndWait(Command.LOCK_FOR_READ);
writer.perform(Command.LOCK_FOR_WRITE);
writer.waitUntilWaitingForLock();
sfc.triggerUpdate(CACHE_KEY, /* update interval */ null); // starts the update which
// in suspended mode, the following will trigger a re-calculation immediately,
// and the locks from the readerThread will be propagated to the computing thread
reader.performAndWait(Command.GET_LATEST_FROM_CACHE);
assertNotNull(computingThread);
reader.performAndWait(Command.UNLOCK_AFTER_READ); // this shall unblock the writer
writer.performAndWait(Command.UNLOCK_AFTER_WRITE);
assertTrue(System.currentTimeMillis()-start < 10000); // must not take longer than 5s, otherwise a locking conflict must have occurred;
try {
reader.performAndWait(Command.LOCK_FOR_READ);
writer.perform(Command.LOCK_FOR_WRITE);
writer.waitUntilWaitingForLock();
sfc.triggerUpdate(CACHE_KEY, /* update interval */null); // starts the update which
// in suspended mode, the following will trigger a re-calculation immediately,
// and the locks from the readerThread will be propagated to the computing thread
reader.performAndWait(Command.GET_LATEST_FROM_CACHE);
assertNotNull(computingThread);
} finally {
reader.performAndWait(Command.UNLOCK_AFTER_READ); // this shall unblock the writer
writer.performAndWait(Command.UNLOCK_AFTER_WRITE);
assertTrue(System.currentTimeMillis() - start < 10000); // must not take longer than 5s, otherwise a locking
// conflict must have occurred;
}
// see also LockUtil.NUMBER_OF_SECONDS_TO_WAIT_FOR_LOCK
}
@@ -267,6 +280,7 @@ public class SmartFutureCacheDeadlockTest {
} finally {
running = false;
}
logger.info("Took and processed command "+Command.EXIT.name()+" in thread "+Thread.currentThread().getName());
}
}
@@ -19,6 +19,7 @@ import com.sap.sailing.domain.common.TimePoint;
import com.sap.sailing.domain.common.impl.Util;
import com.sap.sailing.domain.leaderboard.Leaderboard;
import com.sap.sailing.domain.leaderboard.LeaderboardGroup;
import com.sap.sailing.domain.leaderboard.MetaLeaderboard;
import com.sap.sailing.domain.leaderboard.RegattaLeaderboard;
import com.sap.sailing.domain.leaderboard.SettableScoreCorrection;
import com.sap.sailing.domain.tracking.TrackedRace;
@@ -47,8 +48,14 @@ public class LeaderboardGroupJsonGetServlet extends AbstractJsonHttpServlet {
JSONArray jsonLeaderboardEntries = new JSONArray();
jsonLeaderboardGroup.put("leaderboards", jsonLeaderboardEntries);
for (Leaderboard leaderboard: leaderboardGroup.getLeaderboards()) {
boolean isMetaLeaderboard = leaderboard instanceof MetaLeaderboard ? true : false;
boolean isRegattaLeaderboard = leaderboard instanceof RegattaLeaderboard ? true : false;
JSONObject jsonLeaderboard = new JSONObject();
jsonLeaderboard.put("name", leaderboard.getName());
jsonLeaderboard.put("displayName", leaderboard.getDisplayName());
jsonLeaderboard.put("isMetaLeaderboard", isMetaLeaderboard);
jsonLeaderboard.put("isRegattaLeaderboard", isRegattaLeaderboard);
jsonLeaderboardEntries.add(jsonLeaderboard);
SettableScoreCorrection scoreCorrection = leaderboard.getScoreCorrection();
@@ -61,7 +68,7 @@ public class LeaderboardGroupJsonGetServlet extends AbstractJsonHttpServlet {
jsonLeaderboard.put("lastScoringUpdate", null);
}
if(leaderboard instanceof RegattaLeaderboard) {
if(isRegattaLeaderboard) {
RegattaLeaderboard regattaLeaderboard = (RegattaLeaderboard) leaderboard;
Regatta regatta = regattaLeaderboard.getRegatta();
@@ -72,6 +79,7 @@ public class LeaderboardGroupJsonGetServlet extends AbstractJsonHttpServlet {
if(regattaSeries != null && Util.size(regattaSeries) == 1) {
Series series = regattaSeries.iterator().next();
jsonLeaderboard.put("seriesName", series.getName());
jsonLeaderboard.put("regattaName", regatta.getName());
JSONArray jsonFleetsEntries = new JSONArray();
jsonLeaderboard.put("fleets", jsonFleetsEntries);
@@ -88,7 +96,6 @@ public class LeaderboardGroupJsonGetServlet extends AbstractJsonHttpServlet {
for(RaceColumnInSeries raceColumn: series.getRaceColumns()) {
JSONObject jsonRaceColumn = new JSONObject();
jsonRaceColumn.put("name", raceColumn.getName());
jsonRaceColumn.put("regattaName", regatta.getName());
jsonRaceColumn.put("isMedalRace" , raceColumn.isMedalRace());
TrackedRace trackedRace = raceColumn.getTrackedRace(fleet);
@@ -106,6 +113,7 @@ public class LeaderboardGroupJsonGetServlet extends AbstractJsonHttpServlet {
} else {
jsonLeaderboard.put("scoringScheme", leaderboard.getScoringScheme().getType());
jsonLeaderboard.put("seriesName", "Default");
jsonLeaderboard.put("regattaName", null);
JSONArray jsonFleetsEntries = new JSONArray();
jsonLeaderboard.put("fleets", jsonFleetsEntries);
@@ -129,11 +137,9 @@ public class LeaderboardGroupJsonGetServlet extends AbstractJsonHttpServlet {
if(trackedRace != null) {
jsonRaceColumn.put("isTracked", true);
jsonRaceColumn.put("trackedRaceName", trackedRace.getRace().getName());
jsonRaceColumn.put("regattaName", trackedRace.getRaceIdentifier().getRegattaName());
} else {
jsonRaceColumn.put("isTracked", false);
jsonRaceColumn.put("trackedRaceName", null);
jsonRaceColumn.put("regattaName", null);
}
jsonRacesEntries.add(jsonRaceColumn);
}
@@ -3,6 +3,8 @@
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="resources"/>
<classpathentry kind="con" path="com.google.gwt.eclipse.core.GWT_CONTAINER"/>
<classpathentry combineaccessrules="false" kind="src" path="/com.sap.sailing.gwt.ui"/>
<classpathentry kind="output" path="bin"/>
</classpath>
@@ -1,4 +1,6 @@
source.. = src/
source.. = src/,\
resources/
output.. = bin/
bin.includes = META-INF/,\
.
.,\
resources/
File renamed without changes.
Internal Server Error - Gitea: Git with a cup of tea
500 Internal Server Error

An error occurred:

An error occurred

Gitea Version: 28.1.0