public class LambdaFunctionHandler implements RequestHandler<Object, String> {
@Override
public String handleRequest(Object input, Context context) {
Runnable runnable = new Runnable() {
@Override
public void run() {
System.out.println("Hello");
}
}
Thread thread1 = new Thread(runnable);
thread1.start();
Thread thread2 = new Thread(runnable);
thread2.start();
Thread thread3 = new Thread(runnable);
thread3.start();
Thread thread4 = new Thread(runnable);
thread4.start();
}}
I've tried normally and it works fine. but on the lambda function it will not work properly. Thread is dying before the complete excution of threads. when return statement called it is automatically stopping threads.
Expected result
Hello
Hello
Hello
Hello
Actual Result
Hello