blackdrag commented on PR #3347: URL: https://github.com/apache/groovy/pull/3347#issuecomment-7155784577
Oh, why is @daniellansun doing the PR for @jdbeutel had I known I would have explained in much more detail. GroovyShell.parseClass essentially delegates to GroovyClassLoader.parseClass, which will spin up a inner loader, that is then used to define the class. If nothing is done about it, that class keeps existing. But GroovyShell has resetLoadedClasses, which will detach the inner loader from the GroovyClassLoader and GroovyShell. Noe it depends on the usage of the class if it can be collected. Therefore a simple solution is ```Java // Compile and execute the script for this connection Script script = shell.parse(source); // Handle connection using script // Once this connection is finished: shell.resetLoadedClasses(); ``` This should avoid the issue 3476 problem. This does not make `groovy -l` a server able to handle multiple concurrent clients. But I also do not think that this or effeciently caching the script class is really needed to fix the issue that was reported. I advise to do a small scope fix and anything else should be in another issue/PR -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
