This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
try { | |
ServerBootstrap b = new ServerBootstrap(); | |
b.group(acceptorGroup, handlerGroup) | |
.channel(NioServerSocketChannel.class) | |
.childHandler(new MySocketInitialiser()) | |
.option(ChannelOption.SO_BACKLOG, 5) | |
.childOption(ChannelOption.SO_KEEPALIVE, true); | |
b.localAddress(port).bind().sync(); | |
LOG.info("Started on port {}", port); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NioEventLoopGroup acceptorGroup = new NioEventLoopGroup(2); // 2 threads | |
NioEventLoopGroup handlerGroup = new NioEventLoopGroup(10); // 10 threads |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NioEventLoopGroup acceptorGroup = new NioEventLoopGroup(2); // 2 threads | |
NioEventLoopGroup handlerGroup = new NioEventLoopGroup(10); // 10 threads |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import static spark.Spark.*; | |
public class HelloWorld { | |
public static void main(String[] args) { | |
get("/hello", (req, res) -> "Hello World"); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.get('/', function (req, res) { | |
res.send('Hello World!'); | |
}); |
NewerOlder