Parts of ImmutableSearchFactory are mutable

Description

For instance, these elements are mutated when a new search factory is built, and this mutation affects the old search factory too:

  • The index manager holder (org.hibernate.search.engine.impl.ImmutableSearchFactory.getIndexManagerHolder())

  • The class hierarchy used to lookup indexed subclasses (org.hibernate.search.engine.impl.ImmutableSearchFactory.indexHierarchy)

  • maybe others, too?

Those mutations could in theory result in inconsistent behavior during the building of a new (incremental) search factory, even if it is unlikely to happen in practice. For instance the index hierarchy could report one class as not indexed, while the index manager holder would contain an index manager for this class.

A simple solution would be to make the sub-components immutable, and to build new versions of these components when we build new SearchFactories. This would require to make sure nobody keeps a direct reference to the components, though.

Environment

None

Activity

Show:
Yoann Rodière
March 29, 2019, 10:13 AM

No longer relevant in Search 6, as we rewrote that part almost completely.

Assignee

Unassigned

Reporter

Yoann Rodière

Labels

None

Suitable for new contributors

None

Pull Request

None

Feedback Requested

None

Components

Affects versions

Priority

Minor
Configure