Sun Java System Web Server 6.1 SP7 NSAPI Programmer's Guide


Applicable in Init-class directives.

The thread-pool-init function creates a new pool of user threads. A pool must be declared before it is used. To tell a plug-in to use the new pool, specify the pool parameter when loading the plug-in with the Init-class function load-modules.

One reason to create a custom thread pool would be if a plug-in is not thread-aware, in which case you can set the maximum number of threads in the pool to 1.

The older parameter NativeThread=yes always engages one default native pool, called NativePool.

The native pool on UNIX is normally not engaged, as all threads are OS-level threads. Using native pools on UNIX may introduce a small performance overhead, as they’ll require an additional context switch; however, they can be used to localize the jvm.stickyAttach effect or for other purposes, such as resource control and management, or to emulate single-threaded behavior for plug-ins.

On Windows, the default native pool is always being used and Sun Java System Web Server uses fibers (user-scheduled threads) for initial request processing. Using custom additional pools on Windows introduces no additional overhead.

In addition, native thread pool parameters can be added to the magnus.conf file for convenience. For more information, see “Native Thread Pools” in the chapter “Syntax and Use of magnus.conf” in the Sun Java System Web Server 6.1 SP7 Administrator’s Configuration File Reference.


The following table describes parameters for the thread-pool-init function.

Table 2–17 thread-pool-init parameters




Name of the thread pool. 


Maximum number of threads in the pool. 


Minimum number of threads in the pool. 


Size of the queue for the pool. If all threads in the pool are busy, further request-handling threads that want to get a thread from the pool will wait in the pool queue. The number of request-handling threads that can wait in the queue is limited by the queue size. If the queue is full, the next request-handling thread that comes to the queue is turned away, with the result that the request is turned down, but the request-handling thread remains free to handle another request instead of becoming locked up in the queue. 


Stack size of each thread in the native (kernel) thread pool. 


Init fn=thread-pool-init name="my-custom-pool" 
maxthreads=5 minthreads=1 queuesize=200
Init fn=load-modules shlib="C:/mydir/myplugin.dll" 
funcs="tracker" pool="my-custom-pool"

See Also