Hi,
One goal I have for using Rhino as an application server language is
to be able to serialize functions in my session between requests. This
includes potentially deserializing these functions into a different
Tomcat instance than the one it was serialized in and executing them.
The documentation seems to indicate that this is possible,
particularly as long as I manage to exclude all of the supporting
library code that the serialized function uses on the
ScriptableOutputStream and the two scopes are identical in all other
respects.
My question (aside from whether or not I'm completely off the mark
with the above scenario) is: can I somehow use the compiled behavior
for all of the code in my application that does not get serialized and
somehow cause Rhino to generate interpreted functions in this certain
case?
My desire is to be able to do this:
function display_a_page(a, b, c) {
let important_value = do_computation(a, b);
let hash_key = generate_hash_key(...);
memcache_set(hash_key, function() {
do_some_stuff(important_value); // lexical closure
});
res.getWriter().print("<a href=\"server.foo.com/fnid/" + hash_key +
"\">click me to get a closure as an event handler!</a>");
}
And then of course to be able to load balance between multiple Tomcat
instances on different hardware (but sharing the same distributed
store via memcache). The idea is that functions like do_computation
(and all of the functions it depends on) would be compiled if
possible.
Is this possible? It seems like the Rhino In Spring project does a
similar thing with continuations, but I'm still too much of a Rhino
novice for it to be clear to me if those functions are getting
compiled or not.
Thanks in advance,
Ben Reesman
_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino