Aaron,

> 
> I was also having some problems where if the JVM goes away (e.g.
> Inline::Java::Server=stop) Inline::Java calls will fail with 'Can't
> receive packet from JVM:  at
> lib/i386-linux-thread-multi/Inline/Java/Protocol.pm' until the
> Inline::Java code is reloaded, i.e. when Apache is restarted, even if
> the JVM is started up again (e.g. Inline::Java::Server=start).

That's normal because you have to reconnect to the new JVM. You can
use Inline::Java::reconnect_JVM() to reconnect, but be aware that this
function will try to start a new JVM server (if it can't find one)
unless you have "START_JVM => 0" in the config.

Basically when you use SHARED_JVM, you can see it like any other
server, a database server for example. The only difference is that the
client knows how to start the server if it can't find one when it
tries to connect. The START_JVM option forbids the client to try to
start a server if it can't find one, for the reasons you have
discovered above.

> > You could try it and see if that still happens, but I remember that
> > being a problem.
> 
> Right now I have a pretty nice solution/workaround of use'ing the module
> that use's Inline::Java in a startup script, i.e. in the parent process,
> and registering a cleanup handler:
> 
> use Inline::Java::Server ();
> use UFT::PlunkIT::ContactBookServiceInline (); # starts up JVM
> 
> Apache->server->register_cleanup(\&Inline::Java::Server::stop);
> 

That's a very good idea. I had never thought of that. That way to have
the life of the JVM server tied to that of Apache.

> > If anyone can find the exact problem, I will try to fix Inline::Java
> > so it works properly under those circumstances.
> 
> Can you tell me how the JVM knows that it's time to exit if it's running
> in SHARED_JVM?

Basically it never exits unless it is told to either by using
Inline::Java::Server::stop or by
"capturing" it explicitely (from any client) and shutting it down like this:

   Inline::Java::capture_JVM() ;
   Inline::Java::shutdown_JVM() ;

This is basically what Inline::Java::Server::stop does actually.

So under normal circumstances in your setup if it goes down before
Aaache it probably means it crashed :(

> 
> Thanks, Aaron
> 

Cheers,

Patrick

-- 
=====================
Patrick LeBoutllier
Laval, Québec, Canada

Reply via email to