You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+10Lines changed: 10 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -104,6 +104,16 @@ public class LambdaHandler implements RequestHandler<AwsProxyRequest, AwsProxyRe
104
104
}
105
105
```
106
106
107
+
If you configure an [`initExceptionHandler` method](http://sparkjava.com/documentation#stopping-the-server), make sure that you call `System.exit` at the end of the method. This framework keeps a `CountDownLatch` on the request
108
+
and unless you forcefully exit from the thread, the Lambda function will hang waiting for a latch that is never released.
109
+
110
+
```java
111
+
initExceptionHandler((e) -> {
112
+
LOG.error("ignite failed", e);
113
+
System.exit(100);
114
+
});
115
+
```
116
+
107
117
# Security context
108
118
The `aws-serverless-java-container-core` contains a default implementation of the `SecurityContextWriter` that supports API Gateway's proxy integration. The generated security context uses the API Gateway `$context` object to establish the request security context. The context looks for the following values in order and returns the first matched type:
Copy file name to clipboardExpand all lines: aws-serverless-java-container-spark/src/main/java/com/amazonaws/serverless/proxy/spark/SparkLambdaContainerHandler.java
+13-6Lines changed: 13 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -26,6 +26,7 @@
26
26
importorg.slf4j.LoggerFactory;
27
27
importspark.Service;
28
28
importspark.Spark;
29
+
importspark.embeddedserver.EmbeddedServerFactory;
29
30
importspark.embeddedserver.EmbeddedServers;
30
31
31
32
importjava.lang.reflect.Field;
@@ -91,7 +92,8 @@ public static SparkLambdaContainerHandler<AwsProxyRequest, AwsProxyResponse> get
Copy file name to clipboardExpand all lines: aws-serverless-java-container-spark/src/main/java/com/amazonaws/serverless/proxy/spark/embeddedserver/LambdaEmbeddedServer.java
+18-11Lines changed: 18 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,6 @@
15
15
importjava.io.IOException;
16
16
importjava.util.Map;
17
17
importjava.util.Optional;
18
-
importjava.util.concurrent.CountDownLatch;
19
18
20
19
publicclassLambdaEmbeddedServer
21
20
implementsEmbeddedServer {
@@ -45,19 +44,14 @@ public class LambdaEmbeddedServer
Copy file name to clipboardExpand all lines: aws-serverless-java-container-spark/src/main/java/com/amazonaws/serverless/proxy/spark/embeddedserver/LambdaEmbeddedServerFactory.java
+15Lines changed: 15 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -14,6 +14,21 @@ public class LambdaEmbeddedServerFactory implements EmbeddedServerFactory {
14
14
privatestaticLambdaEmbeddedServerembeddedServer;
15
15
16
16
17
+
/**
18
+
* Empty constructor, applications should always use this constructor.
19
+
*/
20
+
publicLambdaEmbeddedServerFactory() {}
21
+
22
+
23
+
/**
24
+
* Constructor used in unit tests to inject a mocked embedded server
Copy file name to clipboardExpand all lines: aws-serverless-java-container-spark/src/test/java/com/amazonaws/serverless/proxy/spark/HelloWorldSparkTest.java
Copy file name to clipboardExpand all lines: aws-serverless-java-container-spark/src/test/java/com/amazonaws/serverless/proxy/spark/SparkLambdaContainerHandlerTest.java
0 commit comments