1 18 19 package org.apache.jmeter.functions; 20 21 import java.io.Serializable ; 22 import java.util.Collection ; 23 import java.util.LinkedList ; 24 import java.util.List ; 25 26 import org.apache.jmeter.samplers.SampleResult; 27 import org.apache.jmeter.samplers.Sampler; 28 29 32 public class ThreadNumber implements Function, Serializable 33 { 34 35 private static final String KEY = "__threadNum"; 36 private static final List desc = new LinkedList (); 37 38 41 public String execute(SampleResult previousResult, Sampler currentSampler) 42 throws InvalidVariableException 43 { 44 return Thread.currentThread().getName().substring( 45 Thread.currentThread().getName().lastIndexOf("-") + 1); 46 } 47 48 51 public void setParameters(Collection parameters) 52 throws InvalidVariableException 53 { 54 } 55 56 59 public String getReferenceKey() 60 { 61 return KEY; 62 } 63 64 67 public List getArgumentDesc() 68 { 69 return desc; 70 } 71 } 72 | Popular Tags |