cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leo Sutic" <leo.su...@inspireinfrastructure.com>
Subject RE: [Kernel22] How to develop a component?
Date Thu, 08 Apr 2004 14:10:12 GMT


> From: news [mailto:news@sea.gmane.org] On Behalf Of Leo Simons
> 
> Stefano Mazzocchi wrote:
> > If you have two blocks in the avalon sandbox, you could share them
> > between them, but there is no (easy? elegant?) way you can 
> pass them 
> > arond *OUTSIDE* the sandbox and still allow blocks to be 
> hotswappable 
> > and runtime polymorphic.
> > 
> > [I would gladly be proven wrong here!]
> 
> write a failing testcase that doens't require me to understand every 
> little detail of cocoon internals and I could try.

Easy.

interface StatefulComponent {
    public void login (); // never throws any exception, ever.
    public void doOperation (); // never throws any exception, ever.
    public void logout (); // never throws any exception, ever.
}

Client.java:

    StatefulComponent comp = (StatefulComponent) 
        manager.lookup(StatefulComponent.ROLE);
    try {
        comp.login ();
        // (1)
        comp.doOperation ();
        comp.logout ();
    } finally {
        manager.release (comp);
    }

If a block reload of the implementation of StatefulComponent
occurs at (1), the comp proxy will be invalidated while in use,
and the operation will fail.

This is contrary to Avalon semantics, where a component reference,
once obtained, remains valid until it is released.

Of course there are ways to code around this (or ignore it) in 
the vast majority of cases.

/LS


Mime
View raw message