You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hivemind.apache.org by Jean-Francois Poilpret <jf...@hcm.vnn.vn> on 2004/10/18 17:11:03 UTC
event producing services and threaded or pooled model
Hi all,
I have currently a recurring question in mind about the following problem:
I have created a service A interface that accepts event listeners (with the
usual addFooListener()/removeFooListener() methods).
In the implementation class I have defined a EventListenerList member (not
static) to hold the list of listeners to the events produced by the service.
Now what will happen if I use the threaded or pooled service model for my
service?
For instance, if I create a second service B which implementation consumes
the events provided by service A, construct B with BuilderFactory with the
singleton model, how will it be linked to service A (or more exactly all the
instances of A since it is threaded/pooled)?
Can we say that HiveMind will call A.addFooListener(B) for _every_ threaded
instance of A?
I did not check it yet, but since I am currently working in quite a big task
and I started wondering about this point (which answer will probably have an
impact on what I am doing), I would need some clarification about this
point.
I tried to find the answer to my question in the doc to no avail.
Thank you in advance for any answer
Cheers
---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-user-help@jakarta.apache.org
RE: event producing services and threaded or pooled model
Posted by Jean-Francois Poilpret <jf...@hcm.vnn.vn>.
Hi Howard,
So it seems my question was not as stupid as I suspected when I wrote it ;-)
OK, I will try to find something else for my events, I don't know what yet;
actually, the events notification that I have planned for my service is not
used yet (contrary to the famous YAGNI rule) but I suspected I would need it
in just a few days. I hope I can figure out some solution to circumvent this
problem.
Thank you very much indeed for avoiding me a probable long night of
debugging :-)
Cheers
-----Original Message-----
From: Howard Lewis Ship [mailto:hlship@gmail.com]
Sent: Monday, October 18, 2004 11:32 PM
To: hivemind-user@jakarta.apache.org
Subject: Re: event producing services and threaded or pooled model
This is something I've thought about as well, and don't have an easy
solution for.
I think, perhaps, a proxy should be set up and that should be the
listener. The proxy will delegate to the actual, per-thread, service.
The problem is ... there's a tangle between ServiceModel and
ServiceImplementationFactory (specifically, the BuilderFactory
implementation) on who'se responsible for this.
I believe I'll have to add methods to ServiceModel to control this,
and have BuilderFactory merely identify which services/listeners
should be connected. ServiceModel can decide how to procede. So it's
doable, but will take a bit of work.
With the current code, I'd simply say ... don't do it!
On Mon, 18 Oct 2004 22:11:03 +0700, Jean-Francois Poilpret
<jf...@hcm.vnn.vn> wrote:
> Hi all,
>
> I have currently a recurring question in mind about the following problem:
>
> I have created a service A interface that accepts event listeners (with
the
> usual addFooListener()/removeFooListener() methods).
> In the implementation class I have defined a EventListenerList member (not
> static) to hold the list of listeners to the events produced by the
service.
>
> Now what will happen if I use the threaded or pooled service model for my
> service?
> For instance, if I create a second service B which implementation consumes
> the events provided by service A, construct B with BuilderFactory with the
> singleton model, how will it be linked to service A (or more exactly all
the
> instances of A since it is threaded/pooled)?
>
> Can we say that HiveMind will call A.addFooListener(B) for _every_
threaded
> instance of A?
> I did not check it yet, but since I am currently working in quite a big
task
> and I started wondering about this point (which answer will probably have
an
> impact on what I am doing), I would need some clarification about this
> point.
> I tried to find the answer to my question in the doc to no avail.
>
> Thank you in advance for any answer
>
> Cheers
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: hivemind-user-help@jakarta.apache.org
>
>
--
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Jakarta Tapestry
Creator, Jakarta HiveMind
http://howardlewisship.com
---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-user-help@jakarta.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-user-help@jakarta.apache.org
Re: event producing services and threaded or pooled model
Posted by Howard Lewis Ship <hl...@gmail.com>.
This is something I've thought about as well, and don't have an easy
solution for.
I think, perhaps, a proxy should be set up and that should be the
listener. The proxy will delegate to the actual, per-thread, service.
The problem is ... there's a tangle between ServiceModel and
ServiceImplementationFactory (specifically, the BuilderFactory
implementation) on who'se responsible for this.
I believe I'll have to add methods to ServiceModel to control this,
and have BuilderFactory merely identify which services/listeners
should be connected. ServiceModel can decide how to procede. So it's
doable, but will take a bit of work.
With the current code, I'd simply say ... don't do it!
On Mon, 18 Oct 2004 22:11:03 +0700, Jean-Francois Poilpret
<jf...@hcm.vnn.vn> wrote:
> Hi all,
>
> I have currently a recurring question in mind about the following problem:
>
> I have created a service A interface that accepts event listeners (with the
> usual addFooListener()/removeFooListener() methods).
> In the implementation class I have defined a EventListenerList member (not
> static) to hold the list of listeners to the events produced by the service.
>
> Now what will happen if I use the threaded or pooled service model for my
> service?
> For instance, if I create a second service B which implementation consumes
> the events provided by service A, construct B with BuilderFactory with the
> singleton model, how will it be linked to service A (or more exactly all the
> instances of A since it is threaded/pooled)?
>
> Can we say that HiveMind will call A.addFooListener(B) for _every_ threaded
> instance of A?
> I did not check it yet, but since I am currently working in quite a big task
> and I started wondering about this point (which answer will probably have an
> impact on what I am doing), I would need some clarification about this
> point.
> I tried to find the answer to my question in the doc to no avail.
>
> Thank you in advance for any answer
>
> Cheers
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: hivemind-user-help@jakarta.apache.org
>
>
--
Howard M. Lewis Ship
Independent J2EE / Open-Source Java Consultant
Creator, Jakarta Tapestry
Creator, Jakarta HiveMind
http://howardlewisship.com
---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-user-help@jakarta.apache.org