Hello,
I’'m developing a communication solution that uses XMPP, so that I have the following situation:
each object in my application can communicate to many other objects, using XMPP, through Chat instances. By the way, the application is monothreaded. Hence, it is not possíble to send two or more messages in a concurrent way. Considering that each Chat to some recipient uses the same connection, my question is:
- Should I have a collection of Chat objects, retrieving the right one in order to talk to the right recipient? or it would be better to have a single Chat instance that can be created again (if necessary) to talk to another recipient?
the first solution requires a greater use of memory, and is more difficult to manage the destruction of Chat instances. In the second solution, I have to take care about setting the “FilteredOnThreadID” to false. If I choose the second solution, is there a great overhead on creating again the Chat instances each time I need to talk to a different recipient?
thanks in advance,
Aliandro