Fixed most of issue #19 with new master?
This commit is contained in:
@@ -78,7 +78,7 @@ public class HeartBeatService implements RunnableWithFramePeriod {
|
||||
* Puts a HeartBeat message on the message queue.
|
||||
* @throws InterruptedException Thrown if the thread is interrupted.
|
||||
*/
|
||||
private void sendHeartBeat() throws InterruptedException {
|
||||
private void sendHeartBeat() throws Exception {
|
||||
|
||||
HeartBeat heartBeat = createHeartbeatMessage();
|
||||
|
||||
@@ -92,13 +92,17 @@ public class HeartBeatService implements RunnableWithFramePeriod {
|
||||
|
||||
while (!Thread.interrupted()) {
|
||||
long currentFrameTime = System.currentTimeMillis();
|
||||
waitForFramePeriod(lastHeartbeatTime, currentFrameTime, heartbeatPeriod);
|
||||
try {
|
||||
waitForFramePeriod(lastHeartbeatTime, currentFrameTime, heartbeatPeriod);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
lastHeartbeatTime = currentFrameTime;
|
||||
|
||||
try {
|
||||
sendHeartBeat();
|
||||
|
||||
} catch (InterruptedException e) {
|
||||
} catch (Exception e) {
|
||||
Logger.getGlobal().log(Level.WARNING, "HeartBeatService: " + this + " sendHeartBeat() was interrupted on thread: " + Thread.currentThread(), e);
|
||||
Thread.currentThread().interrupt();
|
||||
return;
|
||||
|
||||
@@ -43,9 +43,17 @@ public class RaceLogic implements RunnableWithFramePeriod {
|
||||
public void run() {
|
||||
race.initialiseBoats();
|
||||
|
||||
countdown();
|
||||
try {
|
||||
countdown();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
raceLoop();
|
||||
try {
|
||||
raceLoop();
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void boolFalse(){
|
||||
@@ -56,7 +64,7 @@ public class RaceLogic implements RunnableWithFramePeriod {
|
||||
/**
|
||||
* Countdown timer until race starts.
|
||||
*/
|
||||
private void countdown() {
|
||||
private void countdown() throws Exception {
|
||||
|
||||
long previousFrameTime = System.currentTimeMillis();
|
||||
|
||||
@@ -95,7 +103,7 @@ public class RaceLogic implements RunnableWithFramePeriod {
|
||||
/**
|
||||
* Timer that runs for the duration of the race, until all boats finish.
|
||||
*/
|
||||
private void raceLoop() {
|
||||
private void raceLoop() throws Exception {
|
||||
|
||||
long previousFrameTime = System.currentTimeMillis();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user