hdbeukel / james-core

Core module of the JAMES framework
Apache License 2.0
6 stars 5 forks source link

Avoid synchronization on search status (if possible) #13

Open hdbeukel opened 9 years ago

hdbeukel commented 9 years ago

Several search characteristic accessors (runtime, step count, ...) are synchronized on status updates because the result depends on the search status, which may be changed from another thread. As these getters may be frequently called from stop criteria, the involved synchronization may yield significant overhead. Perhaps synchronization can be avoided, e.g. by using a volatile or atomic reference for the search status? Not sure ...

Or perhaps the guarantees for the result of methods getRuntime(), getSteps(), etc. can be relaxed instead. Is it sufficient if the result is based on the search status when entering the getter?