Do smack clients have to be thread safe?

Hi,

how many threads does Smack use? Can i be sure that no more than one packet listener can be executing at any time? Will the smack thread sleep while a packet listener or other callback is executing? Or will I have to take care to make my internal data structures (on which the callbacks operate) thread safe / synchronized?

Thanks in advance,

Tobias

Hey Tobias,

Smack is a thread safe application. Packet listeners are going to be invoked sequentually. However, what a packet listeners does is out of Smack’‘s control. That means that what you develop on top of Smack is your own responsibility. However, you can trust Smack that it won’'t have thread safety issues (unless we have a bug somewhere).

Regards,

– Gato

Thanks, that was very helpful!

Tobias

Does “invoked sequentially” mean that they get started sequentially, or is it guaranteed that no two will run at the same time?

In other words, does Smack start a new thread when it invokes a packet listener?

I think Gato is meaning strictly sequential, i.e. start another one after[/b] the current is finished[/b].