avalon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nicola Ken Barozzi" <nicola...@apache.org>
Subject Re: [Avalon5] Startable interface
Date Fri, 07 Jun 2002 20:52:13 GMT
From: "Berin Loritsch" <bloritsch@apache.org>

> > From: Nicola Ken Barozzi [mailto:nicolaken@apache.org]
> >
> > From: "Berin Loritsch" <bloritsch@apache.org>
> >
> > > It seems that Peter already beat me putting a proposal Avalon 5
> > > directory out there.  Quick question regarding the Startable
> > > interface:
> > >
> > > public interface Startable
> > > {
> > >     void start() throws Exception;
> > >     void stop() throws Exception;
> > > }
> > >
> > > Is there any particular reason that start() and stop() require
> > > exception throwing?  Wouldn't RuntimeExceptions (reported in the
> > > javadocs so they are documented) be better?
> >
> > Why?
> > I hate RuntimeExceptions, and they have been a source of
> > really uncomprehensible error reporting in Cocoon. Could you
> > please explain?
>
> It's either that or not allow exceptions on either.
>
> Now, on initialization, I can understand exception throwing because
> we have to not let the component be available to other components.
> If the component is not stable because it couldn't allocate thread
> resources that it needs, that is an Exception.
>
> However, on the stop() method, it really isn't helpful.  We are getting
> rid of the component at this stage--so why should we care if it can't
> get rid of the thread it wanted.  We can force everything to shut down
> hard if necessary.

Threads?
What does start-stop have to do with threads?
Startable has no notion of concurrency.

You also assume that stop() has no side-effects, which is wishfull thinking.

> > > Also, I thought that we were in favor of separating
> > Intializable and
> > > Disposable.  They aren't as tightly coupled as start()/stop() or
> > > suspend()/resume().  Otherwise, there will be a lot of
> > components with
> > > either an empty initialize() or an empty dispose() method.
> >
> > +-0
> >
> > The same thing happened with my classes for startable, since
> > 80% of the time I just start components.
>
>
> ? :/
>
> Let me ask you something.  If your component starts a thread that
> has to run for the duration of the component's life, then how do
> you release that reasource?  If your answer is the dispose() method,
> then it is a misuse.
>
> Now, if you start up a thread that only needs to run to completion,
> that is another thing entirely.  The concept behind the Startable
> interface is an active component that has a thread running in the
> background at all times, until it is stop()ed.

I just use the common meaning.

Configure: On your marks

Init: get ready.
Start: GO!

Suspend: Freeze!
Resume: Continue!
Suspend: Freeze!
Resume: Continue!

Stop: Stop!
Dispose: Get Off!

Now, what does this have to do with threads?

--
Nicola Ken Barozzi                   nicolaken@apache.org
            - verba volant, scripta manent -
   (discussions get forgotten, just code remains)
---------------------------------------------------------------------


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


Mime
View raw message