Bug 123840 Incorrect use of static fields in NEvaluator and FilterPassController
Data Engine classes org.eclipse.birt.data.engine.script.NEvaluator and FilterPassController (used for top-n and bottom-n filter process) use static class fields to store proessing data. This is not multi-thread safe. If there are concurrent requests running in the same JVM (even if they use different instances of DataEngine), data corruption will occur since multiple requests may get/set the static fields at the same time. These classes should keep all per-request data in instance fields. Each report query need to have its own instance.
data/org.eclipse.birt.data/src/org/eclipse/birt/data/engine/script/NEvaluator.java
package org.eclipse.birt.data.engine.script;
import org.eclipse.birt.core.data.DataTypeUtil;
import org.eclipse.birt.core.exception.BirtException;
import org.eclipse.birt.data.engine.api.IConditionalExpression;
import org.eclipse.birt.data.engine.core.DataException;
import org.eclipse.birt.data.engine.i18n.ResourceConstants;
/**
 * The implementation of this class is used to evaluate TopN/BottomN expressions 
 * @author lzhu
 *
 */
abstract class NEvaluator extends FilterPassController
{
	public static final String BOTTOM_INSTANCE = "BOTTOM";
	public static final String TOP_INSTANCE = "TOP";
	private static String currentInstance = null;
	private static Object[] valueList; 
	private static int[] rowIdList;
	private static int firstPassRowNumberCounter = 0;
	private static int secondPassRowNumberCounter = 0;
	private static int qualifiedRowCounter = 0;
	
	private static int N = -1;
	private static NEvaluator instance = null;
	
	/**
	 * Return the instance of NEvaluagor according to the given instanceName.
	 * @param instanceName
	 * @return