Skip to content

Better error handling #133

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions back-end/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<configuration>
<source>1.8</source>
<target>1.8</target>
<cleanupDaemonThreads>false</cleanupDaemonThreads>
</configuration>
<!-- https://stackoverflow.com/questions/4123044/maven-3-warnings-about-build-plugins-plugin-version -->
<version>3.2</version>
Expand Down
22 changes: 13 additions & 9 deletions back-end/src/main/java/index/Indexer.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,17 +107,21 @@ public static void precompute() throws Exception {

System.out.println("Precomputing...");

associateIndexer();
long indexingStartTime = System.currentTimeMillis();
for (Canvas c : Main.getProject().getCanvases()) {
for (int layerId = 0; layerId < c.getLayers().size(); layerId++) {
c.getLayers().get(layerId).getIndexer().createMV(c, layerId);
try {
associateIndexer();
long indexingStartTime = System.currentTimeMillis();
for (Canvas c : Main.getProject().getCanvases()) {
for (int layerId = 0; layerId < c.getLayers().size(); layerId++) {
c.getLayers().get(layerId).getIndexer().createMV(c, layerId);
}
}
}

System.out.println(
"Indexing took: " + (System.currentTimeMillis() - indexingStartTime) / 1000 + "s.");
System.out.println("Done precomputing!");
System.out.println(
"Indexing took: " + (System.currentTimeMillis() - indexingStartTime) / 1000 + "s.");
System.out.println("Done precomputing!");
} catch (Exception e) {
throw e;
}
}

// common static methods used by child classes
Expand Down
2 changes: 1 addition & 1 deletion back-end/src/main/java/server/ProjectRequestHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public void handle(HttpExchange httpExchange) throws IOException {
Main.setProjectClean();
}
} catch (Exception e) {
e.printStackTrace();
throw e;
}
}

Expand Down
13 changes: 9 additions & 4 deletions back-end/src/main/java/server/Server.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,15 @@ public static void startServer(int portNumber) throws Exception {
while (!terminated) terminationLock.wait();
}
Server.stopServer();
Indexer.precompute();
Main.setProjectClean();
System.out.println("Completed recomputing indexes. Server restarting...");
Server.startServer(Config.portNumber);

try {
Indexer.precompute();
Main.setProjectClean();
System.out.println("Completed recomputing indexes. Server restarting...");
Server.startServer(Config.portNumber);
} catch (Exception e) {
Main.setProjectClean();
}
}

public static void terminate() {
Expand Down