Guillaume Nodet wrote:
> Looks good.  We may want to add a synchronize keyword the two
> schedule() methods, empty the start one, and make sure to check if the
> timer has been created in the stop method (and set it back to null
> btw).  And I think the stop method should be synchronized too ...
But actually each EIPEndpoint has its own timer so there should not be a
race condition. But I agree the TimerManager could be used for other
stuff as well.
> Feel free to go ahead and commit this modified class.
> 
> On Mon, Sep 8, 2008 at 4:54 PM, Thomas Termin
> <[EMAIL PROTECTED]> wrote:
> 
>>Thanks! So cool that I'm not absolutly wrong here. :-D
>>
>>I did the following:
>>
>>public Timer schedule(TimerListener listener, long delay) {
>>       if (LOG.isDebugEnabled()) {
>>           LOG.debug("Schedule timer " + listener + " for " + delay);
>>       }
>>       TimerImpl tt = new TimerImpl(listener);
>>       if (timer == null) {
>>           timer = new java.util.Timer();
>>       }
>>       timer.schedule(tt, delay);
>>       return tt;
>>   }
>>
>>public Timer schedule(TimerListener listener, Date date) {
>>       if (LOG.isDebugEnabled()) {
>>           LOG.debug("Schedule timer " + listener + " at " + date);
>>       }
>>       TimerImpl tt = new TimerImpl(listener);
>>       if (timer == null) {
>>           timer = new java.util.Timer();
>>       }
>>       timer.schedule(tt, date);
>>       return tt;
>>   }
>>
>>That starts the timer if the schedule method id used. The advantage for
>>me was just to change the TimerManagerImpl class.
>>
>>But I think we can also use your way.
>>
>>Cheers,
>>Thomas
>>
>>Guillaume Nodet wrote:
>>
>>>Absolutely.
>>>Actually, I think it should be safe to create / start the timer in the
>>>getTimerManager() method.  We may need to add a boolean property to
>>>know if the timer manager has been started or not.  This would lead to
>>>only changing the EIPEndpoint class.
>>>
>>>On Mon, Sep 8, 2008 at 3:12 PM, Thomas Termin
>>><[EMAIL PROTECTED]> wrote:
>>>
>>>
>>>>Hi,
>>>>
>>>>another question. Each EIPEndpoint has an TimerManager associated and it
>>>>is also startet and a thread is created even if it is not used. The only
>>>>class which I can see using the runing timer thread is the
>>>>AbstractAggregator. Would it be not better to create just a
>>>>TimerManagerImpl instance in each EIPComponent but start it the first
>>>>time it is really used? The AbstractAggregator could check if it runs
>>>>and when not could start it. We could save a lot of created threads (at
>>>>least in our cases), couldn't we?
>>>>It might be that I'm wrong so please correct me. What do you think?
>>>>
>>>>Cheers
>>>>Thomas
>>>>--
>>>>Thomas Termin
>>>>_______________________________
>>>>blue elephant systems GmbH
>>>>Wollgrasweg 49
>>>>D-70599 Stuttgart
>>>>
>>>>Tel    :  (+49) 0711 - 45 10 17 676
>>>>Fax    :  (+49) 0711 - 45 10 17 573
>>>>WWW    :  http://www.blue-elephant-systems.com
>>>>Email  :  [EMAIL PROTECTED]
>>>>
>>>>blue elephant systems GmbH
>>>>Firmensitz      : Wollgrasweg 49, D-70599 Stuttgart
>>>>Registergericht : Amtsgericht Stuttgart, HRB 24106
>>>>Geschäftsführer : Holger Dietrich, Thomas Gentsch, Joachim Hoernle
>>>>
>>>>
>>>
>>>
>>>
>>>
>>
>>--
>>Thomas Termin
>>_______________________________
>>blue elephant systems GmbH
>>Wollgrasweg 49
>>D-70599 Stuttgart
>>
>>Tel    :  (+49) 0711 - 45 10 17 676
>>Fax    :  (+49) 0711 - 45 10 17 573
>>WWW    :  http://www.blue-elephant-systems.com
>>Email  :  [EMAIL PROTECTED]
>>
>>blue elephant systems GmbH
>>Firmensitz      : Wollgrasweg 49, D-70599 Stuttgart
>>Registergericht : Amtsgericht Stuttgart, HRB 24106
>>Geschäftsführer : Holger Dietrich, Thomas Gentsch, Joachim Hoernle
>>
>>
> 
> 
> 
> 


-- 
Thomas Termin
_______________________________
blue elephant systems GmbH
Wollgrasweg 49
D-70599 Stuttgart

Tel    :  (+49) 0711 - 45 10 17 676
Fax    :  (+49) 0711 - 45 10 17 573
WWW    :  http://www.blue-elephant-systems.com
Email  :  [EMAIL PROTECTED]

blue elephant systems GmbH
Firmensitz      : Wollgrasweg 49, D-70599 Stuttgart
Registergericht : Amtsgericht Stuttgart, HRB 24106
Geschäftsführer : Holger Dietrich, Thomas Gentsch, Joachim Hoernle

Reply via email to