On 30 Jun 2003 at 22:29, Sylvain Wallez wrote:

...

> >> I suggested that components being heavyweight resource, allowing
> >> them to cross continuation boundaries should be prohibited.
> >> Automatic release doesn't seem a good solution to me, as it would
> >> mean that script variables would hold released components, thus
> >> leading to unpredictable behaviour (think about stateful pooled
> >> components). So my opinion is to raise an error if there are some
> >> unreleased components when a continuation is created. This will
> >> allow users to quickly learn the safe practices related to
> >> component management in flow scripts.

I tend to agree. 

...

> Once again, I agree that explicit release is very unnatural. But
> automagic release is good only if we can have some automagic restore.
> For this we can have getComponent() actually return a proxy to the
> real component, and have the proxy do a release/lookup when a
> continuation is suspended/reactivated. But as elegant this may seem,
> this won't work : stateful components have... a state, and a
> release/lookup cycle destroys this state.
> 
> So I don't see any other solution...

How about defining a FlowSafe interface (contains no state and can be 
released/looked up transparently), and maybe a FlowSerializable interface (has a way 
that the state can be stored into the continuation and then restored, all 
transparently?

So you would have to consciously code your components to use either of these 
interfaces, otherwise you'll have to manually release them before creating a 
continuation.

Upayavira

Reply via email to