The class cache
tal.liron at threecrickets.com
Wed Mar 12 09:27:29 UTC 2014
In Nashorn, the ClassCache is set per Global instance.
This is fine if your application has only one global instance. However,
my application design involves creating many Global instances.
(Actually, I create and destroy them on the fly per user request in an
HTTP server scenario.) The problem is that all code has to constantly be
recompiled, and the cache is essentially never used. Since recompilation
is so very expensive in Nashorn, this results in awful performance.
How can I implement a shared ClassCache? I can't extend and modify
Global behavior, because it's a final class.
I've tried to cache ScriptFunction instances myself, but I get
exceptions when I try to run them with a different Global instance than
the one that created them.
More information about the nashorn-dev