-----Original Message-----
From: Gene Chuang [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, February 13, 2002 11:41 PM
To: [EMAIL PROTECTED]
Subject: Re: EJBHome Factory - Home Object Caching> I have a theory that goes something like this: For every problem there's a solution involving dynamic proxies.
Rickard's theory has been proven in practice! First let me discribe what the vendor (Weblogic in my case) already provides. WL implements replica-aware failover stubs at both the EJBHome and EJBObject level. Hence you can cache references at either level and expect proper failover/round-robining if one node goes down.
However, if you are using a non-clustered server, OR if a request is sent when all servers are down, then the cached stub will throw an exception since no service is available. And if the service is down for a long time, the stub may become invalid altogether (not 100% sure about this, although I've seen it before).
The solution is to implement your own smart stub wrapper over what your vendor already provides, using Dynamic Proxies. In short, you want to create a factory that generates EJBHomes, wrapped by DP which can recreate the Context. Hence your stub can intercept all service-failure exceptions, sleep for a while, and re-lookup the EJBHome itself from a new Context, and try again. Using DPs, you only have to write a single InvocationHandler for all your bean homes, and the implementation is completely transparent to the client.
Dimitri has posted a nice writeup on how to implement DP intercepts at every level of EJB client stubs. http://dima.dhs.org/misc/ejbproxy.jsp And given my info above, I'm sure you can write your own smart stubs with ease.
Gene
Rickard <[EMAIL PROTECTED]> wrote:
Venkata Reddy Vajrala wrote:
> You have to use an ordinary Java class(not an ejb) as ejb home factory
> as explained in "EJBHome factory design pattern" available for review at
>
> http://www.theserverside.com/patterns/index.jsp
>
> But I got one doubt after reading that document. The cached homes will
> throw an exception if the ejb server is down for some time and then up.
> What could be the
> workaround for this problem? The client using the cached ejb home
> cannot get the reference and store it in the factory. Any ideas?
I have a theory that goes something like this:
For every problem there's a solution involving dynamic proxies.
I would be surprised if it didn't apply here :-)
/Rickard
--
Rickard �berg
Author of "Mastering RMI"
Chief Architect, TheServerSide.com
The Middleware Company - We Build Exxperts!
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".
Do You Yahoo!?
Send FREE Valentine eCards with Yahoo! Greetings!
I
assume that security is not taken into account in this discussion. What if there
is a security constraint on Home interface which declares that only principal
with Role 'X' can access the methods of the interface.
Hence
if we have a cache which is populated once and reused for every user then
security goes for a toss
Any
comments...
-
Rajeev
- EJBHome Factory - Home Object Caching Venkata Reddy Vajrala
- Re: EJBHome Factory - Home Object Caching Rickard
- Re: EJBHome Factory - Home Object Caching Gene Chuang
- Re: EJBHome Factory - Home Object Caching Krishnan Subramanian
- Re: EJBHome Factory - Home Object Caching Rajeev Dave
- Re: EJBHome Factory - Home Object Caching Rajeev Dave
- Re: EJBHome Factory - Home Object Caching Rickard
- Re: EJBHome Factory - Home Object Caching Gene Chuang
- Re: EJBHome Factory - Home Object Caching Rajeev Dave
- Re: EJBHome Factory - Home Object Caching Rajeev Dave
