So I believe Groovysh is taking the classloader as an argument to bind within the context of OFBiz hence using the current thread (OFBiz) class loader to inject itself.
Now if you are going to eventually shutdown OFBiz, no problem, the shutdown hook will kick in and kill anything running in memory in a clean way including Groovysh because it's registered on the classloader. However, if you crash, or disconnect from the server for example, what happens to that session? Does it terminate? Does it linger in memory? If so, you need to create a hook (maybe a timeout hook) to ensure termination. I find this feature nice, So I might use it often and if I do, I might have ghost sessions that pile up over time (Assuming I'm not missing anything and my understanding of how the shell works is correct). If we can ensure that we won't likely have ghost sessions for whatever reason, then we ensure memory safety and no leaks happening (unless maybe someone writes an infinite loop or something). On Sun, Jan 13, 2019 at 12:33 AM Mathieu Lirzin <mathieu.lir...@nereide.fr> wrote: > > Hello Taher, > > Taher Alkhateeb <slidingfilame...@gmail.com> writes: > > > On a quick review of the code, and given that we're populating the > > class loader of current thread, can we ensure clean termination of > > shells? > > This work is experimental, so be prepared to ruff edges. :-) > > I didn't thought about the implications of using the current thread > class loader. What kind of scenario of non-clean termination of shells > have you in mind? > > Thanks for your comment. > > -- > Mathieu Lirzin > GPG: F2A3 8D7E EB2B 6640 5761 070D 0ADE E100 9460 4D37