The shuttle behaviour ExecutorService is now instantiated in initialize() instead of in TravelService's constructor

This commit is contained in:
Mads Boddum
2015-10-07 22:32:16 +02:00
parent c2d32e7e7b
commit e8b4f6d664
+8 -2
View File
@@ -92,7 +92,7 @@ public final class TravelService extends Service {
// Fields relating to shuttle take-off and landing
private Posture currentShuttlePosture;
private final ExecutorService executor;
private ExecutorService executor;
private final int timeUntilLand;
private int timeRemaining;
private final long landDelay;
@@ -112,7 +112,6 @@ public final class TravelService extends Service {
travelFeeTable = (DatatableData) ClientFactory.getInfoFromFile("datatables/travel/travel.iff");
pointsOnPlanet = new HashMap<>();
executor = Executors.newSingleThreadExecutor();
timeUntilLand = getConfig(ConfigFile.FEATURES).getInt("SHUTTLE-AWAY-TIME", 60);
timeRemaining = timeUntilLand;
shuttleLanded = true; // Shuttles start off being grounded
@@ -131,6 +130,13 @@ public final class TravelService extends Service {
registerForIntent(ObjectCreatedIntent.TYPE);
}
@Override
public boolean initialize() {
executor = Executors.newSingleThreadExecutor();
return super.initialize();
}
@Override
public boolean start() {
executor.execute(new ShuttleBehaviour());