Hello,
One issue with the current way of writing Groovy tests is that the feedback between writing an instruction and checking its result is slow because one has to rerun the corresponding test case. Providing a Groovy shell access with a delegator and dispatcher allows developers to interactively execute commands and check their results instantly. I have implemented such feature in OFBIZ-10805 [1] which might be interested to follow/review for those who care about interactive development. Thanks. [1] https://issues.apache.org/jira/browse/OFBIZ-10805 -- Mathieu Lirzin GPG: F2A3 8D7E EB2B 6640 5761 070D 0ADE E100 9460 4D37 |
+1, very cool idea. A proper review of the code might be in order.
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? On Sat, Jan 12, 2019 at 9:14 PM Mathieu Lirzin <[hidden email]> wrote: > > Hello, > > One issue with the current way of writing Groovy tests is that the > feedback between writing an instruction and checking its result is slow > because one has to rerun the corresponding test case. > > Providing a Groovy shell access with a delegator and dispatcher allows > developers to interactively execute commands and check their results > instantly. > > I have implemented such feature in OFBIZ-10805 [1] which might be > interested to follow/review for those who care about interactive > development. > > Thanks. > > [1] https://issues.apache.org/jira/browse/OFBIZ-10805 > > -- > Mathieu Lirzin > GPG: F2A3 8D7E EB2B 6640 5761 070D 0ADE E100 9460 4D37 |
Hello Taher,
Taher Alkhateeb <[hidden email]> 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 |
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 <[hidden email]> wrote: > > Hello Taher, > > Taher Alkhateeb <[hidden email]> 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 |
In reply to this post by Mathieu Lirzin
Hi Mathieu,
https://cwiki.apache.org/confluence/display/OFBIZ/OFBiz+Attic#OFBizAttic-GroovyShell might be of interest to you. Regards Scott On Sun, 13 Jan 2019, 07:14 Mathieu Lirzin <[hidden email] wrote: > Hello, > > One issue with the current way of writing Groovy tests is that the > feedback between writing an instruction and checking its result is slow > because one has to rerun the corresponding test case. > > Providing a Groovy shell access with a delegator and dispatcher allows > developers to interactively execute commands and check their results > instantly. > > I have implemented such feature in OFBIZ-10805 [1] which might be > interested to follow/review for those who care about interactive > development. > > Thanks. > > [1] https://issues.apache.org/jira/browse/OFBIZ-10805 > > -- > Mathieu Lirzin > GPG: F2A3 8D7E EB2B 6640 5761 070D 0ADE E100 9460 4D37 > |
Free forum by Nabble | Edit this page |