Hello,
My coworkers and I are just starteing to get heavily
involved in using Avalon. We understand the existing
packages pretty well, but there are still some conceptual
issues we are struggling with.
One idea we are having trouble with is Inversion of
Control. We understand it abstractly, but when it comes
down to specific situations we sometimes are having
trouble deciding whether or not something breaks IOC.
For example, suppose that the ThreadPool implementation
in Excalibur scratchpad extended SoftResourceLimitingPool
(it doesn't, but for the sake of argument suppose it did).
Then when it created new WorkerThreads it would pass
itself as a reference so that threads could put themselves
back in the pool when they finished tasks.
Does this break IOC, because a container (the pool) is
passing a reference to itself to the things it is
managing?
For that matter, the ThreadPool implementation in the
scratchpad creates a SoftResourceLimitingPool and passes
a reference to itself as the ObjectFactory to use:
public DefaultThreadPool( final String name,
final int capacity,
final ThreadContext context )
throws Exception
{
super( name );
m_pool = new SoftResourceLimitingPool( this, capacity );
m_context = context;
}
Doesn't this also break IOC (child component now has reference
to parent)?
If these examples don't break IOC, please explain why. If they
do, please explain when it is okay to break IOC and when it
isn't.
Thanks for any light you can shed on this.
Ryan
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>