[xSocket-develop] NonBlockingConnection - EXECUTOR pool?
Status: Inactive
Brought to you by:
grro
|
From: David H. (IS - E. Tech) <dav...@do...> - 2008-11-05 19:56:19
|
In the NonBlockingConnection, why is a separate connection pool used (EXECUTOR on line 671) rather than the workerpool that is passed in as a parameter? It seems that if I'm trying to control the number of running threads, via the workerpool, this will launch more threads than I want.
647 /**
648 * client constructor, which uses a specific dispatcher
649 */
650 private NonBlockingConnection(final InetSocketAddress remoteAddress, boolean waitForConnect, final int connectTimeoutMillis, final Map<String, Object> options, final SSLContext sslContext, final boolean isSecured, final IHandler appHdl, final Executor workerpool, boolean autoflush, FlushMode flushmode) throws IOException {
651 setFlushmode(flushmode);
652 setAutoflush(autoflush);
653 setWorkerpool(workerpool);
654
655 appHandler.set(HandlerAdapter.newInstance(appHdl));
656
657 if (waitForConnect) {
658 connect(remoteAddress, connectTimeoutMillis, options, sslContext, isSecured);
659
660 } else {
661 Runnable connectTask = new Runnable() {
662
663 public void run() {
664 try {
665 connect(remoteAddress, connectTimeoutMillis, options, sslContext, isSecured);
666 } catch (IOException ioe) {
667 onDisconnect();
668 }
669 }
670 };
671 EXECUTOR.execute(connectTask);
672 }
673 }
|