com.fathzer.imt.implementation.ThreadSafeEvaluator Maven / Gradle / Ivy
package com.fathzer.imt.implementation;
import com.fathzer.imt.Bitmap;
import com.fathzer.imt.Evaluator;
import com.fathzer.imt.TagsTable;
/** A thread safe evaluator based on {@link ThreadLocal}.
* @param The type of the tag class
*/
public abstract class ThreadSafeEvaluator implements Evaluator {
private ThreadLocal> evaluator = new ThreadLocal>() {
@Override
protected Evaluator initialValue() {
return buildUnsafeEvaluator();
}
};
protected abstract Evaluator buildUnsafeEvaluator();
@Override
public Bitmap evaluate(TagsTable table, String expression, boolean failIfUnknown) {
return evaluator.get().evaluate(table, expression, (Boolean)failIfUnknown);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy