Hello -
I have been working on converting an existing RoR app into a glassfish
environment, using jruby, etc.
One of the things that I am trying to get working, is a way to have a
couple of extra processes running (basically the equivalent of the
activemessaging pollers) - that were originally called via ‘ruby
/path/to/poller/script’. This is basically loading an external JMS
listener that needs to interact with the core rails app - but needs to
be run separately (there are multiple ones that need to be run).
I have this setup now as an MDB that takes a message on whether to start
the process or not, using the embedded API (jruby 1.5) to get this
running. There are cases where we need multiple listeners of the same
object running.
What this does now is:
- Takes the path to the external script
- Creates a new ScriptingContainer
- Runs the scriptlet to the main script, getting the class
- Takes the container and creates an instance of the object
(callMethod(“new”)) - Takes the object instance and calls the “run” method on it to start
the listener we need - Store this saved instance of an object so I can have access to it -
as well as be able to start new instances and run them
This is enabling me to start multiple listeners if needed, and to stop
them if needed (callMethod(“stop”) on the object, which kills the
session and connection to the listener). I need to be able to tell my
environment as well to completely get rid of the instance in memory.
But - there are some major issues I am having that I cannot seem to get
past:
- If I update the external script, I need to be able to “refresh” it -
so I attempt to stop all the existing objects that were created, and
call terminate() on the container, then attempt to reload the original
location. This is causing major memory and state issues, and doesn’t
seem to do what is needed.
I need to be able to change a value or something in the calling script,
and be able to reload this into my environment - basically killing off
all the existing versions of it if possible. I thought terminate might
help here - but I get to a point doing this where my system become
unusable - CPU usage and memory go haywire.
One thing here - the external scripts that are being loaded also load in
the rails environment - I wish they wouldn’t “reload” this whole
environment, and can just utilize the one that the scripts are coming
from - but it sure seems to do so.
Does anyone have any ideas on how I can accomplish this in a better
manner?
Thanks for your time.
–
Robert B. Weeks
[email protected]
To unsubscribe from this list, please visit:
http://xircles.codehaus.org/manage_email