works and doesn't exit suddenly

This commit is contained in:
Mihai Moldovanu 2022-08-02 20:50:39 +03:00
parent f1d17105a9
commit a78b97c5c1
3 changed files with 8 additions and 4 deletions

2
.idea/compiler.xml generated
View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="15" />
<bytecodeTargetLevel target="9" />
</component>
</project>

View File

@ -11,7 +11,7 @@ import com.twitter.util.Future;
public class GreetingsService extends Service<Request, Response> {
@Override
public Future<Response> apply(Request request) {
String greeting = "Hello " + request.getParam("name");
String greeting = "Hello1 " + request.getParam("name");
Reader<Buf> reader = Reader.fromBuf(new Buf.ByteArray(greeting.getBytes(), 0, greeting.length()));
return Future.value(Response.apply(request.version(), Status.Ok(), reader));
}

View File

@ -1,10 +1,14 @@
package ro.mihai;
import com.twitter.finagle.Http;
public class Main {
public static void main(String []args) {
GreetingsService sServ = new GreetingsService();
Http.serve(":8080", sServ);
Http.server().withAdmissionControl()
.concurrencyLimit(10, 0)
.serve(":8080", sServ);
System.out.println("seems that this is async .... so we wait for connections");
while( true) ;
}
}