update VegasAI to use Task instead of Runnable so that exceptions are caught and logged correctly

master
melvinzhang 2015-06-08 11:01:39 +08:00
parent 179f64369d
commit 9024be57e8
1 changed files with 2 additions and 2 deletions

View File

@ -3,7 +3,7 @@ package magic.ai;
import magic.model.MagicGame; import magic.model.MagicGame;
import magic.model.event.MagicEvent; import magic.model.event.MagicEvent;
public class VegasWorker implements Runnable { public class VegasWorker extends Task {
private static final int MAIN_PHASES=6; private static final int MAIN_PHASES=6;
@ -31,7 +31,7 @@ public class VegasWorker implements Runnable {
} }
@Override @Override
public void run() { public void execute() {
final long endTime = System.nanoTime() + slice; final long endTime = System.nanoTime() + slice;
while (System.nanoTime() < endTime) { while (System.nanoTime() < endTime) {
final MagicGame game = new MagicGame(sourceGame, sourceGame.getScorePlayer()); final MagicGame game = new MagicGame(sourceGame, sourceGame.getScorePlayer());