A netlet may terminate voluntarily, or it may be asked by the node
to do so (see Figure ). In either case, it is recommended
that netlets terminate all their threads. After all the threads have
terminated, the node should remove the netlet and release all corresponding
resources (memory, classloaders, mediators, etc).
Should a netlet be unable/unwilling to terminate all its threads in a timely fashion, the hosting node should terminate the remaining threads.
There is an informational facility for netlets to publish their shutdown progress as a percentage completed. This does not affect the shutdown sequence.
Figure (A) shows the scenario where termination
is triggered by the node. This could happen, for example, when the
node is shut down.
Figure (B) shows a netlet asking to be shut down.
After the initial requestTermination() request, this sequence
is identical to case (A).