works and doesn't exit suddenly
This commit is contained in:
parent
f1d17105a9
commit
a78b97c5c1
2
.idea/compiler.xml
generated
2
.idea/compiler.xml
generated
@ -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>
|
||||
@ -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));
|
||||
}
|
||||
|
||||
@ -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) ;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user