1 18 19 package org.apache.jmeter.threads; 20 21 import org.apache.jmeter.samplers.SampleResult; 22 import org.apache.jmeter.samplers.Sampler; 23 24 27 public class JMeterContext 28 { 29 JMeterVariables variables; 30 SampleResult previousResult; 31 Sampler currentSampler; 32 Sampler previousSampler; 33 boolean samplingStarted; 34 private int threadNum; 35 private byte[] readBuffer = null; 36 37 JMeterContext() 38 { 39 variables = null; 40 previousResult = null; 41 currentSampler = null; 42 samplingStarted = false; 43 } 44 45 public void clear() 46 { 47 variables = null; 48 previousResult = null; 49 currentSampler = null; 50 previousSampler = null; 51 samplingStarted = false; 52 threadNum = 0; 53 readBuffer = null; 54 } 55 56 public JMeterVariables getVariables() 57 { 58 return variables; 59 } 60 61 public byte[] getReadBuffer() 62 { 63 if(readBuffer == null) 64 { 65 readBuffer = new byte[8192]; 66 } 67 return readBuffer; 68 } 69 70 public void setVariables(JMeterVariables vars) 71 { 72 this.variables = vars; 73 } 74 75 public SampleResult getPreviousResult() 76 { 77 return previousResult; 78 } 79 80 public void setPreviousResult(SampleResult result) 81 { 82 this.previousResult = result; 83 } 84 85 public Sampler getCurrentSampler() 86 { 87 return currentSampler; 88 } 89 90 public void setCurrentSampler(Sampler sampler) 91 { 92 setPreviousSampler(currentSampler); 93 this.currentSampler = sampler; 94 } 95 96 100 public Sampler getPreviousSampler() 101 { 102 return previousSampler; 103 } 104 105 109 public void setPreviousSampler(Sampler previousSampler) 110 { 111 this.previousSampler = previousSampler; 112 } 113 114 118 public int getThreadNum() 119 { 120 return threadNum; 121 } 122 123 127 public void setThreadNum(int threadNum) 128 { 129 this.threadNum = threadNum; 130 } 131 132 public boolean isSamplingStarted() 133 { 134 return samplingStarted; 135 } 136 137 public void setSamplingStarted(boolean b) 138 { 139 samplingStarted = b; 140 } 141 } 142 | Popular Tags |