geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "gianny DAMOUR" <gianny_dam...@hotmail.com>
Subject Re: What is GBeanMBeanContext for?
Date Tue, 16 Mar 2004 22:34:51 GMT
Dain Sundstrom wrote:
>GBeanMBeanContext is an implementation of GBeanContext which is a handle 
>given to a GBean to allow it to notify the GBean wrapper (container if you 
>like) of state changes.  I expect the most common use to be calling the 
>fail() method when the service dies.  For example, if the transaction log 
>is full the transaction manager can notify it's users that the it is dead.  
>I don't think anyone is using this yet, but it will become more important 
>over time.
I am aware of one :-)

org.apache.geronimo.datastore.impl.remote.messaging.ServerNode

Basically, if the socket server listening for connections to be made can not 
be started or stopped, then GBeanContext.fail() is called.

By the way, when a Reference is a Collection, the framework provides to the 
GBean a ReferenceCollection. This latter can be used in order to be notified 
when a Reference is added or removed.

AFAIK, this feature is not used (except 
org.apache.geronimo.webdav.jetty.JettyDAVServer) and I do not really 
understand how to use it "correctly":

Consider the following constructor:

MyGBean(Collection aReferenceColl) {
}

If I want to use the ReferenceCollection notification mechanism, then I will 
need to cast aReferenceColl. This is fine, except if one wants to execute it 
as a simple instance and not within a
running server. Moreover, as ReferenceCollection does not have a visible 
implementation, it means that to unit-test a GBean, one needs to write an 
implementation (I agree, this is also fine).

So I do have a question: is it possible to change slightly the way 
Collection references are handled? More accurately, if one does not need the 
notification mechanism, then one can use the current implementation. If one 
needs to be notified, then one could implement a new mechanism, which 
invokes on the target GBean a "addX" or "removeX" (configurable via 
GReferenceInfo) when a reference is added or removed respectively.

Thanks,
Gianny

_________________________________________________________________
MSN Messenger  http://g.msn.fr/FR1001/866 : un logiciel gratuit pour 
dialoguer avec vos amis !


Mime
View raw message