avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leo Sutic" <leo.su...@inspireinfrastructure.com>
Subject RE: [RT (was: OT)] .Net better than Java in some ways
Date Mon, 12 May 2003 14:49:44 GMT


> From: news [mailto:news@main.gmane.org] On Behalf Of Leo Simons
>
> ah....yes! In the meantime, consider:
> 
> void service( ServiceManager manager )
> {
>      m_manager = manager;
>      // ...
>      m_comp = ServiceUtil.get( MyComponent.ROLE, m_manager );
>      m_comp2 = ServiceUtil.get( MyOtherComponent.ROLE, m_manager );
> }
> void dispose()
> {
>      ServiceUtil.release( m_comp, m_manager );
>      ServiceUtil.release( m_comp2, m_manager );
> }
> 
> for encapsulating the try/catch :D

Not quite:

 1. m_comp = ServiceUtil.get( MyComponent.ROLE, m_manager );

    You need a cast here:

    m_comp = (MyComponent) ServiceUtil.get( MyComponent.ROLE, m_manager
);

 2. This does not work on a per-request basis. I.e. when you are looking
    up components and expect to release them before the client itself
    is disposed.

I found JJTree & JavaCC which seems like the tools to use for this kind
of
processing.

/LS


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@avalon.apache.org
For additional commands, e-mail: dev-help@avalon.apache.org


Mime
View raw message