Clean some boot text and shutdown code path fixes
This commit is contained in:
parent
54d9e98254
commit
614bf64a8d
6 changed files with 90 additions and 69 deletions
|
|
@ -60,6 +60,7 @@ public enum GDXAppTos4 implements BãßᛗᚢᛗᛗᛉVū́ǘrChaliceEnumShot
|
|||
private Framework systemBundle;
|
||||
private GDXAppTos4Activator systemActivator;
|
||||
private Map<Class<? extends Screen>,Screen> screens;
|
||||
volatile private boolean running = true;
|
||||
|
||||
@BãßBȍőnSpiderWire注(paint = Vū́ǘrBȍőnSupportꞱᴿᴳᴮ.ẞassPaint.ꞱBurnWireFly.class)
|
||||
@BãßBȍőnSpiderWireFly注(eye = "selectScreenCounter")
|
||||
|
|
@ -80,6 +81,10 @@ public enum GDXAppTos4 implements BãßᛗᚢᛗᛗᛉVū́ǘrChaliceEnumShot
|
|||
systemActivator.BãßInit(args, viewWidth, viewHeight, fileChooser, this);
|
||||
}
|
||||
|
||||
public boolean isRunning() {
|
||||
return running;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create() {
|
||||
systemBundle = GDXAppTos4Startup.init(this, systemActivator);
|
||||
|
|
@ -116,6 +121,7 @@ public enum GDXAppTos4 implements BãßᛗᚢᛗᛗᛉVū́ǘrChaliceEnumShot
|
|||
|
||||
@Override
|
||||
public void dispose() {
|
||||
this.running = false;
|
||||
this.screen = null;
|
||||
for (Screen screen:screens.values()) {
|
||||
screen.dispose();
|
||||
|
|
@ -130,6 +136,22 @@ public enum GDXAppTos4 implements BãßᛗᚢᛗᛗᛉVū́ǘrChaliceEnumShot
|
|||
} catch (InterruptedException ignored) {
|
||||
}
|
||||
Gdx.app.log(this.getClass().getSimpleName(), "Screens disposed and system stopped.");
|
||||
// TODO: check why thread like FelixResolver-* and logback don't get stopped...
|
||||
// the JVM does exit after ~30 sec, but with a manual exit request it is faster...
|
||||
System.exit(0); // remove this exit(0) invoke, now the test-run shutdown is not nice
|
||||
// see output without the above manual exit(0);
|
||||
//[WARNING] thread Thread[logback-1,5,love.distributedrebirth.gdxapp4d.boot.desktop.GDXAppDesktopLauncher] was interrupted but is still alive after waiting at least 14999msecs
|
||||
//[WARNING] thread Thread[logback-1,5,love.distributedrebirth.gdxapp4d.boot.desktop.GDXAppDesktopLauncher] will linger despite being asked to die via interruption
|
||||
//[WARNING] thread Thread[FelixResolver-1,5,love.distributedrebirth.gdxapp4d.boot.desktop.GDXAppDesktopLauncher] will linger despite being asked to die via interruption
|
||||
//[WARNING] thread Thread[FelixResolver-2,5,love.distributedrebirth.gdxapp4d.boot.desktop.GDXAppDesktopLauncher] will linger despite being asked to die via interruption
|
||||
//[WARNING] thread Thread[FelixResolver-3,5,love.distributedrebirth.gdxapp4d.boot.desktop.GDXAppDesktopLauncher] will linger despite being asked to die via interruption
|
||||
//[WARNING] thread Thread[FelixResolver-4,5,love.distributedrebirth.gdxapp4d.boot.desktop.GDXAppDesktopLauncher] will linger despite being asked to die via interruption
|
||||
//[WARNING] thread Thread[FelixResolver-5,5,love.distributedrebirth.gdxapp4d.boot.desktop.GDXAppDesktopLauncher] will linger despite being asked to die via interruption
|
||||
//[WARNING] thread Thread[FelixResolver-6,5,love.distributedrebirth.gdxapp4d.boot.desktop.GDXAppDesktopLauncher] will linger despite being asked to die via interruption
|
||||
//[WARNING] thread Thread[FelixResolver-7,5,love.distributedrebirth.gdxapp4d.boot.desktop.GDXAppDesktopLauncher] will linger despite being asked to die via interruption
|
||||
//[WARNING] thread Thread[FelixResolver-8,5,love.distributedrebirth.gdxapp4d.boot.desktop.GDXAppDesktopLauncher] will linger despite being asked to die via interruption
|
||||
//[WARNING] NOTE: 9 thread(s) did not finish despite being asked to via interruption. This is not a problem with exec:java, it is a problem with the running code. Although not serious, it should be remedied.
|
||||
//[WARNING] Couldn't destroy threadgroup org.codehaus.mojo.exec.ExecJavaMojo$IsolatedThreadGroup[name=love.distributedrebirth.gdxapp4d.boot.desktop.GDXAppDesktopLauncher,maxpri=10]
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ import org.osgi.framework.BundleContext;
|
|||
import org.osgi.framework.BundleException;
|
||||
import org.osgi.framework.InvalidSyntaxException;
|
||||
import org.osgi.framework.ServiceReference;
|
||||
import org.osgi.framework.ServiceRegistration;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.x4o.xml.io.X4OConnectionException;
|
||||
|
|
@ -132,45 +133,47 @@ public class GDXAppTos4Activator implements BundleActivator {
|
|||
gdxFont.dispose();
|
||||
}
|
||||
|
||||
private void startError(String msg) {
|
||||
bootScreen.bootLineError("ERROR: " + msg);
|
||||
startError = true;
|
||||
LOG.error(msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start(final BundleContext context) {
|
||||
bootScreen.bootLine("Mecca System eXtension superscript Four");
|
||||
bootScreen.bootLine("tos4: starting...");
|
||||
bootScreen.bootLine("nx01: starting Temple OS engine");
|
||||
bootScreen.bootLine("init-cpus: "+Runtime.getRuntime().availableProcessors());
|
||||
bootScreen.bootLine("free-memory: 0x"+Long.toHexString(Runtime.getRuntime().freeMemory()));
|
||||
|
||||
BãßBȍőnBőatWindKnots harbor = Bãß.أَكْبَرײꣻײالله.harborᴮʳᵉᵉᶻᵉ(BãßBȍőnBőatWind.SAILOR_MOON_SKIRT_DUSTER);
|
||||
bootScreen.bootLine("harbor: solar-winds="+harbor.getSolarWinds().size()+" storm-troopers="+harbor.getStormTroopers());
|
||||
bootScreen.bootLine("nx01-harbor: solar-winds="+harbor.getSolarWinds().size()+" storm-troopers="+harbor.getStormTroopers());
|
||||
|
||||
boolean useLocal = args.contains("use-local");
|
||||
|
||||
warpshipHome = new File(WARPSHIP_HOME);
|
||||
if (!warpshipHome.exists()) {
|
||||
bootScreen.bootLineError("ERROR: No Warpship home.");
|
||||
startError = true;
|
||||
startError("No Warpship home.");
|
||||
return;
|
||||
}
|
||||
|
||||
hyperdriveHome = new File(warpshipHome, HYPERDRIVE_HOME);
|
||||
if (!hyperdriveHome.exists()) {
|
||||
bootScreen.bootLineError("ERROR: No Hyperdrive home.");
|
||||
startError = true;
|
||||
startError("No Hyperdrive home.");
|
||||
return;
|
||||
}
|
||||
|
||||
File warpShip = new File(warpshipHome, Warpᵐᵉ.WARP_SHIP);
|
||||
bootScreen.bootLine("warp-ship: "+warpShip);
|
||||
if (!warpShip.exists()) {
|
||||
bootScreen.bootLineError("ERROR: No warp-ship.xml found.");
|
||||
startError = true;
|
||||
startError("No warp-ship.xml found.");
|
||||
return;
|
||||
}
|
||||
try {
|
||||
warpshipDevice = WaterDeviceDriver.newInstance().createReader().readFile(warpShip);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
bootScreen.bootLineError("ERROR: "+e.getMessage());
|
||||
startError = true;
|
||||
LOG.error(e.getMessage(), e);
|
||||
startError(e.getMessage());
|
||||
return;
|
||||
}
|
||||
bootScreen.bootLine("warp-engine: "+warpshipDevice.theShip().getName());
|
||||
|
|
@ -209,17 +212,18 @@ public class GDXAppTos4Activator implements BundleActivator {
|
|||
try {
|
||||
result = systemWarpShip.loadWaterOcean(context, registratedSeas, warpshipDevice.theShip().getEngine(), v -> bootScreen.bootLine(v));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
bootScreen.bootLineError("ERROR: "+e.getMessage());
|
||||
startError = true;
|
||||
if (!GDXAppTos4.INSTANCE.isRunning()) {
|
||||
return;
|
||||
}
|
||||
LOG.error(e.getMessage(), e);
|
||||
startError(e.getMessage());
|
||||
return;
|
||||
}
|
||||
if (result > 0) {
|
||||
bootScreen.bootLineError("tos4: FAILURE BOOT ABORTED");
|
||||
startError = true;
|
||||
if (result < 0) {
|
||||
startError("SPACE DOCK FAILURE, ENGINE BOOT ABORTED");
|
||||
return;
|
||||
}
|
||||
bootScreen.bootLine("tos4: chains resolved.");
|
||||
bootScreen.bootLine("nx01-space: Docked with " + result + " warp oceans");
|
||||
|
||||
List<File> fonts = systemWarpShip.searchMagic(context, "application/x-font-ttf-plane0");
|
||||
File systemFont = fonts.get(0);
|
||||
|
|
@ -241,18 +245,25 @@ public class GDXAppTos4Activator implements BundleActivator {
|
|||
}
|
||||
bootScreen.bootLine("gdx-font: "+parameter.characters.length()+" glyphs loaded.");
|
||||
|
||||
context.registerService(SystemGdxFont.class.getName(), new SystemGdxFontImpl(gdxFont), new Hashtable<String, String>());
|
||||
context.registerService(SystemGdxLog.class.getName(), systemGdxLog, new Hashtable<String, String>());
|
||||
context.registerService(SystemGdxBootArgs.class.getName(), new SystemGdxBootArgsImpl(), new Hashtable<String, String>());
|
||||
context.registerService(SystemGdxTerminal.class.getName(), systemGdxTerminal, new Hashtable<String, String>());
|
||||
List<ServiceRegistration<?>> pistons = new ArrayList<>();
|
||||
pistons.add(context.registerService(SystemGdxFont.class.getName(), new SystemGdxFontImpl(gdxFont), new Hashtable<String, String>()));
|
||||
pistons.add(context.registerService(SystemGdxLog.class.getName(), systemGdxLog, new Hashtable<String, String>()));
|
||||
pistons.add(context.registerService(SystemGdxBootArgs.class.getName(), new SystemGdxBootArgsImpl(), new Hashtable<String, String>()));
|
||||
pistons.add(context.registerService(SystemGdxTerminal.class.getName(), systemGdxTerminal, new Hashtable<String, String>()));
|
||||
bootScreen.bootLine("nx01-engine: Booted " + pistons.size() + " plasma cambers");
|
||||
pistons.clear();
|
||||
|
||||
bootScreen.bootLine("nx01-bridge: Loading vrGEM4");
|
||||
try {
|
||||
Thread.sleep(1234+123);
|
||||
systemWarpShip.loadBundles(context, registratedSeas);
|
||||
} catch (BundleException e) {
|
||||
e.printStackTrace();
|
||||
} catch (Exception e) {
|
||||
if (!GDXAppTos4.INSTANCE.isRunning()) {
|
||||
return;
|
||||
}
|
||||
LOG.error(e.getMessage(), e);
|
||||
startError(e.getMessage());
|
||||
systemGdxTerminal.selectScreen(GDXAppTos4BootScreen.class);
|
||||
bootScreen.bootLineError("ERROR: "+e.getMessage());
|
||||
startError = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -369,7 +380,7 @@ public class GDXAppTos4Activator implements BundleActivator {
|
|||
logger.accept(infoResult);
|
||||
// if (!infoResult.startsWith("Drive Info")) {
|
||||
// logger.accept("ERROR: Couldn't get info on: "+waterHome);
|
||||
// return 1;
|
||||
// return -1;
|
||||
// }
|
||||
} else {
|
||||
waterHome = new File(override);
|
||||
|
|
@ -379,25 +390,25 @@ public class GDXAppTos4Activator implements BundleActivator {
|
|||
File waterHash = new File(waterHome, Warpᵐᵉ.WARP_HASH);
|
||||
if (!waterHash.exists()) {
|
||||
logger.accept("ERROR: Missing file: "+waterHash);
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
WaterShotAddict addict = new WaterShotAddict();
|
||||
try {
|
||||
if (!addict.validateWarpChainLink(waterHome)) {
|
||||
logger.accept("ERROR: Invalid hash in: "+waterHash);
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
} catch (NoSuchAlgorithmException | X4OConnectionException | SAXException | IOException e) {
|
||||
e.printStackTrace();
|
||||
logger.accept("ERROR: "+e.getMessage());
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
File waterSea = new File(waterHome, Warpᵐᵉ.WARP_SEA);
|
||||
if (!waterSea.exists()) {
|
||||
logger.accept("ERROR: Missing file: "+waterSea);
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
WaterOcean ocean = WaterOceanDriver.newInstance().createReader().readFile(waterSea);
|
||||
logger.accept("water-ocean: "+key+" ("+ocean.theWater().getName()+")");
|
||||
|
|
@ -408,7 +419,7 @@ public class GDXAppTos4Activator implements BundleActivator {
|
|||
context.registerService(SystemWarpSea.class.getName(), sea, props);
|
||||
registratedSeas.add(sea);
|
||||
|
||||
int result = 0;
|
||||
int result = 1;
|
||||
for (WaterSeaChain chain: ocean.theWater().getSeaChains()) {
|
||||
result += loadWaterOcean(context, registratedSeas, chain.getKey(), logger);
|
||||
}
|
||||
|
|
@ -478,6 +489,11 @@ public class GDXAppTos4Activator implements BundleActivator {
|
|||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRunning() {
|
||||
return GDXAppTos4.INSTANCE.isRunning();
|
||||
}
|
||||
}
|
||||
|
||||
public static class SystemGdxLogImpl implements SystemGdxLog, ApplicationLogger {
|
||||
|
|
|
|||
|
|
@ -43,6 +43,8 @@ import ᒢᐩᐩ.ᔆʸᔆᐪᓫᔿ.ᒃᣔᒃᓫᒻ.ᑊᐣᓑᖮᐪᔆ.DuytsDocAu
|
|||
@DuytsDocAuthor注(name = "للَّٰهِilLצسُو", copyright = "©Δ∞ 仙上主天")
|
||||
public interface SystemWarpShip {
|
||||
|
||||
boolean isRunning();
|
||||
|
||||
WaterDevice getWarpShip();
|
||||
|
||||
int loadWaterOcean(BundleContext context, List<SystemWarpSea> registratedSeas, String key, Consumer<String> logger) throws IOException, InterruptedException, X4OConnectionException, SAXException, BundleException;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue