|
From: <php...@li...> - 2009-07-22 17:16:32
|
Hi, So you need a Java singleton object which is loaded with the library and persisted right before the web context or the entire JVM is destroyed? The java_context() supports a synchronized init() and an onShutdown() hook, where you can set up the singleton and synchronize with the database. Please see report.php (within JavaBridge.war) for details. However, that's one singleton per jvm, not per cluster. If you want to set up a cluster, better use a 3tier approach instead and allocate your session beans there. Regards, Jost Boekemeier 22. Jul 2009 6:56 nachm. schrieb am < php...@li...>: Thanks Jost, for your quick reply. That looks like a very handy class (I had not even stumbled across that folder yet; it looks like it contains other useful things). Unfortunately, I need to be able to connect to the same Java object from multiple php scripts, with the risk that one call will be executing while another script begins access. So file access won't be enough. Named sessions won't be enough, either, since even instances of the same session are separate executions when they are from different scripts. What I really want to do is be able to send messages across the bridge to the same Java execution from different scripts. Is there any discussion/documentation of how exactly the PHP/Java Bridge keeps track of the scripts that are accessing it? I have planned a workaround using cron jobs, in which case I might go ahead and use Persistence rather than Session (and consolidate calls to the object every 10 or 20 seconds, say). But it would be much nicer to just keep it running, since the web app will be accessing it pretty constantly. Thanks, Chris On Wed, Jul 22, 2009 at 9:06 AM, < php...@li...> wrote: > Hi, > > Yo... |