You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@avalon.apache.org by Peter Donald <do...@apache.org> on 2001/09/15 06:00:07 UTC
Re: Avalon and EJB
On Sat, 15 Sep 2001 13:17, James Hsu wrote:
> As a product company a lot of our
> customers want us to comply with EJB
> infrastructure. Customer for sure will not
> like to see two containers, App server and
> Phoenix run at same time.
Agreed it is a difficult situation especially with regard to managment of
system and their resources. Logging is the one that jumps out at me - it is
painful to have to look in N different places to find cause of error or
whatever.
> My question is what is the best way to make
> the Avalon component be able to be used in the
> EJB container. If I use Phoenix to startup my
> components now I may need to create an EJB
> object to do the similar thing as Phoenix. Is
> this is right approach? Should we make EJB
> version of Phoenix?
You have to forgive my somewhat vagueness in the next section because I am
not a big EJB user and this information is second hand (ie I have never
programmed it or even used it).
EJBs have certain advantages - especially when it comes to transactions and
database/resource access however there are also a fair few restrictions (like
in how it deals with native resources or threads or sockets or whatever). So
if you need to access/use these things or have a persistent service inside
EJB server then it would be useful to use Phoenix for this context. The more
persistent services you need the more Phoenix will offer you.
The real problem of course is that every single application server tends to
make writing these persistent services not cross-EJB-server. However all of
them tend to allow these services to be bound in JNDI.
So say we were to bind services that were exported from Phoenix into the JNDI
space you could access these services from EJBs by doing something like
Context ctx = new InitialContext();
MyPersistentService mps = ctx.lookup( "Phoenix/MyPersistentService" );
mps.doOperation( ... );
or whatever.
There is a few drawbacks to this of course. The two most imediate drawbacks
are
* What happens when EJB server is clustered?
* There is not a standard API for Phoenix services.
In the first case this can be an issue but it is usually assumed that you
configure each node with a separate copy of service code and data. In some
cases the data may be stuck in a DB and a lot of the clustering then becomes
very easy.
The second issue (ie Phoenix is non-standard) is actually being adressed by
the Services JSR and will hopefully end up being part of the J2EE family of
APIs.
However I only know of a few people who have actually done this and they have
all been using the Weblogic server. From memory the way you do it in this
server is to place a entry in config file for a "Startup" class. It looks
something like
import weblogic.common.T3StartupDef;
import weblogic.common.T3ShutdownDef;
class WebLogicPhoenixStartup
implements T3StartupDef, T3ShutdownDef
{
void setServices(T3ServicesDef services) {...}
void startup(String name, Hashtable hashtable)
{
//startup Phoenix here and bind it into JNDI space
}
void shutdown(String name, Hashtable hashtable)
{
//shutdown Phoenix here and unbind it from JNDI space
}
}
I saw something like this *ages* ago and could probably do a template for you
if it became an issue. Though you would have to check that it compiled and
worked ;)
Two other issues that would need to be addressed. Ideally the Phoenix logs
would be redirected to Weblogic logging subsystem and you could do this
easily by adding a new WebLogicLogTarget (or whatever). Also you may have to
work a bit to get the ClassLoader correct (the interfaces for services would
need to be in base classloader).
Anyways at this stage it is a bit of a hassle because there is no standard
API and Phoenix does not yet have a nice managment interface. However I hope
that these two negatives will be gone within 8-9 months and then assuming the
JSR passes muster that the EJB/other app-server vendors add in support for
this API. At this stage it would be a no-brainer to use but up until then I
am not sure ;) I would use it but I am prolly biased ;)
--
Cheers,
Pete
*----------------------------------------------------------*
The phrase "computer literate user" really means the person
has been hurt so many times that the scar tissue is thick
enough so he no longer feels the pain.
-- Alan Cooper, The Inmates are Running the Asylum
*----------------------------------------------------------*
---------------------------------------------------------------------
To unsubscribe, e-mail: avalon-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: avalon-dev-help@jakarta.apache.org