1 36 37 import java.nio.channels.*; 38 import java.util.concurrent.*; 39 40 48 public class BP extends Server { 49 50 private static final int POOL_MULTIPLE = 4; 51 52 BP(int port, int backlog, boolean secure) throws Exception { 53 super(port, backlog, secure); 54 } 55 56 void runServer() throws Exception { 57 58 ExecutorService xec = Executors.newFixedThreadPool( 59 Runtime.getRuntime().availableProcessors() * POOL_MULTIPLE); 60 61 for (;;) { 62 63 SocketChannel sc = ssc.accept(); 64 65 ChannelIO cio = (sslContext != null ? 66 ChannelIOSecure.getInstance( 67 sc, true , sslContext) : 68 ChannelIO.getInstance( 69 sc, true )); 70 71 RequestServicer svc = new RequestServicer(cio); 72 xec.execute(svc); 73 } 74 } 75 } 76 | Popular Tags |