Fixed XML Issue where sometimes the last boat would not display itself #story[1188]
This commit is contained in:
@@ -60,7 +60,6 @@ public class MockOutput implements RunnableWithFramePeriod {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
Thread.sleep(500);
|
Thread.sleep(500);
|
||||||
|
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
//If we get interrupted, exit the function.
|
//If we get interrupted, exit the function.
|
||||||
Logger.getGlobal().log(Level.WARNING, "MockOutput.run().sleep(waitForXMLs) was interrupted on thread: " + Thread.currentThread(), e);
|
Logger.getGlobal().log(Level.WARNING, "MockOutput.run().sleep(waitForXMLs) was interrupted on thread: " + Thread.currentThread(), e);
|
||||||
@@ -72,7 +71,6 @@ public class MockOutput implements RunnableWithFramePeriod {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
long previousFrameTime = System.currentTimeMillis();
|
long previousFrameTime = System.currentTimeMillis();
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -126,6 +126,7 @@ public class MockRace extends RaceState {
|
|||||||
this.boats.add(mockBoat);
|
this.boats.add(mockBoat);
|
||||||
|
|
||||||
getRaceDataSource().incrementSequenceNumber();
|
getRaceDataSource().incrementSequenceNumber();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -21,6 +21,8 @@ import java.util.logging.Logger;
|
|||||||
* Created by connortaylorbrown on 2/08/17.
|
* Created by connortaylorbrown on 2/08/17.
|
||||||
*/
|
*/
|
||||||
public class RaceServer {
|
public class RaceServer {
|
||||||
|
private static RaceServer server;//this is for updating xml files as I cannot find an elegant way to do this and since it is near the end of the sprint we shouldn't be doing large scale refactors
|
||||||
|
|
||||||
private MockRace race;
|
private MockRace race;
|
||||||
private LatestMessages latestMessages;
|
private LatestMessages latestMessages;
|
||||||
|
|
||||||
@@ -47,6 +49,7 @@ public class RaceServer {
|
|||||||
|
|
||||||
|
|
||||||
public RaceServer(MockRace race, LatestMessages latestMessages) {
|
public RaceServer(MockRace race, LatestMessages latestMessages) {
|
||||||
|
server = this;
|
||||||
this.race = race;
|
this.race = race;
|
||||||
this.latestMessages = latestMessages;
|
this.latestMessages = latestMessages;
|
||||||
}
|
}
|
||||||
@@ -73,6 +76,12 @@ public class RaceServer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void staticUpdateXML(){
|
||||||
|
if (server != null){
|
||||||
|
server.updateXMLFiles();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the race/boat/regatta data sources have changed, and if they have, update their xml representations.
|
* Checks if the race/boat/regatta data sources have changed, and if they have, update their xml representations.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package network.Messages;
|
package network.Messages;
|
||||||
|
|
||||||
|
import mock.model.RaceServer;
|
||||||
import network.Messages.Enums.XMLMessageType;
|
import network.Messages.Enums.XMLMessageType;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@@ -152,6 +153,7 @@ public class LatestMessages extends Observable {
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
RaceServer.staticUpdateXML();
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user