+ case SERVER:
+ if (port == null) {
+ exitCode = 255;
+ break;
+ }
+ try {
+ ServerObject server = new RemoteLibraryServer(key, port);
+ server.setTraceHandler(Instance.getTraceHandler());
+ server.run();
+ } catch (IOException e) {
+ Instance.getTraceHandler().error(e);
+ }
+ return;
+ case STOP_SERVER:
+ if (port == null) {
+ exitCode = 255;
+ break;
+ }
+
+ new RemoteLibrary(key, host, port).exit();
+ break;
+ case REMOTE:
+ exitCode = 255; // should not be reachable (REMOTE -> START)
+ break;
+ }
+ }
+
+ // We cannot do it when in GUI mode, because it is async...
+ // So if we close the temp files before it is actually used,
+ // we have a problem...
+ // TODO: close it at the correct time (for now, finalize try to do it)
+ if (false) {
+ try {
+ Instance.getTempFiles().close();
+ } catch (IOException e) {
+ Instance.getTraceHandler().error(
+ new IOException(
+ "Cannot dispose of the temporary files", e));