MCPcopy Create free account
hub / github.com/apple/foundationdb / createWorkloadContext

Method createWorkloadContext

bindings/java/JavaWorkload.cpp:388–406  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

386 }
387
388 jobject createWorkloadContext(FDBWorkloadContext* context) {
389 auto clazz = getClass("com/apple/foundationdb/testing/WorkloadContext");
390 auto constructor = getMethod(clazz, "<init>", "(J)V");
391 auto jContext = reinterpret_cast<jlong>(context);
392 jobject res = env->NewObject(clazz, constructor, jContext);
393 std::cout.flush();
394 checkException();
395 auto field = env->GetFieldID(clazz, "impl", "J");
396 checkException();
397 auto impl = env->GetLongField(res, field);
398 checkException();
399 if (impl != jContext) {
400 log->trace(error,
401 "ContextNotCorrect",
402 { { "Expected", std::to_string(jContext) }, { "Impl", std::to_string(impl) } });
403 std::terminate();
404 }
405 return res;
406 }
407
408 jobject createWorkload(jobject context, const std::string& workloadName) {
409 auto clazz = getClass(workloadName.c_str());

Callers 1

initMethod · 0.80

Calls 4

getMethodFunction · 0.85
to_stringFunction · 0.50
flushMethod · 0.45
traceMethod · 0.45

Tested by

no test coverage detected