*
* @see org.apache.jmeter.engine.event.LoopIterationListener#iterationStart(org.apache.jmeter.engine.event.LoopIterationEvent)
*/
public void iterationStart(LoopIterationEvent iterEvent) {
FileServer server = FileServer.getFileServer();
final JMeterContext context = getThreadContext();
if (vars == null) {
String _fileName = getFilename();
String mode = getShareMode();
int modeInt = CSVDataSetBeanInfo.getShareModeAsInt(mode);
switch(modeInt){
case CSVDataSetBeanInfo.SHARE_ALL:
alias = _fileName;
break;
case CSVDataSetBeanInfo.SHARE_GROUP:
alias = _fileName+"@"+System.identityHashCode(context.getThreadGroup());
break;
case CSVDataSetBeanInfo.SHARE_THREAD:
alias = _fileName+"@"+System.identityHashCode(context.getThread());
break;
default:
alias = _fileName+"@"+mode; // user-specified key
break;
}
server.reserveFile(_fileName, getFileEncoding(), alias);
vars = JOrphanUtils.split(getVariableNames(), ","); // $NON-NLS-1$
}
try {
String delim = getDelimiter();
if (delim.equals("\\t")) { // $NON-NLS-1$
delim = "\t";// Make it easier to enter a Tab // $NON-NLS-1$
}
// TODO: fetch this once as per vars above?
JMeterVariables threadVars = context.getVariables();
String line = server.readLine(alias,getRecycle());
if (line!=null) {// i.e. not EOF
String[] lineValues = getQuotedData() ?
CSVSaveService.csvReadFile(new BufferedReader(new StringReader(line)), delim.charAt(0))
: JOrphanUtils.split(line, delim, false);