Hi,

It seems the purpose of the StratosManagerTopologyEventReceiver is to
provide methods to add event listeners. We can have this functionality in a
non-runnable class too. However from the TopologyEventReceiver onwards I
think it's essential to keep the threading model because of the nature of
processing chain.

The TopicSubscriber will be listening to the events and invoking the
TopologyEventMessageListener which puts the event in to a queue. The
TopologyEventMessageDelegator starts the processing chain on each of the
message from the queue. If this is to be chained, a broader approach will
have to be taken on the messaging component too, IMHO.



Regards,
Chamila de Alwis
Software Engineer | WSO2 | +94772207163
Blog: code.chamiladealwis.com



On Fri, Nov 14, 2014 at 12:20 PM, Udara Liyanage <ud...@wso2.com> wrote:

> Hi Isuru,
>
> +1 pooling for threads is an unnecessary overhead.
>
> On Fri, Nov 14, 2014 at 12:03 PM, Isuru Haththotuwa <isu...@apache.org>
> wrote:
>
>> Hi Devs,
>>
>> This thread is to discuss $subject.
>>
>> Let me explain the current flow, taking Topology event listener in
>> Stratos Manager as an example.
>>
>>    1. SM Topology event receiver is started in a separate thread
>>    2. In the SM Topology event receiver thread, we start another thread
>>    with an instance of messaging's TopologyEventReceiver class.
>>    3. Again in the TopologyEventReceiver thread, we create couple of
>>    more threads for the Topology event message delegator and topic 
>> subscriber.
>>
>> IMHO there is no need to create all these threads. AFAIU, what we need
>> are three threads which will:
>>
>>    1. Listen to the events
>>    2. Handles delegation
>>    3. Updates the local topology models
>>
>> Also, we can use java ExecutorServices handle graceful
>> starting/termination of threads. Currently, we are doing sleeping/looping
>> mechanism to keep the threads alive, which can be replaced with
>> ExecutorService.
>>
>> WDYT?
>> --
>> Thanks and Regards,
>>
>> Isuru H.
>> +94 716 358 048* <http://wso2.com/>*
>>
>>
>>
>
>
> --
>
> Udara Liyanage
> Software Engineer
> WSO2, Inc.: http://wso2.com
> lean. enterprise. middleware
>
> web: http://udaraliyanage.wordpress.com
> phone: +94 71 443 6897
>

Reply via email to