Alex Treyger wrote:
Hi Berin and Peter,
My name is Alex; I am working on a project that is
similar to the event, but my commands can't be
processed quicker than in 10-20 sec. Therefore, I need
to have more then one thread working from the same
queue. Also, I can't use dequeueAll(), since this
would serialize command processing.
You do have more than one thread working from the same
queue. The ThreadManager has a pool of threads to work
with. You can set it up to have a certain ratio of threads
to processors. That way if you have eight threads per
processor set, and you have two processors, the commands
will be executed within sixteen threads.
The default is one thread per processor--which on a one
processor machine is only one thread.
To achieve my goals, I moved ImmediateRunner from
AbstractThreadManager to outside, and introduced a few
interfaces. My new classes, that are versions of
yours, I put in sub-package medium.
What are you wanting to accomplish with the interfaces?
It make more sense to me to pass Runner (with pipeline
inside) instead of Pipeline to ThreadManager, since
the latter one does not care about pipelines; it needs
to execute something, that' all. For compatibility, I
did not remove
register( EventPipeline pipeline )
method.
No. The reason is quite simple. The EventPipeline does
not have to be a CommandManager. It can be anything. It
stems from the SEDA package, and is focussed on event
pipelining.
Please post any questions, etc. to either the user list
or the developer list so I don't have to answer the same
questions over and over.
All these new classes, modified classes, as well as
the rest of classes from the package, are in a tar.gz
Please, let me know what you think.
Thanks,
Alex Treyger
PS.
1. In case you like the change, feel free to improve
or rename classes.
2. I do not know policy, so I added my name in all
classes I modified.
3. I added
throw new RuntimeException(e)
in a catch after
( (Command)element ).execute();
in CommandManager.
Why? where do you expect that RuntimeException to be caught?
Are you sure that it doesn't kill the thread that is monitoring
the queues?
4. Should CommandManager be renamed to a
CommandProcessor?
I was following an XXXmanager idiom. It could be, but I really
don't see the advantage.
--
"They that give up essential liberty to obtain a little temporary safety
deserve neither liberty nor safety."
- Benjamin Franklin
--
To unsubscribe, e-mail: <mailto:avalon-dev-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-dev-help@;jakarta.apache.org>