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

Method Worker

src/main/java/com/oltpbenchmark/api/Worker.java:75–100  ·  view source on GitHub ↗
(T benchmark, int id)

Source from the content-addressed store, hash-verified

73 private boolean seenDone = false;
74
75 public Worker(T benchmark, int id) {
76 this.id = id;
77 this.benchmark = benchmark;
78 this.configuration = this.benchmark.getWorkloadConfiguration();
79 this.workloadState = this.configuration.getWorkloadState();
80 this.currStatement = null;
81 this.transactionTypes = this.configuration.getTransTypes();
82
83 if (!this.configuration.getNewConnectionPerTxn()) {
84 try {
85 this.conn = this.benchmark.makeConnection();
86 this.conn.setAutoCommit(false);
87 this.conn.setTransactionIsolation(this.configuration.getIsolationMode());
88 } catch (SQLException ex) {
89 throw new RuntimeException("Failed to connect to database", ex);
90 }
91 }
92
93 // Generate all the Procedures that we're going to need
94 this.procedures.putAll(this.benchmark.getProcedures());
95 for (Entry<TransactionType, Procedure> e : this.procedures.entrySet()) {
96 Procedure proc = e.getValue();
97 this.name_procedures.put(e.getKey().getName(), proc);
98 this.class_procedures.put(proc.getClass(), proc);
99 }
100 }
101
102 /** Get the BenchmarkModule managing this Worker */
103 public final T getBenchmark() {

Callers

nothing calls this directly

Calls 12

getWorkloadStateMethod · 0.80
getTransTypesMethod · 0.80
getIsolationModeMethod · 0.80
putAllMethod · 0.80
getProceduresMethod · 0.80
getClassMethod · 0.80
getNameMethod · 0.65
makeConnectionMethod · 0.45
getValueMethod · 0.45
putMethod · 0.45

Tested by

no test coverage detected