void registered (ExecutorDriver* driver, const ExecutorInfo& executorInfo, const FrameworkInfo& frameworkInfo, const SlaveInfo& slaveInfo) override { _executorId = executorInfo.executor_id().value(); cout << "Registered executor " << _executorId << " on " << slaveInfo.hostname() << endl; string data; slaveInfo.SerializeToString(&data); driver->sendFrameworkMessage(data); }
jobject convert(JNIEnv* env, const SlaveInfo& slaveInfo) { string data; slaveInfo.SerializeToString(&data); // byte[] data = ..; jbyteArray jdata = env->NewByteArray(data.size()); env->SetByteArrayRegion(jdata, 0, data.size(), (jbyte*) data.data()); // SlaveInfo slaveInfo = SlaveInfo.parseFrom(data); jclass clazz = FindMesosClass(env, "org/apache/mesos/Protos$SlaveInfo"); jmethodID parseFrom = env->GetStaticMethodID(clazz, "parseFrom", "([B)Lorg/apache/mesos/Protos$SlaveInfo;"); jobject jslaveInfo = env->CallStaticObjectMethod(clazz, parseFrom, jdata); return jslaveInfo; }