feliperazeek/playframework-elasticsearch — pull request #67 by isamaru (2012-08-31 16:17:11+00:00)
Title: Reindexing all models in the database

Bunch of tightly related changes within a single commit:

1) DeliveryMode is now determined at startup and then reused. This should improve performance somehow. (it has been read from configuration on every single event)

2) We can reconfigure handlers at runtime using setDeliveryMode setter. I have also added a method index(model, deliveryMode) to index a single entity using provided delivery method.

3) As a convenience, I have added 2 new delivery methods: (blocking) SYNCHRONOUS, which circumvents jobs and indexes from the same thread, and DISCARD, which ignores all events from persistence.
2 & 3 have made my previous modifications for issue #55 obsolete. I have reverted them as this is how I should have done it in the first place.

4) ElasticSearch.reindex method starts a job which reindexes the whole database using any deliveryMode you choose (default is SYNCHRONOUS, so the job does not spawn any children).

5) Collections used by Plugin are now thread safe. The module itself is not thread-safe as there are just WAY too many unsafe assignments and it would be too much work fixing them all, and it would probably also degrade performance.