Browse Source

use the netty way of detecting if epoll is available

Luis Filipe dos Santos Neves 11 years ago
parent
commit
3a4dd4202a
1 changed files with 2 additions and 5 deletions
  1. 2 5
      netty/src/main/java/hello/HelloWebServer.java

+ 2 - 5
netty/src/main/java/hello/HelloWebServer.java

@@ -6,6 +6,7 @@ import io.netty.channel.Channel;
 import io.netty.channel.ChannelOption;
 import io.netty.channel.EventLoopGroup;
 import io.netty.channel.ServerChannel;
+import io.netty.channel.epoll.Epoll;
 import io.netty.channel.epoll.EpollEventLoopGroup;
 import io.netty.channel.epoll.EpollServerSocketChannel;
 import io.netty.channel.nio.NioEventLoopGroup;
@@ -28,12 +29,8 @@ public class HelloWebServer {
 
     public void run() throws Exception {
 		// Configure the server.
-
-		String os = System.getProperty("os.name").toLowerCase();
-
-		boolean is_linux = os.contains("linux");
 		
-		if (is_linux) {
+		if (Epoll.isAvailable()) {
 			doRun( new EpollEventLoopGroup(), EpollServerSocketChannel.class);
 		}
 		else {