mirror of
https://github.com/eclipse-sailing-analytics/sailing-analytics.git
synced 2026-11-04 01:59:35 +00:00
Merge remote-tracking branch 'origin/master' into dataMining
This commit is contained in:
commit
25df0c8918
32 files changed
+434
-142
No files matched your search
@@ -1,13 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
||||
<listEntry value="/com.sap.sailing.declination/src/com/sap/sailing/declination/impl/DeclinationStore.java"/>
|
||||
</listAttribute>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
|
||||
<listEntry value="1"/>
|
||||
</listAttribute>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.sap.sailing.declination.impl.DeclinationStore"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="2014 2014 1"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.sap.sailing.declination"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dhttp.proxyHost=proxy.wdf.sap.corp -Dhttp.proxyPort=8080"/>
|
||||
</launchConfiguration>
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
||||
<listEntry value="/com.sap.sailing.declination/src/com/sap/sailing/declination/impl/DeclinationStore.java"/>
|
||||
</listAttribute>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
|
||||
<listEntry value="1"/>
|
||||
</listAttribute>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.sap.sailing.declination.impl.DeclinationStore"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="2015 2015 1"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.sap.sailing.declination"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dhttp.proxyHost=proxy.wdf.sap.corp -Dhttp.proxyPort=8080"/>
|
||||
</launchConfiguration>
|
||||
+2
-2
@@ -103,7 +103,6 @@ import com.sap.sailing.domain.common.RegattaName;
|
||||
import com.sap.sailing.domain.common.RegattaNameAndRaceName;
|
||||
import com.sap.sailing.domain.common.ScoringSchemeType;
|
||||
import com.sap.sailing.domain.common.SpeedWithBearing;
|
||||
import com.sap.sailing.domain.common.TimeRange;
|
||||
import com.sap.sailing.domain.common.WindSource;
|
||||
import com.sap.sailing.domain.common.WindSourceType;
|
||||
import com.sap.sailing.domain.common.configuration.DeviceConfigurationMatcherType;
|
||||
@@ -111,7 +110,6 @@ import com.sap.sailing.domain.common.impl.DegreeBearingImpl;
|
||||
import com.sap.sailing.domain.common.impl.DegreePosition;
|
||||
import com.sap.sailing.domain.common.impl.KnotSpeedWithBearingImpl;
|
||||
import com.sap.sailing.domain.common.impl.RGBColor;
|
||||
import com.sap.sailing.domain.common.impl.TimeRangeImpl;
|
||||
import com.sap.sailing.domain.common.impl.WindSourceImpl;
|
||||
import com.sap.sailing.domain.common.impl.WindSourceWithAdditionalID;
|
||||
import com.sap.sailing.domain.common.racelog.Flags;
|
||||
@@ -157,8 +155,10 @@ import com.sap.sailing.server.gateway.deserialization.impl.DeviceConfigurationJs
|
||||
import com.sap.sailing.server.gateway.deserialization.impl.Helpers;
|
||||
import com.sap.sailing.server.gateway.deserialization.impl.RegattaConfigurationJsonDeserializer;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
import com.sap.sse.common.TimeRange;
|
||||
import com.sap.sse.common.Util;
|
||||
import com.sap.sse.common.impl.MillisecondsTimePoint;
|
||||
import com.sap.sse.common.impl.TimeRangeImpl;
|
||||
|
||||
public class DomainObjectFactoryImpl implements DomainObjectFactory {
|
||||
private static final Logger logger = Logger.getLogger(DomainObjectFactoryImpl.class.getName());
|
||||
|
||||
+1
-1
@@ -73,7 +73,6 @@ import com.sap.sailing.domain.common.PassingInstruction;
|
||||
import com.sap.sailing.domain.common.RaceIdentifier;
|
||||
import com.sap.sailing.domain.common.Speed;
|
||||
import com.sap.sailing.domain.common.SpeedWithBearing;
|
||||
import com.sap.sailing.domain.common.TimeRange;
|
||||
import com.sap.sailing.domain.common.WindSource;
|
||||
import com.sap.sailing.domain.common.racelog.tracking.NoCorrespondingServiceRegisteredException;
|
||||
import com.sap.sailing.domain.common.racelog.tracking.TransformationException;
|
||||
@@ -100,6 +99,7 @@ import com.sap.sailing.server.gateway.serialization.impl.CompetitorJsonSerialize
|
||||
import com.sap.sailing.server.gateway.serialization.impl.DeviceConfigurationJsonSerializer;
|
||||
import com.sap.sailing.server.gateway.serialization.impl.RegattaConfigurationJsonSerializer;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
import com.sap.sse.common.TimeRange;
|
||||
import com.sap.sse.common.Util;
|
||||
import com.sap.sse.common.WithID;
|
||||
import com.sap.sse.common.impl.MillisecondsTimePoint;
|
||||
|
||||
+2
-2
@@ -21,8 +21,6 @@ import com.sap.sailing.domain.abstractlog.race.tracking.analyzing.impl.DeviceCom
|
||||
import com.sap.sailing.domain.abstractlog.race.tracking.analyzing.impl.DeviceMarkMappingFinder;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.base.Mark;
|
||||
import com.sap.sailing.domain.common.TimeRange;
|
||||
import com.sap.sailing.domain.common.impl.TimeRangeImpl;
|
||||
import com.sap.sailing.domain.common.racelog.tracking.NoCorrespondingServiceRegisteredException;
|
||||
import com.sap.sailing.domain.common.racelog.tracking.TransformationException;
|
||||
import com.sap.sailing.domain.common.racelog.tracking.TypeBasedServiceFinder;
|
||||
@@ -40,7 +38,9 @@ import com.sap.sailing.domain.tracking.DynamicGPSFixTrack;
|
||||
import com.sap.sailing.domain.tracking.GPSFix;
|
||||
import com.sap.sailing.domain.tracking.GPSFixMoving;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
import com.sap.sse.common.TimeRange;
|
||||
import com.sap.sse.common.Util;
|
||||
import com.sap.sse.common.impl.TimeRangeImpl;
|
||||
|
||||
/**
|
||||
* At the moment, the timerange covered by the fixes for a device, and the number of
|
||||
|
||||
+1
-1
@@ -22,7 +22,6 @@ import com.sap.sailing.domain.base.impl.CourseImpl;
|
||||
import com.sap.sailing.domain.base.impl.RaceDefinitionImpl;
|
||||
import com.sap.sailing.domain.base.impl.RegattaImpl;
|
||||
import com.sap.sailing.domain.base.impl.WaypointImpl;
|
||||
import com.sap.sailing.domain.common.impl.TimeRangeImpl;
|
||||
import com.sap.sailing.domain.common.racelog.tracking.NoCorrespondingServiceRegisteredException;
|
||||
import com.sap.sailing.domain.common.racelog.tracking.TransformationException;
|
||||
import com.sap.sailing.domain.racelog.impl.EmptyRaceLogStore;
|
||||
@@ -34,6 +33,7 @@ import com.sap.sailing.domain.tracking.impl.AbstractRaceChangeListener;
|
||||
import com.sap.sailing.domain.tracking.impl.DynamicTrackedRaceImpl;
|
||||
import com.sap.sailing.domain.tracking.impl.DynamicTrackedRegattaImpl;
|
||||
import com.sap.sailing.domain.tracking.impl.EmptyWindStore;
|
||||
import com.sap.sse.common.impl.TimeRangeImpl;
|
||||
|
||||
public class TrackedRaceLoadsFixesTest extends AbstractGPSFixStoreTest {
|
||||
private final BoatClass boatClass = DomainFactory.INSTANCE.getOrCreateBoatClass("49er");
|
||||
|
||||
@@ -11,7 +11,6 @@ Require-Bundle: com.sap.sailing.domain,
|
||||
com.sap.sailing.domain.shared.android,
|
||||
com.sap.sailing.server.gateway.serialization,
|
||||
com.sap.sailing.domain.persistence,
|
||||
com.sap.sailing.server.gateway,
|
||||
com.sap.sailing.server,
|
||||
com.googlecode.java-diff-utils;bundle-version="1.3.0",
|
||||
com.mongodb.driver,
|
||||
|
||||
+273
@@ -0,0 +1,273 @@
|
||||
package com.sap.sailing.util.test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Random;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
|
||||
import com.sap.sailing.util.impl.ConcurrentHashBag;
|
||||
|
||||
/**
|
||||
* Initiated by bug 2502 (http://bugzilla.sapsailing.com/bugzilla/show_bug.cgi?id=2502), this test tries to reproduce a
|
||||
* race condition that can lead to negative sizes and therefore negative array indices.
|
||||
*
|
||||
* @author Axel Uhl (D043530)
|
||||
*
|
||||
*/
|
||||
public class ConcurrentHashBagTest {
|
||||
final static Random random = new Random();
|
||||
private ConcurrentHashBag<String> bag;
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
bag = new ConcurrentHashBag<>();
|
||||
}
|
||||
|
||||
/**
|
||||
* Trying to provoke a negative size() value using two different keys
|
||||
*/
|
||||
@Test
|
||||
public void testMassConcurrentInsertAndRemove() throws InterruptedException {
|
||||
final boolean[] sawNegativeSize = new boolean[1];
|
||||
final boolean[] stopped = new boolean[1];
|
||||
final Runnable adderRemover = () -> {
|
||||
while (!stopped[0]) {
|
||||
bag.add("a");
|
||||
bag.add("b");
|
||||
bag.remove("a");
|
||||
bag.remove("b");
|
||||
}
|
||||
};
|
||||
Thread t1 = new Thread(adderRemover);
|
||||
Thread t2 = new Thread(adderRemover);
|
||||
Thread t3 = new Thread(adderRemover);
|
||||
Thread t4 = new Thread(adderRemover);
|
||||
Thread t5 = new Thread(() -> {
|
||||
while (!stopped[0]) {
|
||||
if (bag.size() < 0) {
|
||||
sawNegativeSize[0] = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
t1.start();
|
||||
t2.start();
|
||||
t3.start();
|
||||
t4.start();
|
||||
t5.start();
|
||||
Thread.sleep(1000);
|
||||
stopped[0] = true;
|
||||
assertFalse(sawNegativeSize[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Trying to provoke a negative size() value using only one key
|
||||
*/
|
||||
@Test
|
||||
public void testMassConcurrentInsertAndRemoveWithSingleKey() throws InterruptedException {
|
||||
final boolean[] sawNegativeSize = new boolean[1];
|
||||
final boolean[] stopped = new boolean[1];
|
||||
final Runnable adderRemover = () -> {
|
||||
while (!stopped[0]) {
|
||||
bag.add("a");
|
||||
bag.remove("a");
|
||||
}
|
||||
};
|
||||
Thread t1 = new Thread(adderRemover);
|
||||
Thread t2 = new Thread(adderRemover);
|
||||
Thread t3 = new Thread(adderRemover);
|
||||
Thread t4 = new Thread(adderRemover);
|
||||
Thread t5 = new Thread(() -> {
|
||||
while (!stopped[0]) {
|
||||
if (bag.size() < 0) {
|
||||
sawNegativeSize[0] = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
t1.start();
|
||||
t2.start();
|
||||
t3.start();
|
||||
t4.start();
|
||||
t5.start();
|
||||
Thread.sleep(1000);
|
||||
stopped[0] = true;
|
||||
assertFalse(sawNegativeSize[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Trying to provoke a negative size() value using only one key
|
||||
*/
|
||||
@Test
|
||||
public void testMassConcurrentInsertAndRemoveWithSingleKeyRemovingMoreThanAdded() throws InterruptedException {
|
||||
final boolean[] sawNegativeSize = new boolean[1];
|
||||
final boolean[] stopped = new boolean[1];
|
||||
final Runnable aAdderRemover = () -> {
|
||||
while (!stopped[0]) {
|
||||
bag.add("a");
|
||||
bag.remove("a");
|
||||
bag.remove("a");
|
||||
}
|
||||
};
|
||||
final Runnable randomAdderRemover = () -> {
|
||||
while (!stopped[0]) {
|
||||
final String s = ""+((char)(((int) 'A')+random.nextInt(26)))+((char)(((int)'A')+random.nextInt(26)));
|
||||
bag.add(s);
|
||||
}
|
||||
};
|
||||
Thread t1 = new Thread(aAdderRemover);
|
||||
Thread t2 = new Thread(randomAdderRemover);
|
||||
Thread t3 = new Thread(randomAdderRemover);
|
||||
Thread t4 = new Thread(randomAdderRemover);
|
||||
Thread t5 = new Thread(() -> {
|
||||
while (!stopped[0]) {
|
||||
if (bag.size() < 0) {
|
||||
sawNegativeSize[0] = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
t1.start();
|
||||
t2.start();
|
||||
t3.start();
|
||||
t4.start();
|
||||
t5.start();
|
||||
Thread.sleep(1000);
|
||||
stopped[0] = true;
|
||||
assertFalse(sawNegativeSize[0]);
|
||||
}
|
||||
|
||||
private static class BooleanHolder {
|
||||
public volatile boolean b;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMassConcurrentInsertAndRemoveWithRandomizedReentrance() throws InterruptedException {
|
||||
final ConcurrentHashBag<Thread> bag = new ConcurrentHashBag<>();
|
||||
|
||||
final int NUMBER_OF_THREADS = 500;
|
||||
final boolean[] sawNegativeSize = new boolean[1];
|
||||
final BooleanHolder stopped = new BooleanHolder();
|
||||
final Runnable aAdderRemover = () -> {
|
||||
final Thread currentThread = Thread.currentThread();
|
||||
while (!stopped.b) {
|
||||
bag.add(Thread.currentThread());
|
||||
bag.remove(currentThread);
|
||||
}
|
||||
};
|
||||
final Runnable randomAdderRemover = () -> {
|
||||
final Thread currentThread = Thread.currentThread();
|
||||
while (!stopped.b) {
|
||||
final int reentranceLevel = 1+random.nextInt(2);
|
||||
for (int i=0; i<reentranceLevel; i++) {
|
||||
bag.add(currentThread);
|
||||
}
|
||||
for (int i=0; i<reentranceLevel; i++) {
|
||||
bag.remove(currentThread);
|
||||
}
|
||||
}
|
||||
};
|
||||
final Thread[] threads = new Thread[NUMBER_OF_THREADS];
|
||||
Thread t1 = new Thread(aAdderRemover);
|
||||
t1.start();
|
||||
for (int i=0; i<NUMBER_OF_THREADS; i++) {
|
||||
Thread t2 = new Thread(randomAdderRemover);
|
||||
threads[i] = t2;
|
||||
t2.start();
|
||||
}
|
||||
Thread t5 = new Thread(() -> {
|
||||
while (!stopped.b) {
|
||||
if (bag.size() < 0) {
|
||||
sawNegativeSize[0] = true;
|
||||
}
|
||||
}
|
||||
});
|
||||
t5.start();
|
||||
Thread.sleep(2000);
|
||||
stopped.b = true;
|
||||
assertFalse(sawNegativeSize[0]);
|
||||
t1.join();
|
||||
t5.join();
|
||||
for (int i=0; i<NUMBER_OF_THREADS; i++) {
|
||||
threads[i].join();
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIteratorRemove() {
|
||||
bag.add("123");
|
||||
bag.add("234");
|
||||
bag.add("345");
|
||||
bag.add("234");
|
||||
bag.add("345");
|
||||
bag.add("0");
|
||||
final int sizeBeforeRemove = bag.size();
|
||||
for (Iterator<String> i=bag.iterator(); i.hasNext(); ) {
|
||||
String next = i.next();
|
||||
if (next.equals("123")) {
|
||||
i.remove();
|
||||
}
|
||||
}
|
||||
assertFalse(bag.contains("123"));
|
||||
assertEquals(sizeBeforeRemove-1, bag.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIteratorRemoveFirstOfMultiple() {
|
||||
bag.add("123");
|
||||
bag.add("234");
|
||||
bag.add("345");
|
||||
bag.add("234");
|
||||
bag.add("345");
|
||||
bag.add("0");
|
||||
final int sizeBeforeRemove = bag.size();
|
||||
for (Iterator<String> i=bag.iterator(); i.hasNext(); ) {
|
||||
String next = i.next();
|
||||
if (next.equals("234")) {
|
||||
i.remove();
|
||||
break;
|
||||
}
|
||||
}
|
||||
assertTrue(bag.contains("234"));
|
||||
assertEquals(sizeBeforeRemove-1, bag.size());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIteratorRemoveThrowsExceptionBeforeNext() {
|
||||
bag.add("123");
|
||||
bag.add("234");
|
||||
bag.add("345");
|
||||
bag.add("234");
|
||||
bag.add("345");
|
||||
bag.add("0");
|
||||
Iterator<String> i=bag.iterator();
|
||||
try {
|
||||
i.remove();
|
||||
fail("Expected IllegalArgumentException");
|
||||
} catch (IllegalStateException e) {
|
||||
// this is expected
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testIteratorRemoveThrowsExceptionAfterRemoveWithoutNext() {
|
||||
bag.add("123");
|
||||
bag.add("234");
|
||||
bag.add("345");
|
||||
bag.add("234");
|
||||
bag.add("345");
|
||||
bag.add("0");
|
||||
Iterator<String> i=bag.iterator();
|
||||
i.next();
|
||||
i.remove();
|
||||
try {
|
||||
i.remove();
|
||||
fail("Expected IllegalArgumentException");
|
||||
} catch (IllegalStateException e) {
|
||||
// this is expected
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -5,7 +5,7 @@ import java.util.List;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.race.tracking.analyzing.impl.DeviceMappingFinder;
|
||||
import com.sap.sailing.domain.base.Timed;
|
||||
import com.sap.sailing.domain.common.TimeRange;
|
||||
import com.sap.sse.common.TimeRange;
|
||||
import com.sap.sse.common.WithID;
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
package com.sap.sailing.domain.abstractlog.race.tracking;
|
||||
|
||||
import com.sap.sailing.domain.base.Timed;
|
||||
import com.sap.sailing.domain.common.TimeRange;
|
||||
import com.sap.sse.common.TimeRange;
|
||||
|
||||
public interface DeviceWithTimeRange extends Timed {
|
||||
DeviceIdentifier getDevice();
|
||||
|
||||
+2
-2
@@ -16,10 +16,10 @@ import com.sap.sailing.domain.abstractlog.race.tracking.DeviceIdentifier;
|
||||
import com.sap.sailing.domain.abstractlog.race.tracking.DeviceMapping;
|
||||
import com.sap.sailing.domain.abstractlog.race.tracking.DeviceMappingEvent;
|
||||
import com.sap.sailing.domain.abstractlog.race.tracking.impl.DeviceMappingImpl;
|
||||
import com.sap.sailing.domain.common.TimeRange;
|
||||
import com.sap.sailing.domain.common.impl.TimeRangeImpl;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
import com.sap.sse.common.TimeRange;
|
||||
import com.sap.sse.common.WithID;
|
||||
import com.sap.sse.common.impl.TimeRangeImpl;
|
||||
|
||||
/**
|
||||
* Extracts the {@link DeviceMapping}s with the appropriate {@link TimeRange}s from the {@link RaceLog}.
|
||||
|
||||
+2
-2
@@ -7,10 +7,10 @@ import java.util.List;
|
||||
import com.sap.sailing.domain.abstractlog.race.tracking.DeviceIdentifier;
|
||||
import com.sap.sailing.domain.abstractlog.race.tracking.DeviceMapping;
|
||||
import com.sap.sailing.domain.abstractlog.race.tracking.DeviceMappingEvent;
|
||||
import com.sap.sailing.domain.common.TimeRange;
|
||||
import com.sap.sailing.domain.common.impl.TimeRangeImpl;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
import com.sap.sse.common.TimeRange;
|
||||
import com.sap.sse.common.WithID;
|
||||
import com.sap.sse.common.impl.TimeRangeImpl;
|
||||
|
||||
public class DeviceMappingImpl<ItemType extends WithID> implements DeviceMapping<ItemType> {
|
||||
private static final long serialVersionUID = -4602948402371623654L;
|
||||
|
||||
+16
-6
@@ -3,6 +3,7 @@ package com.sap.sailing.util.impl;
|
||||
import java.util.AbstractCollection;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
/**
|
||||
* An "almost" thread-safe bag implementation. The constraint: when for equal objects an add or remove is performed,
|
||||
@@ -12,7 +13,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
*/
|
||||
public class ConcurrentHashBag<T> extends AbstractCollection<T> {
|
||||
private ConcurrentHashMap<T, Integer> map = new ConcurrentHashMap<T, Integer>();
|
||||
private int size;
|
||||
private final AtomicInteger size = new AtomicInteger();
|
||||
|
||||
@Override
|
||||
public boolean contains(Object o) {
|
||||
@@ -28,7 +29,11 @@ public class ConcurrentHashBag<T> extends AbstractCollection<T> {
|
||||
map.put(t, oldCount - 1);
|
||||
}
|
||||
if (oldCount != null) {
|
||||
size--;
|
||||
if (size.get() == 0) {
|
||||
throw new RuntimeException("Internal error: size==0 although we just think we found an element that we rmeoved: "+o);
|
||||
} else {
|
||||
size.decrementAndGet();
|
||||
}
|
||||
}
|
||||
return oldCount != null;
|
||||
}
|
||||
@@ -39,7 +44,7 @@ public class ConcurrentHashBag<T> extends AbstractCollection<T> {
|
||||
if (oldCount != null && oldCount != 0) {
|
||||
map.put(e, oldCount + 1);
|
||||
}
|
||||
size++;
|
||||
size.incrementAndGet();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -50,7 +55,7 @@ public class ConcurrentHashBag<T> extends AbstractCollection<T> {
|
||||
|
||||
@Override
|
||||
public int size() {
|
||||
return size;
|
||||
return size.get();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -61,6 +66,7 @@ public class ConcurrentHashBag<T> extends AbstractCollection<T> {
|
||||
private class Iterator implements java.util.Iterator<T> {
|
||||
private final java.util.Iterator<Entry<T, Integer>> iter = map.entrySet().iterator();
|
||||
private int howManyMore = 0;
|
||||
private boolean canRemove;
|
||||
private T lastElementOfWhichWeHaveMore;
|
||||
|
||||
@Override
|
||||
@@ -80,13 +86,17 @@ public class ConcurrentHashBag<T> extends AbstractCollection<T> {
|
||||
lastElementOfWhichWeHaveMore = next.getKey();
|
||||
result = next.getKey();
|
||||
}
|
||||
canRemove = true;
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
if (!canRemove) {
|
||||
throw new IllegalStateException("Can't remove through iterator without calling next");
|
||||
}
|
||||
ConcurrentHashBag.this.remove(lastElementOfWhichWeHaveMore);
|
||||
canRemove = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
+4
-6
@@ -102,14 +102,14 @@ public class NamedReentrantReadWriteLock extends ReentrantReadWriteLock implemen
|
||||
@Override
|
||||
public void lock() {
|
||||
readLock.lock();
|
||||
readers.add(Thread.currentThread());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void lockInterruptibly() throws InterruptedException {
|
||||
try {
|
||||
readLock.lockInterruptibly();
|
||||
final Thread currentThread = Thread.currentThread();
|
||||
readers.add(currentThread);
|
||||
readers.add(Thread.currentThread());
|
||||
} catch (InterruptedException ie) {
|
||||
throw ie;
|
||||
}
|
||||
@@ -119,8 +119,7 @@ public class NamedReentrantReadWriteLock extends ReentrantReadWriteLock implemen
|
||||
public boolean tryLock() {
|
||||
boolean result = readLock.tryLock();
|
||||
if (result) {
|
||||
final Thread currentThread = Thread.currentThread();
|
||||
readers.add(currentThread);
|
||||
readers.add(Thread.currentThread());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -129,8 +128,7 @@ public class NamedReentrantReadWriteLock extends ReentrantReadWriteLock implemen
|
||||
public boolean tryLock(long timeout, TimeUnit unit) throws InterruptedException {
|
||||
boolean result = readLock.tryLock(timeout, unit);
|
||||
if (result) {
|
||||
final Thread currentThread = Thread.currentThread();
|
||||
readers.add(currentThread);
|
||||
readers.add(Thread.currentThread());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
+2
-2
@@ -8,10 +8,10 @@ import junit.framework.Assert;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import com.sap.sailing.domain.common.TimeRange;
|
||||
import com.sap.sailing.domain.common.impl.TimeRangeImpl;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
import com.sap.sse.common.TimeRange;
|
||||
import com.sap.sse.common.impl.MillisecondsTimePoint;
|
||||
import com.sap.sse.common.impl.TimeRangeImpl;
|
||||
|
||||
public class TimeRangeTest {
|
||||
protected TimeRange create(long from, long to) {
|
||||
|
||||
+25
-6
@@ -5,6 +5,7 @@ import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@@ -66,6 +67,13 @@ public class LiveLeaderboardUpdater implements Runnable {
|
||||
*/
|
||||
private LeaderboardDTO currentLiveLeaderboard;
|
||||
|
||||
/**
|
||||
* When the evaluation of the live leaderboard has resulted in an exception, the exception will be passed on
|
||||
* to callers of {@link #getLiveLeaderboard(Collection, boolean)}, wrapped by an {@link ExecutionException}.
|
||||
*
|
||||
*/
|
||||
private Exception currentException;
|
||||
|
||||
/**
|
||||
* Column names for which {@link #currentLiveLeaderboard} has the details
|
||||
*/
|
||||
@@ -124,7 +132,15 @@ public class LiveLeaderboardUpdater implements Runnable {
|
||||
return leaderboard;
|
||||
}
|
||||
|
||||
public LeaderboardDTO getLiveLeaderboard(Collection<String> namesOfRaceColumnsForWhichToLoadLegDetails, boolean addOverallDetails) throws NoWindException {
|
||||
/**
|
||||
* If the calculation of the live leaderboard has terminated abnormally by throwing an exception during the last
|
||||
* re-calculation attempt, another re-calculation is waited for. If that again terminates abnormally by throwing an
|
||||
* exception, that exception will be thrown by this method, wrapped by an {@link ExecutionException}. Otherwise,
|
||||
* this method will return the last live leaderboard calculated that has the columns and details requested. If the
|
||||
* last live leaderboard calculated doesn't have the requested properties, the method waits for the next calculation
|
||||
* to finish which is expected to provide the leaderboard for the details and columns requested.
|
||||
*/
|
||||
public LeaderboardDTO getLiveLeaderboard(Collection<String> namesOfRaceColumnsForWhichToLoadLegDetails, boolean addOverallDetails) throws NoWindException, ExecutionException {
|
||||
LeaderboardDTO result = null;
|
||||
updateRequestTimes(namesOfRaceColumnsForWhichToLoadLegDetails, addOverallDetails);
|
||||
ensureRunning();
|
||||
@@ -162,6 +178,9 @@ public class LiveLeaderboardUpdater implements Runnable {
|
||||
} catch (InterruptedException e) {
|
||||
logger.log(Level.INFO, "interrupted while waiting for LiveLeaderboardCache update", e);
|
||||
}
|
||||
if (currentException != null) {
|
||||
throw new ExecutionException(currentException);
|
||||
}
|
||||
if (columnNamesForWhichCurrentLiveLeaderboardHasTheDetails.containsAll(namesOfRaceColumnsForWhichToLoadLegDetails) &&
|
||||
(!addOverallDetails || currentLiveLeaderboardHasOverallDetails)) {
|
||||
result = currentLiveLeaderboard;
|
||||
@@ -238,6 +257,7 @@ public class LiveLeaderboardUpdater implements Runnable {
|
||||
*/
|
||||
private synchronized void updateCacheContents(Collection<String> namesOfRaceColumnsForWhichToLoadLegDetails,
|
||||
boolean addOverallDetails, LeaderboardDTO result) {
|
||||
currentException = null;
|
||||
columnNamesForWhichCurrentLiveLeaderboardHasTheDetails.clear();
|
||||
columnNamesForWhichCurrentLiveLeaderboardHasTheDetails.addAll(namesOfRaceColumnsForWhichToLoadLegDetails);
|
||||
currentLiveLeaderboard = result;
|
||||
@@ -279,9 +299,7 @@ public class LiveLeaderboardUpdater implements Runnable {
|
||||
/* waitForLatestAnalyses */false, trackedRegattaRegistry, baseDomainFactory, /* fillNetPointsUncorrected */ false);
|
||||
updateCacheContents(namesOfRaceColumnsForWhichToLoadLegDetails, addOverallDetails, newCacheValue);
|
||||
} catch (NoWindException e) {
|
||||
logger.info("Unable to update cached leaderboard results for leaderboard " + leaderboard.getName() + ": "
|
||||
+ e.getMessage());
|
||||
logger.throwing(LiveLeaderboardUpdater.class.getName(), "run", e);
|
||||
logger.log(Level.SEVERE, "Exception during re-calculating the live leaderboard "+leaderboard.getName(), e);
|
||||
try {
|
||||
Thread.sleep(1000); // avoid running into the same NoWindException too quickly
|
||||
} catch (InterruptedException e1) {
|
||||
@@ -305,9 +323,10 @@ public class LiveLeaderboardUpdater implements Runnable {
|
||||
synchronized (this) {
|
||||
running = false;
|
||||
currentLiveLeaderboard = null;
|
||||
currentException = e;
|
||||
notifyAll();
|
||||
}
|
||||
logger.info("exception in "+LiveLeaderboardUpdater.class.getName()+".run(): "+e.getMessage());
|
||||
logger.throwing(LiveLeaderboardUpdater.class.getName(), "run", e);
|
||||
logger.log(Level.SEVERE, "exception updating live leaderboard "+leaderboard.getName(), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1746,7 +1746,7 @@ public abstract class AbstractSimpleLeaderboardImpl implements Leaderboard, Race
|
||||
}
|
||||
|
||||
private LeaderboardDTO getLiveLeaderboard(Collection<String> namesOfRaceColumnsForWhichToLoadLegDetails,
|
||||
boolean addOverallDetails, TrackedRegattaRegistry trackedRegattaRegistry, DomainFactory baseDomainFactory) throws NoWindException {
|
||||
boolean addOverallDetails, TrackedRegattaRegistry trackedRegattaRegistry, DomainFactory baseDomainFactory) throws NoWindException, ExecutionException {
|
||||
LiveLeaderboardUpdater liveLeaderboardUpdater = getLiveLeaderboardUpdater(trackedRegattaRegistry,
|
||||
baseDomainFactory);
|
||||
return liveLeaderboardUpdater.getLiveLeaderboard(namesOfRaceColumnsForWhichToLoadLegDetails, addOverallDetails);
|
||||
|
||||
+1
-1
@@ -5,10 +5,10 @@ import com.sap.sailing.domain.abstractlog.race.tracking.DeviceIdentifier;
|
||||
import com.sap.sailing.domain.abstractlog.race.tracking.DeviceMapping;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.base.Mark;
|
||||
import com.sap.sailing.domain.common.TimeRange;
|
||||
import com.sap.sailing.domain.tracking.DynamicGPSFixTrack;
|
||||
import com.sap.sailing.domain.tracking.GPSFix;
|
||||
import com.sap.sailing.domain.tracking.GPSFixMoving;
|
||||
import com.sap.sse.common.TimeRange;
|
||||
|
||||
public enum EmptyGPSFixStore implements GPSFixStore {
|
||||
INSTANCE;
|
||||
|
||||
+1
-1
@@ -7,12 +7,12 @@ import com.sap.sailing.domain.abstractlog.race.tracking.DeviceMapping;
|
||||
import com.sap.sailing.domain.abstractlog.race.tracking.DeviceMarkMappingEvent;
|
||||
import com.sap.sailing.domain.base.Competitor;
|
||||
import com.sap.sailing.domain.base.Mark;
|
||||
import com.sap.sailing.domain.common.TimeRange;
|
||||
import com.sap.sailing.domain.common.racelog.tracking.NoCorrespondingServiceRegisteredException;
|
||||
import com.sap.sailing.domain.common.racelog.tracking.TransformationException;
|
||||
import com.sap.sailing.domain.tracking.DynamicGPSFixTrack;
|
||||
import com.sap.sailing.domain.tracking.GPSFix;
|
||||
import com.sap.sailing.domain.tracking.GPSFixMoving;
|
||||
import com.sap.sse.common.TimeRange;
|
||||
|
||||
|
||||
public interface GPSFixStore {
|
||||
|
||||
+9
-14
@@ -528,19 +528,14 @@ public class GPSFixTrackImpl<ItemType, FixType extends GPSFix> extends TrackImpl
|
||||
if (fromPos == null) {
|
||||
result = Distance.NULL;
|
||||
} else {
|
||||
lockForRead();
|
||||
try {
|
||||
NavigableSet<GPSFix> subset = getGPSFixes().subSet(new DummyGPSFix(from),
|
||||
/* fromInclusive */false, new DummyGPSFix(to),
|
||||
/* toInclusive */false);
|
||||
for (GPSFix fix : subset) {
|
||||
double distanceBetweenAdjacentFixesInNauticalMiles = fromPos.getDistance(
|
||||
fix.getPosition()).getNauticalMiles();
|
||||
distanceInNauticalMiles += distanceBetweenAdjacentFixesInNauticalMiles;
|
||||
fromPos = fix.getPosition();
|
||||
}
|
||||
} finally {
|
||||
unlockAfterRead();
|
||||
NavigableSet<GPSFix> subset = getGPSFixes().subSet(new DummyGPSFix(from),
|
||||
/* fromInclusive */false, new DummyGPSFix(to),
|
||||
/* toInclusive */false);
|
||||
for (GPSFix fix : subset) {
|
||||
double distanceBetweenAdjacentFixesInNauticalMiles = fromPos.getDistance(
|
||||
fix.getPosition()).getNauticalMiles();
|
||||
distanceInNauticalMiles += distanceBetweenAdjacentFixesInNauticalMiles;
|
||||
fromPos = fix.getPosition();
|
||||
}
|
||||
Position toPos = getEstimatedPosition(to, false);
|
||||
distanceInNauticalMiles += fromPos.getDistance(toPos).getNauticalMiles();
|
||||
@@ -1065,8 +1060,8 @@ public class GPSFixTrackImpl<ItemType, FixType extends GPSFix> extends TrackImpl
|
||||
}
|
||||
if (logger.isLoggable(Level.FINEST)) {
|
||||
FixType last;
|
||||
lockForRead();
|
||||
try {
|
||||
lockForRead();
|
||||
if (logger.isLoggable(Level.FINEST)) {
|
||||
logger.finest("GPS fix "+fix+" for "+getTrackedItem()+", isValid="+isValid(getInternalRawFixes(), fix)+
|
||||
", time/distance/speed from last: "+
|
||||
|
||||
@@ -3,6 +3,10 @@
|
||||
<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.GWTShell"/>
|
||||
<booleanAttribute key="com.google.gdt.eclipse.suiteWarArgumentProcessor.IS_WAR_FROM_PROJECT_PROPERTIES" value="true"/>
|
||||
<listAttribute key="com.google.gwt.eclipse.core.ENTRY_POINT_MODULES">
|
||||
<listEntry value="com.sap.sailing.gwt.ui.VideoPopup"/>
|
||||
<listEntry value="com.sap.sailing.gwt.ui.Simulator"/>
|
||||
</listAttribute>
|
||||
<stringAttribute key="com.google.gwt.eclipse.core.URL" value="/gwt/Home.html"/>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
||||
<listEntry value="/com.sap.sailing.gwt.ui"/>
|
||||
@@ -15,41 +19,41 @@
|
||||
<listEntry value="org.eclipse.debug.ui.launchGroup.run"/>
|
||||
</listAttribute>
|
||||
<listAttribute key="org.eclipse.jdt.launching.CLASSPATH">
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6" javaProject="com.sap.sailing.gwt.ui" path="1" type="4"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.gwt.ui/src/main/resources" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.gwt.ui/src/main/java" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.domain/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.googlecode.java-diff-utils/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.domain.common/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/org.json.simple/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.server/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.domain.tractracadapter/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.expeditionconnector/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.declination/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.declination/resources" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.udpconnector/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sse.mongodb/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.domain.swisstimingadapter/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.domain.persistence/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.domain.swisstimingadapter.persistence/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.domain.tractracadapter.persistence/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/org.moxieapps.gwt.highcharts/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.geocoding/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.datamining.shared/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sse.common/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sse.datamining.shared/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sse.gwt/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.google.gwt.osgi/lib/gwt-user.jar" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry id="org.eclipse.jdt.launching.classpathentry.defaultClasspath"> <memento exportedEntriesOnly="false" project="com.sap.sailing.gwt.ui"/> </runtimeClasspathEntry> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sse.gwt.adminconsole/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sse.operationaltransformation/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sse.replication/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry containerPath="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6" javaProject="com.sap.sailing.gwt.ui" path="1" type="4"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.gwt.ui/src/main/resources" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.gwt.ui/src/main/java" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.domain/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.googlecode.java-diff-utils/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.domain.common/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/org.json.simple/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.server/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.domain.tractracadapter/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.expeditionconnector/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.declination/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.declination/resources" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.udpconnector/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sse.mongodb/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.domain.swisstimingadapter/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.domain.persistence/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.domain.swisstimingadapter.persistence/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.operationaltransformation/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.domain.tractracadapter.persistence/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/org.moxieapps.gwt.highcharts/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.geocoding/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.server.replication/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sailing.datamining.shared/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sse.common/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sse.datamining.shared/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sse.gwt/src" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.google.gwt.osgi/lib/gwt-user.jar" path="3" type="2"/> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry id="org.eclipse.jdt.launching.classpathentry.defaultClasspath"> <memento exportedEntriesOnly="false" project="com.sap.sailing.gwt.ui"/> </runtimeClasspathEntry> "/>
|
||||
<listEntry value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <runtimeClasspathEntry internalArchive="/com.sap.sse.gwt.adminconsole/src" path="3" type="2"/> "/>
|
||||
</listAttribute>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="com.google.gwt.eclipse.core.moduleClasspathProvider"/>
|
||||
<booleanAttribute key="org.eclipse.jdt.launching.DEFAULT_CLASSPATH" value="false"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.google.gwt.dev.DevMode"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-war "${project_loc:com.sap.sailing.gwt.ui}" -noserver -remoteUI "${gwt_remote_ui_server_port}:${unique_id}" -logLevel INFO -codeServerPort 9997 -startupUrl /gwt/Home.html com.sap.sailing.gwt.Home -startupUrl /gwt/AdminConsole.html com.sap.sailing.gwt.ui.AdminConsole -startupUrl /gwt/LeaderboardEditing.html com.sap.sailing.gwt.ui.LeaderboardEditing -startupUrl /gwt/Leaderboard.html com.sap.sailing.gwt.ui.Leaderboard -startupUrl /gwt/Spectator.html com.sap.sailing.gwt.ui.Spectator -startupUrl /gwt/RaceBoard.html com.sap.sailing.gwt.ui.RaceBoard -startupUrl /gwt/PolarSheets.html com.sap.sailing.gwt.ui.PolarSheets -startupUrl /gwt/RegattaOverview.html com.sap.sailing.gwt.ui.RegattaOverview -startupUrl /gwt/DataMining.html com.sap.sailing.gwt.ui.DataMining -startupUrl /gwt/Simulator.html com.sap.sailing.gwt.ui.Simulator -startupUrl /gwt/VideoPopup.html com.sap.sailing.gwt.ui.VideoPopup -startupUrl /security/ui/Login.html com.sap.sse.security.ui.Login -startupUrl /security/ui/EditProfile.html com.sap.sse.security.ui.EditProfile -startupUrl /security/ui/EmailValidation.html com.sap.sse.security.ui.EmailValidation com.sap.sailing.gwt.ui.Simulator com.sap.sailing.gwt.ui.Leaderboard com.sap.sailing.gwt.ui.PolarSheets com.sap.sailing.gwt.ui.VideoPopup com.sap.sailing.gwt.AutoPlay com.sap.sailing.gwt.ui.RegattaOverview com.sap.sailing.gwt.ui.Spectator com.sap.sailing.gwt.ui.AdminConsole com.sap.sailing.gwt.ui.LeaderboardEditing com.sap.sailing.gwt.ui.YoutubePopup com.sap.sailing.gwt.ui.DataMining com.sap.sailing.gwt.Home com.sap.sailing.gwt.ui.RaceBoard"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-war "${project_loc:com.sap.sailing.gwt.ui}" -noserver -remoteUI "${gwt_remote_ui_server_port}:${unique_id}" -logLevel INFO -codeServerPort 9997 -startupUrl /gwt/Home.html com.sap.sailing.gwt.ui.Search -startupUrl /gwt/Home.html com.sap.sailing.gwt.Home -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 -startupUrl /gwt/Spectator.html com.sap.sailing.gwt.ui.Spectator -startupUrl /gwt/RaceBoard.html com.sap.sailing.gwt.ui.RaceBoard -startupUrl /gwt/PolarSheets.html com.sap.sailing.gwt.ui.PolarSheets -startupUrl /gwt/RegattaOverview.html com.sap.sailing.gwt.ui.RegattaOverview -startupUrl /gwt/DataMining.html com.sap.sailing.gwt.ui.DataMining -startupUrl /gwt/Simulator.html com.sap.sailing.gwt.ui.Simulator com.sap.sailing.gwt.ui.VideoPopup"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.sap.sailing.gwt.ui"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Xmx2048m -XX:MaxPermSize=512m -Xdebug -Xrunjdwp:transport=dt_socket,address=7999,server=y"/>
|
||||
</launchConfiguration>
|
||||
+2
-2
@@ -10,15 +10,15 @@ import com.google.gwt.event.shared.EventBus;
|
||||
import com.google.gwt.user.client.Window;
|
||||
import com.google.gwt.user.client.rpc.AsyncCallback;
|
||||
import com.google.gwt.user.client.ui.AcceptsOneWidget;
|
||||
import com.sap.sailing.domain.common.TimeRange;
|
||||
import com.sap.sailing.domain.common.impl.TimeRangeImpl;
|
||||
import com.sap.sailing.gwt.home.client.shared.placeholder.Placeholder;
|
||||
import com.sap.sailing.gwt.home.client.shared.stage.StageEventType;
|
||||
import com.sap.sailing.gwt.ui.shared.EventBaseDTO;
|
||||
import com.sap.sse.common.Duration;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
import com.sap.sse.common.TimeRange;
|
||||
import com.sap.sse.common.Util.Pair;
|
||||
import com.sap.sse.common.impl.MillisecondsTimePoint;
|
||||
import com.sap.sse.common.impl.TimeRangeImpl;
|
||||
|
||||
public class StartActivity extends AbstractActivity {
|
||||
private final StartClientFactory clientFactory;
|
||||
|
||||
+2
-2
@@ -159,7 +159,6 @@ import com.sap.sailing.domain.common.ScoringSchemeType;
|
||||
import com.sap.sailing.domain.common.Speed;
|
||||
import com.sap.sailing.domain.common.SpeedWithBearing;
|
||||
import com.sap.sailing.domain.common.Tack;
|
||||
import com.sap.sailing.domain.common.TimeRange;
|
||||
import com.sap.sailing.domain.common.WindSource;
|
||||
import com.sap.sailing.domain.common.WindSourceType;
|
||||
import com.sap.sailing.domain.common.abstractlog.NotRevokableException;
|
||||
@@ -188,7 +187,6 @@ import com.sap.sailing.domain.common.impl.KnotSpeedWithBearingImpl;
|
||||
import com.sap.sailing.domain.common.impl.MeterDistance;
|
||||
import com.sap.sailing.domain.common.impl.PolarSheetGenerationResponseImpl;
|
||||
import com.sap.sailing.domain.common.impl.PolarSheetsXYDiagramDataImpl;
|
||||
import com.sap.sailing.domain.common.impl.TimeRangeImpl;
|
||||
import com.sap.sailing.domain.common.impl.WindSourceImpl;
|
||||
import com.sap.sailing.domain.common.media.MediaTrack;
|
||||
import com.sap.sailing.domain.common.racelog.FlagPole;
|
||||
@@ -405,11 +403,13 @@ import com.sap.sailing.xrr.structureimport.buildstructure.SetRacenumberFromSerie
|
||||
import com.sap.sse.BuildVersion;
|
||||
import com.sap.sse.common.Duration;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
import com.sap.sse.common.TimeRange;
|
||||
import com.sap.sse.common.Util;
|
||||
import com.sap.sse.common.Util.Pair;
|
||||
import com.sap.sse.common.Util.Triple;
|
||||
import com.sap.sse.common.impl.MillisecondsDurationImpl;
|
||||
import com.sap.sse.common.impl.MillisecondsTimePoint;
|
||||
import com.sap.sse.common.impl.TimeRangeImpl;
|
||||
import com.sap.sse.common.search.KeywordQuery;
|
||||
import com.sap.sse.common.search.Result;
|
||||
import com.sap.sse.replication.OperationWithResult;
|
||||
|
||||
+8
-13
@@ -1,9 +1,9 @@
|
||||
package com.sap.sailing.polars.regression;
|
||||
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
|
||||
import com.sap.sailing.polars.mining.IncrementalRegressionProcessor;
|
||||
import com.sap.sailing.polars.regression.impl.IncrementalLeastSquaresProcessor;
|
||||
import com.sap.sailing.util.impl.LockUtil;
|
||||
import com.sap.sailing.util.impl.NamedReentrantReadWriteLock;
|
||||
|
||||
/**
|
||||
* Combines two linear regression processors. One with the angle to the wind as the x axis and the other with the wind
|
||||
@@ -24,22 +24,17 @@ public class BoatSpeedEstimator {
|
||||
|
||||
private IncrementalLinearRegressionProcessor windSpeedRegression = new IncrementalLeastSquaresProcessor();
|
||||
|
||||
private ReentrantReadWriteLock lock = new ReentrantReadWriteLock(true);
|
||||
private NamedReentrantReadWriteLock lock = new NamedReentrantReadWriteLock(getClass().getName(), true);
|
||||
|
||||
private double confidenceSum = 0;
|
||||
|
||||
private int dataCount = 0;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param windSpeed
|
||||
* @param angleToTheWind
|
||||
* @param useLinearRegression if false mean of wind interval is used, otherwise lin. regression
|
||||
* @return
|
||||
* @throws NotEnoughDataHasBeenAddedException
|
||||
* @param useLinearRegression if false mean of wind interval is used, otherwise linear regression
|
||||
*/
|
||||
public double estimateSpeed(double windSpeed, double angleToTheWind, boolean useLinearRegression) throws NotEnoughDataHasBeenAddedException {
|
||||
lock.readLock().lock();
|
||||
LockUtil.lockForRead(lock);
|
||||
double result;
|
||||
try {
|
||||
if (useLinearRegression) {
|
||||
@@ -52,20 +47,20 @@ public class BoatSpeedEstimator {
|
||||
result = windSpeedRegression.getMeanOfY();
|
||||
}
|
||||
} finally {
|
||||
lock.readLock().unlock();
|
||||
LockUtil.unlockAfterRead(lock);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public void addData(double windSpeed, double angleToTheWind, double boatSpeed, double confidence) {
|
||||
lock.writeLock().lock();
|
||||
LockUtil.lockForWrite(lock);
|
||||
try {
|
||||
angleRegression.addMeasuredPoint(angleToTheWind, boatSpeed);
|
||||
windSpeedRegression.addMeasuredPoint(windSpeed, boatSpeed);
|
||||
dataCount++;
|
||||
confidenceSum = confidenceSum + confidence;
|
||||
} finally {
|
||||
lock.writeLock().unlock();
|
||||
LockUtil.unlockAfterWrite(lock);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -2,8 +2,8 @@ package com.sap.sailing.server.gateway.trackfiles.impl;
|
||||
|
||||
import com.sap.sailing.domain.abstractlog.race.tracking.DeviceIdentifier;
|
||||
import com.sap.sailing.domain.abstractlog.race.tracking.DeviceWithTimeRange;
|
||||
import com.sap.sailing.domain.common.TimeRange;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
import com.sap.sse.common.TimeRange;
|
||||
|
||||
public class DeviceWithTimeRangeImpl implements DeviceWithTimeRange {
|
||||
private static final long serialVersionUID = -4676108888517968890L;
|
||||
|
||||
+2
-2
@@ -11,14 +11,14 @@ import org.junit.Test;
|
||||
|
||||
import com.sap.sailing.domain.common.RegattaAndRaceIdentifier;
|
||||
import com.sap.sailing.domain.common.RegattaNameAndRaceName;
|
||||
import com.sap.sailing.domain.common.TimeRange;
|
||||
import com.sap.sailing.domain.common.impl.TimeRangeImpl;
|
||||
import com.sap.sailing.domain.common.media.MediaTrack;
|
||||
import com.sap.sailing.domain.common.media.MediaTrack.MimeType;
|
||||
import com.sap.sse.common.Duration;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
import com.sap.sse.common.TimeRange;
|
||||
import com.sap.sse.common.impl.MillisecondsDurationImpl;
|
||||
import com.sap.sse.common.impl.MillisecondsTimePoint;
|
||||
import com.sap.sse.common.impl.TimeRangeImpl;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
|
||||
+12
-12
@@ -5,14 +5,14 @@ import java.util.Map;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
|
||||
import com.sap.sailing.domain.common.DataImportProgress;
|
||||
import com.sap.sailing.server.operationaltransformation.CreateOrUpdateDataImportProgress;
|
||||
import com.sap.sailing.server.operationaltransformation.DataImportFailed;
|
||||
import com.sap.sailing.server.operationaltransformation.ImportMasterDataOperation;
|
||||
import com.sap.sailing.server.operationaltransformation.SetDataImportDeleteProgressFromMapTimer;
|
||||
import com.sap.sailing.util.impl.LockUtil;
|
||||
import com.sap.sailing.util.impl.NamedReentrantReadWriteLock;
|
||||
|
||||
/**
|
||||
* This lock is used to allow only one master data import operation be performed at once. It also keeps information
|
||||
@@ -33,7 +33,7 @@ import com.sap.sailing.server.operationaltransformation.SetDataImportDeleteProgr
|
||||
* @author Frederik Petersen (D054528)
|
||||
*
|
||||
*/
|
||||
public class DataImportLockWithProgress extends ReentrantLock {
|
||||
public class DataImportLockWithProgress extends NamedReentrantReadWriteLock {
|
||||
/**
|
||||
* Defaults to 60s (60000ms).
|
||||
*/
|
||||
@@ -43,12 +43,12 @@ public class DataImportLockWithProgress extends ReentrantLock {
|
||||
|
||||
private final Map<UUID, DataImportProgress> progressPerId;
|
||||
|
||||
private final ReentrantReadWriteLock mapLock;
|
||||
private final NamedReentrantReadWriteLock mapLock;
|
||||
|
||||
public DataImportLockWithProgress() {
|
||||
super(true);
|
||||
super(DataImportLockWithProgress.class.getName(), true);
|
||||
progressPerId = new HashMap<UUID, DataImportProgress>();
|
||||
mapLock = new ReentrantReadWriteLock();
|
||||
mapLock = new NamedReentrantReadWriteLock("mapLock in "+getClass().getName(), /* fair */ false);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -60,11 +60,11 @@ public class DataImportLockWithProgress extends ReentrantLock {
|
||||
TimerTask deleteTask = new TimerTask() {
|
||||
@Override
|
||||
public void run() {
|
||||
mapLock.writeLock().lock();
|
||||
LockUtil.lockForWrite(mapLock);
|
||||
try {
|
||||
progressPerId.remove(progressIDToDelete);
|
||||
} finally {
|
||||
mapLock.writeLock().unlock();
|
||||
LockUtil.unlockAfterWrite(mapLock);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -78,21 +78,21 @@ public class DataImportLockWithProgress extends ReentrantLock {
|
||||
*/
|
||||
public DataImportProgress getProgress(UUID operationId) {
|
||||
DataImportProgress progress;
|
||||
mapLock.readLock().lock();
|
||||
LockUtil.lockForRead(mapLock);
|
||||
try {
|
||||
progress = progressPerId.get(operationId);
|
||||
} finally {
|
||||
mapLock.readLock().unlock();
|
||||
LockUtil.unlockAfterRead(mapLock);
|
||||
}
|
||||
return progress;
|
||||
}
|
||||
|
||||
public void addProgress(UUID operationId, DataImportProgress progress) {
|
||||
mapLock.writeLock().lock();
|
||||
LockUtil.lockForWrite(mapLock);
|
||||
try {
|
||||
progressPerId.put(operationId, progress);
|
||||
} finally {
|
||||
mapLock.writeLock().unlock();
|
||||
LockUtil.unlockAfterWrite(mapLock);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+7
-4
@@ -41,7 +41,9 @@ import com.sap.sailing.domain.tracking.WindTrack;
|
||||
import com.sap.sailing.domain.tracking.impl.EmptyWindStore;
|
||||
import com.sap.sailing.server.RacingEventService;
|
||||
import com.sap.sailing.server.RacingEventServiceOperation;
|
||||
import com.sap.sailing.server.masterdata.DataImportLockWithProgress;
|
||||
import com.sap.sailing.server.masterdata.DummyTrackedRace;
|
||||
import com.sap.sailing.util.impl.LockUtil;
|
||||
import com.sap.sse.common.Util;
|
||||
|
||||
public class ImportMasterDataOperation extends
|
||||
@@ -72,9 +74,10 @@ public class ImportMasterDataOperation extends
|
||||
|
||||
@Override
|
||||
public MasterDataImportObjectCreationCountImpl internalApplyTo(RacingEventService toState) throws Exception {
|
||||
this.progress = toState.getDataImportLock().getProgress(importOperationId);
|
||||
final DataImportLockWithProgress dataImportLock = toState.getDataImportLock();
|
||||
this.progress = dataImportLock.getProgress(importOperationId);
|
||||
progress.setNameOfCurrentSubProgress("Waiting for other data import operations to finish");
|
||||
toState.getDataImportLock().lock();
|
||||
LockUtil.lockForWrite(dataImportLock);
|
||||
try {
|
||||
progress.setNameOfCurrentSubProgress("Importing leaderboard groups");
|
||||
progress.setCurrentSubProgressPct(0);
|
||||
@@ -100,13 +103,13 @@ public class ImportMasterDataOperation extends
|
||||
progress.setOverAllProgressPct(0.5);
|
||||
progress.setCurrentSubProgressPct(0);
|
||||
createWindTracks(toState);
|
||||
toState.getDataImportLock().getProgress(importOperationId).setResult(creationCount);
|
||||
dataImportLock.getProgress(importOperationId).setResult(creationCount);
|
||||
return creationCount;
|
||||
} catch (Exception e) {
|
||||
logger.severe("Error during execution of ImportMasterDataOperation");
|
||||
throw new RuntimeException("Error during execution of ImportMasterDataOperation", e);
|
||||
} finally {
|
||||
toState.getDataImportLock().unlock();
|
||||
LockUtil.unlockAfterWrite(dataImportLock);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-4
@@ -1,10 +1,7 @@
|
||||
package com.sap.sailing.domain.common;
|
||||
package com.sap.sse.common;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.sap.sse.common.Duration;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
|
||||
public interface TimeRange extends Comparable<TimeRange>, Serializable {
|
||||
/**
|
||||
* @return {@code null}, if the timepoint is at the beginning of time
|
||||
+2
-3
@@ -1,10 +1,9 @@
|
||||
package com.sap.sailing.domain.common.impl;
|
||||
package com.sap.sse.common.impl;
|
||||
|
||||
import com.sap.sailing.domain.common.TimeRange;
|
||||
import com.sap.sse.common.Duration;
|
||||
import com.sap.sse.common.TimePoint;
|
||||
import com.sap.sse.common.TimeRange;
|
||||
import com.sap.sse.common.Util;
|
||||
import com.sap.sse.common.impl.MillisecondsTimePoint;
|
||||
|
||||
public class TimeRangeImpl extends Util.Pair<TimePoint, TimePoint> implements TimeRange {
|
||||
public static final TimePoint BeginningOfTime = new MillisecondsTimePoint(Long.MIN_VALUE);
|
||||
+1
-1
@@ -65,7 +65,7 @@ public class UserService {
|
||||
Storage.addStorageEventHandler(new Handler() {
|
||||
@Override
|
||||
public void onStorageChange(StorageEvent event) {
|
||||
logger.info("Received storage event { key: "+event.getKey()+", newValue: "+event.getNewValue()+", oldValue: "+
|
||||
logger.fine("Received storage event { key: "+event.getKey()+", newValue: "+event.getNewValue()+", oldValue: "+
|
||||
event.getOldValue()+", url: "+event.getUrl()+", storageArea: "+event.getStorageArea());
|
||||
// ignore update events coming from this object itself
|
||||
if (LOCAL_STORAGE_UPDATE_KEY.equals(event.getKey()) && event.getNewValue() != null
|
||||
|
||||
@@ -24,8 +24,8 @@ BUP is the tool that is being used to create the backups. You can access it's do
|
||||
|
||||
As with git you have three stages when starting a backup.
|
||||
|
||||
- First you need to initialize the repository (comparable to `git init`). This is also needed when using a remote repository. In that case the local repository is used to hold the index of files and to determine wether files have changed. The initialization is executed by invoking `bup [-d /path/to/repo] init`. In most cases you can just omit the directory - bup will then set it to $HOME/.bup.
|
||||
- Second you need to tell bup to create or update the index (comparable to `git add`). That operation will list all files and add them to the index. That index contains information about changes to the tree structure. At this stage you can specify wether to ignore certain files (--exclude and --exclude-rx). An index command could look like this: `bup index /etc`.
|
||||
- First you need to initialize the repository (comparable to `git init`). This is also needed when using a remote repository. In that case the local repository is used to hold the index of files and to determine whether files have changed. The initialization is executed by invoking `bup [-d /path/to/repo] init`. In most cases you can just omit the directory - bup will then set it to $HOME/.bup.
|
||||
- Second you need to tell bup to create or update the index (comparable to `git add`). That operation will list all files and add them to the index. That index contains information about changes to the tree structure. At this stage you can specify whether to ignore certain files (--exclude and --exclude-rx). An index command could look like this: `bup index /etc`.
|
||||
- Third all indexed files need to be saved (comparable to `git commit`). That process can either store files locally (comparable to `git commit`) or push them to a remote repository (`git commit && git push`).
|
||||
|
||||
The last stage involves some magic because bup does not expose the notion of branches or HEAD to the user. In most cases one will save files by specifying the name of a backup (`bup save -n <name>`). Internally this will create or update a branch that matches the name given. More importantly this operation will remove all files not matching the index just created.
|
||||
@@ -58,7 +58,7 @@ Saving: 100.00% (24426/24426k, 1188/1188 files), done.
|
||||
bloom: creating from 1 file (3635 objects).
|
||||
</pre>
|
||||
|
||||
As bup is using the standard GIT repository layout one does not need to use bup to access files. But yuo have to keep in mind that as bup is splitting the files it would require some additional effort to put these files together again. The following chain shows how to access a repository. It assumes that one has logged into the backup server.
|
||||
As bup is using the standard GIT repository layout one does not need to use bup to access files. But you have to keep in mind that as bup is splitting the files it would require some additional effort to put these files together again. The following chain shows how to access a repository. It assumes that one has logged into the backup server.
|
||||
|
||||
<pre>
|
||||
[backup@ip-172-31-25-136 ~]$ git clone file:///home/backup/database dbtest
|
||||
|
||||
+2
-2
@@ -266,8 +266,8 @@ To still get the usual logging and URL re-writing features, replicas need to run
|
||||
Here are the steps to create a load balanced setup:
|
||||
|
||||
- Create a master instance holding all data (see http://wiki.sapsailing.com/wiki/amazon-ec2#Setting-up-Master-and-Replica)
|
||||
- When using the Race Committee App (RCApp), make sure the app is configured to send its data to the master instance and not the ELB (otherwise, write requests may end up at replicas which they wouldn't know how to handle). You may want to configure a separate URL for the master server for this purpose, so you don't have to re-configure the RCApp devices when switching to a different master server.
|
||||
- Create `n` instances that are configured to connect to the master server
|
||||
- When using the Race Committee App (RCApp), try to make sure the app is configured to send its data to the master instance and not the ELB (otherwise, write requests may end up at replicas which then have to reverse-replicate these to the master which is as of this writing (2014-12-18) an EXPERIMENTAL feature). You may want to configure a separate URL for the master server for this purpose, so you don't have to re-configure the RCApp devices when switching to a different master server.
|
||||
- Create `n` instances that are configured to connect to the master server, automatically launching replication by using one of the `*...-replica-...*` environment from http://releases.sapsailing.com/environments.
|
||||
- Create a load balancer that redirects everything from HTTP port 8888 to HTTP port 8888 and leave the other switches and checkboxes on their default value
|
||||
- As "Ping Port" enter HTTP port 8888 and use /index.html as the "Ping Path." Leave the other values on their defaults again.
|
||||
- Put the ELB into the "Sailing Analytics App" security group as it will appear in the landscape as a regular sailing analytics application server.
|
||||
|
||||
Reference in new issue
Block a user