here is my code
Code: Select all
import io.netty.bootstrap.ServerBootstrap;
import io.netty.channel.Channel;
import io.netty.channel.EventLoopGroup;
import io.netty.channel.nio.NioEventLoopGroup;
import io.netty.channel.socket.nio.NioServerSocketChannel;
public
class Server {
private final int port;
public
Server(int port) {
this.port = port;
}
public static
void main(String[] args) throws Exception {
int port;
if (args.length > 0) {
port = Integer.parseInt(args[0]);
}
else {
port = 9050;
}
new Server(port).run();
}
public
void run() throws Exception {
// Configure the server.
EventLoopGroup bossGroup = new NioEventLoopGroup();
EventLoopGroup workerGroup = new NioEventLoopGroup();
try {
ServerBootstrap b = new ServerBootstrap();
b.group(bossGroup, workerGroup)
.channel(NioServerSocketChannel.class)
.childHandler(new Initializer());
Channel ch = b.bind(port).sync().channel();
ch.closeFuture().sync();
}
finally {
bossGroup.shutdownGracefully();
workerGroup.shutdownGracefully();
}
}
}I want the service to continously run on 9050. If this throws any excpetion, where do i check the logs?
FOLLOW US
Get the latest news in Application Packaging