MCPcopy Create free account
hub / github.com/cmu-db/benchbase / run

Method run

src/main/java/com/oltpbenchmark/api/Worker.java:186–361  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

184 }
185
186 @Override
187 public final void run() {
188 Thread t = Thread.currentThread();
189 t.setName(this.toString());
190
191 // In case of reuse reset the measurements
192 latencies = new LatencyRecord(workloadState.getTestStartNs());
193
194 // Invoke setup session
195 try {
196 this.setupSession();
197 } catch (Throwable ex) {
198 throw new RuntimeException("Unexpected error when setting up the session " + this, ex);
199 }
200
201 // Invoke initialize callback
202 try {
203 this.initialize();
204 } catch (Throwable ex) {
205 throw new RuntimeException("Unexpected error when initializing " + this, ex);
206 }
207
208 // wait for start
209 workloadState.blockForStart();
210
211 while (true) {
212
213 // PART 1: Init and check if done
214
215 State preState = workloadState.getGlobalState();
216
217 // Do nothing
218 if (preState == State.DONE) {
219 if (!seenDone) {
220 // This is the first time we have observed that the
221 // test is done notify the global test state, then
222 // continue applying load
223 seenDone = true;
224 workloadState.signalDone();
225 break;
226 }
227 }
228
229 // PART 2: Wait for work
230
231 // Sleep if there's nothing to do.
232 workloadState.stayAwake();
233
234 Phase prePhase = workloadState.getCurrentPhase();
235 if (prePhase == null) {
236 continue;
237 }
238
239 // Grab some work and update the state, in case it changed while we
240 // waited.
241
242 SubmittedProcedure pieceOfWork = workloadState.fetchWork();
243

Callers

nothing calls this directly

Calls 15

toStringMethod · 0.95
setupSessionMethod · 0.95
initializeMethod · 0.95
getTransactionTypeMethod · 0.95
equalsMethod · 0.95
getNameMethod · 0.95
doWorkMethod · 0.95
getIdMethod · 0.95
getIdMethod · 0.95
isLatencyRunMethod · 0.95

Tested by

no test coverage detected