----- Original Message -----
From: "André Warnier" <***@ice-sa.com>
To: "Tomcat Users List" <***@tomcat.apache.org>
Sent: Thursday, October 09, 2008 9:59 AM
Subject: Re: Communicating between webapps
Post by André WarnierHi.
This is not "my" thread, so if anyone thinks I'm pushing the envelope a
bit, tell me and I'll start another one.
how to share some data, in general, between "collaborating" webapps within
the same container.
My case goes somewhat like this : an application consisting of several
webapps needs access to some common data (read/write).
Each webapp can modify this data, and the changes should be immediately
visible to the other webapps.
The data is originally loaded and parsed from a disk file, expensively.
I would like to avoid each individual webapp to have to reload and reparse
this data each time it needs to access it.
In other words, a kind of global "in-memory" DB is what I'm looking for,
where individual webapps can create/modify/read/delete "records" with
known keys, in shared mode.
I believe that this would also cover the requirements of the OP, although
it's probably more than he needs.
I realise that this can be done via e.g. an external DB.
It could also probably be done, most portably, by creating an entirely
separate application accessed via HTTP calls e.g. (à la "Amazon DB" ?).
But it looks as if "within the same container", it would be much more
efficient if kept in local memory, and avoiding overhead like TCP/IP or
JDBC or RMI.
Not being an expert in any of the underlying matters, I would just like to
know from the eperts here, but preferably without too many difficult words
like "classloader" and "dispatchers", if this is in theory
possible/allowed, if it could be done in such a way as to be portable to a
different container etc..
There is an Application Server like this... its mine... ha ha... but is not
open soure... awe gee...
Has to be classified as "new" because we little guys... no onsite Java
campus here ;)
We use it to do exactly this kind of thing... I'm proud of it, and it has
become our core internal tool of choice... but only use it in experimental
stuff.
Its a webapp... so you drop it into any Tomcat...
Its not "bean" based, it runs applications...
In your case this is what we would do...
Make the Java Lib... test it in your webapp as normal...
When you ready drop it nto the Harbor webapp...
Then in any Tomcat that wants to use it...
vessel = new Vessel("URL OF HARBOR TOMCAT");
i_MailEngine =
(I_MailEngine)vessel.loadRemoteSingleton(I_MailEngine.class,"kewlstuff.harbor.mailer.MailEngine","APP_ID");
... use that class.... eg
i_MailEngine.Send("message"); // etc
Like RMI and all the rest its doing serialization and typically one has to
know how to use an interface with a class... but thats it.
If we did this....
Class uiApp = vessel.getRemoteClass("kewlstuff.mailer.test.ui.UI");
Then that class runs on the users machine... so even our Swing apps now live
in Tomcat...
Its like RMI but my baby runs full applications.... for example in one app
we have, we load up a client side, that actually uses a complete H2 dB... on
the client (not installed on the client) and we leave the Postgres side on
the server... all still works as one app ;)
Andre all these tools are on the EJB spectrum... thats where you actually
going...
RMI is remote procedure calls
EJB is RMI with Beans
PAS (my baby) is remote applications.
The PAS is http based thus no Registry stuff needed... it addresses in the
same way the internet does... so there are differences, but underneath its
all much of the same core technologies... sockets are talking, data is
serializing, classes are moving over the wire... yada yada
RMI and My Baby are binary based... and that why they kick a web services
butt (SOAP is wrapped in XML) its got to translate images to text and and
and...
But Soap will work between .Net and Java... in theory anyway... the PAS is
Java only...
These tools work across the world... doesnt have to be in the same TC... if
it is, then all this stuff reduces to a little old Class (or the lesser
bean) in little old Java.
You have to study the stuff out there... and you need to try them... I
remember rushing out years ago, and getting all excited about SOAP (web
services)... damn that is slow... the answer is always... it depends...
I'm very much for the KISS principle... if you dont need it, dont use it...
nothing is more powerful that POJO (plain old Java).
Thing is KISS does not mean novice... you'll find only the guys that have
been around for a while can really KISS ;)
Have fun... study em all...
---------------------------------------------------------------------------
HARBOR : http://www.kewlstuff.co.za/index.htm
The most powerful application server on earth.
The only real POJO Application Server.
See it in Action : http://www.kewlstuff.co.za/cd_tut_swf/whatisejb1.htm
---------------------------------------------------------------------------
If you cant pay in gold... get lost...
---------------------------------------------------------------------
To start a new topic, e-mail: ***@tomcat.apache.org
To unsubscribe, e-mail: users-***@tomcat.apache.org
For additional commands, e-mail: users-***@tomcat.apache.org