File | Doc | Category | Size | Date | Package |
---|
BP.java | API Doc | Sun JDK 1.5.0 Example | 2782 | Sat Jan 08 15:08:43 GMT 2005 | None |
BPpublic class BP extends Server A multi-threaded server which creates a pool of threads for use
by the server. The Thread pool decides how to schedule those threads. |
Fields Summary |
---|
private static final int | POOL_MULTIPLE |
Constructors Summary |
---|
BP(int port, int backlog, boolean secure)
super(port, backlog, secure);
|
Methods Summary |
---|
void | runServer()
ExecutorService xec = Executors.newFixedThreadPool(
Runtime.getRuntime().availableProcessors() * POOL_MULTIPLE);
for (;;) {
SocketChannel sc = ssc.accept();
ChannelIO cio = (sslContext != null ?
ChannelIOSecure.getInstance(
sc, true /* blocking */, sslContext) :
ChannelIO.getInstance(
sc, true /* blocking */));
RequestServicer svc = new RequestServicer(cio);
xec.execute(svc);
}
|
|