In my application (in my work) we support a socket pool for communication processing. There are several threads (a large number) that take an active connection from the pool, use it, and close it. But the trick is that somewhere between the garbage collector links are collected that are not used.
Now, after calling the garbage collector, I want:
- suspend all threads participating in the message (note that my threads run together with GC -> I mean, scheduling allows)
- release socket connections from the stream (for example, socket connection links), the status of which can be somewhere in the middle or if it is practically impossible:
- How to delay a GC call after all threads using resources have completed. further in this case, it may be necessary to determine whether the respective threads have completed their work.
source
share