Skip to content

Instantly share code, notes, and snippets.

@raupachz
Created August 15, 2019 06:54
Show Gist options
  • Save raupachz/3720121bc166562f7f010f27900afbdf to your computer and use it in GitHub Desktop.
Save raupachz/3720121bc166562f7f010f27900afbdf to your computer and use it in GitHub Desktop.
Code for my Medium article AWS Lambda for Java Developers
import com.amazonaws.services.lambda.runtime.Context;
import com.amazonaws.services.lambda.runtime.RequestHandler;
public class LambdaFunction implements RequestHandler<Void, String> {
private final long classloaderTime = System.currentTimeMillis();
private final long constructorTime;
private long methodTime;
public LambdaFunction() {
constructorTime = System.currentTimeMillis();
}
public String handleRequest(Void args, Context context) {
methodTime = System.currentTimeMillis();
return new StringBuilder()
.append("classloaderTime=")
.append(classloaderTime)
.append(", constructorTime=")
.append(constructorTime)
.append(", methodTime=")
.append(methodTime)
.toString();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment