Skip to content
Snippets Groups Projects
Commit 30f05043 authored by Clayton, Brandon Scott's avatar Clayton, Brandon Scott
Browse files

test

parent 8993db2a
No related branches found
No related tags found
1 merge request!806AWS Lambda
package gov.usgs.earthquake.nshmp.www;
import java.nio.file.Path;
import java.util.logging.Logger;
import org.crac.Context;
import org.crac.Resource;
......@@ -27,13 +28,15 @@ public class PrimingResource implements OrderedResource {
@Override
public void beforeCheckpoint(Context<? extends Resource> context) throws Exception {
Logger.getAnonymousLogger().info("Before checkpoint");
ServletUtil.model(ServletUtil.loadModel(modelPath));
updateParameter();
}
@Override
public void afterRestore(Context<? extends Resource> context) throws Exception {
System.out.println("Reset exexutors");
Logger.getAnonymousLogger().info("After restore: reset execurors");
// Reset executors on restore as Shutdown event does not fire on AWS lambda
ServletUtil.resetExecutors();
}
......
......@@ -91,6 +91,9 @@ public class ServletUtil {
.create();
}
/**
* Reset executors on AWS Lambda SnapStart restore
*/
static void resetExecutors() {
CALC_EXECUTOR.shutdown();
TASK_EXECUTOR.shutdown();
......@@ -115,7 +118,6 @@ public class ServletUtil {
@EventListener
void startup(StartupEvent event) {
System.out.println("on start up");
if (!awsRuntime.isPresent()) {
HAZARD_MODEL = loadModel(modelPath);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment