The method allows the netlet to determine how many threads the node should start on its behalf. This is nothing to do with how many threads the netlet itself can start--it's completely free to start as many threads of its own as it wishes. But this threads parameter determines how many threads the node can start.
For example, our Hello2Provider offers a facet for others to use, the facet with the getMessage() method. When a client calls that getMessage() method the node starts another thread for Hello2Provider and executes that method. If two hundred clients call it simultaneously the node could start two hundred such threads, which may be very undesirable.
But our provider netlet can avoid this with the setConcurrency() method. If we set threads to 10 then the node will start no more than 10 threads for the provider. If there are 10 threads running and an 11th thread needs starting it will wait until one of the existing ones completes.
When we talk about the number of threads we include all threads started by the node for that netlet. This includes:
Note: At the time of writing the default concurrency level is 100, which is quite enough. If you're using more than 100 threads then it's probably time to rework your application.
Nik Silver 2002-03-09