Hi Vadim

Yes you are correct. It is more likely to be a problem for scheduled consumer, 
configured to fire immediately.

So if you have a consumer then you should call super.doStart() at the end. 
Otherwise its executor (ScheduledExecutorService) could be triggered before you 
are complete with your start and run the poll() method. And in you case the 
chat isn't initialized and joined the room.

Maybe we should rework the internals of Camel so it will delegate its creation 
of the ScheduledExecutorService to happen after the doStart() operation 
completes in a special callback method. Then component writers don't have to 
worry so much if super should be in top/bottom?


Med venlig hilsen
 
Claus Ibsen
......................................
Silverbullet
Skovsgårdsvænget 21
8362 Hørning
Tlf. +45 2962 7576
Web: www.silverbullet.dk
-----Original Message-----
From: Vadim Chekan [mailto:[EMAIL PROTECTED] 
Sent: 30. juli 2008 08:30
To: [email protected]
Subject: Start order

In Producer or Consumer in start/stop mode, what should be the "super" 
call order?

     @Override
     protected void doStart() {
         super.doStart();
         if (chat == null) {
             chat = new MultiUserChat(endpoint.getConnection(), room);
             chat.join(this.endpoint.getNickname());
         }
     }

Wouldn't the endpoint signaling that it is ready when in fact it is not 
(joining chat may take some seconds)?

Vadim.

Reply via email to