Is this pattern scalable when being used in custom event notification scenario?
What will happen if the Observable's Vector or collection object containing the references of observers increase to the tune of say 1000 or so?
BTW: That's a lot of observers! What kind of application are you talking about?
[ June 13, 2003: Message edited by: Stan James ]
Originally posted by Stan James:
"Not much time" times 1000 starts to be "quite a bit of time" so this could take a while. Observers must be careful to return quickly. If some of them are going to take a while, they might spin off the work onto new threads so they can return quickly. If all of them start new threads, managing 1000 threads is another big problem!
Of course this is a more general problem and not specific to observer/observable. When there is much to do in the case of an event, there is much to do whatever pattern you use to react to it.
If the observer typically return quickly, I wouldn't expect it to be a problem, on the other hand.
But I would also be interested in what you are trying to accomplish. It would probably also help us to think about alternatives...
Thanks for the interest. My application flows as following:
1. Send an SMS to mobile device beginning a dialog session for some activity on the device
(God alone knows when it reaches device due to awful and not-so-speedy SMS behvaior)
2. Device contacts the server in its own sweet time through HTTP Post once SMS is received
3. The session has to be tracked till then and the device message is escalated to application logic which will determine what messages are to be sent to the device
4. This message is returned to mobile as HTTP Reply to HTTP Post of step 2
Stateful session beans are quiet too much I believe particularly for a live Telecom Application like the one above ....
So I am trying to implement a sort of registered callback through the Observer/Observable type of behavior (Not exactly Observable / Observer)