Hi all,

I have had some race problems in
method StatefulMatchFunction.ensureInitialized.

The quick solution would be to introduce a double checked locking:

private void ensureInitialized() {
    if (!setup) {
      synchronized (this) {
        if (!setup) {
          configure(matcher);
          setup = true;
        }
      }
    }
  }

But this solution would force us to make the setup variable to volatile,
which would/can decrease the read performance in this performance critical
code..

Any thoughts on how to solve this in a clever way would be appreciated.

Regards
Dan

Reply via email to