|
From: <php...@li...> - 2009-07-22 16:56:05
|
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,
>
> You could also use the JPersistenceAdapter to store your PHP/Java objects on
> disc or in the database.
>
> Please see JPersistence.php from the documentation.zip download.
>
> Regards,
> Jost Boekemeier
>
> 21. Jul 2009 9:26 nachm. schrieb am <
> php...@li...>:
>
> O wise developers,
>
> I am trying to persist a java object (from PHP) using PHP/Java Bridge,
> because interacting with that object is expensive and I don't want to
> repeat calculations. I have read through the examples and the FAQ,
> and done some searching through the mailing list, but found very few
> references to persistence. The only references I did find used
> sessions. It was fairly easy to implement persistence using a named
> session, but I found that it has the problem of eventual expiration.
> Is this the only way to persist an object? The FAQ seems to imply
> that there is another (built-in) way, but it doesn't give any hint as
> to what that might be.
>
> I am running PHP/Java Bridge 5.4.4.2 on Tomcat 6.0.20, and connecting
> to it from PHP5 running on a vanilla Apache2 install.
>
> Thanks for your help,
>
> - Chris Sullins
>
>
>
> >From the FAQ:
>
>> Q: How do I make my script state (objects or variables) persistent?
>> A: If you must code it yourself: with e.g. java_session()->put("buf",
> $stringBuffer)
>
> >From the Session Sharing example:
>
> if(is_null(java_values($session->get("counter")))) {
> $session->put("counter", 1);
> }
> $counter = java_values($session->get("counter"));
>
> ------------------------------------------------------------------------------
> _______________________________________________
> php-java-bridge-users mailing list
> php...@li...
> https://lists.sourceforge.net/lists/listinfo/php-java-bridge-users
> ------------------------------------------------------------------------------
> _______________________________________________
> php-java-bridge-users mailing list
> php...@li...
> https://lists.sourceforge.net/lists/listinfo/php-java-bridge-users
>
|