lantunes / fixd

An HTTP Server Fixture for Testing HTTP Clients and mocking web services, and a Java Micro Web Framework
http://bigtesting.org/fixd
Apache License 2.0
41 stars 6 forks source link

Create a Broadcaster #28

Open lantunes opened 10 years ago

lantunes commented 10 years ago

The current broadcast-subscribe process with Simple can be improved. Instead of starting a new thread for each subscriber, and having that subscriber thread block on a queue of broadcasts, we can have a single broadcaster thread that starts at startup. Subscribers, with a reference to the Response, register with the broadcaster. This way, the Container can simply create a subscriber and give it to the broadcaster and return immediately.

lantunes commented 10 years ago

There is an issue here, related to the fact that subscribe-broadcast setups can include every() and after().