+ IContextInfoRetriever retriever = contextManager.getContextInfoRetriever(requestedRetrieverName);
+
+ for (String requestedContext : requestedContexts.keySet()) {
+ Object contextInfo;
+ if (retriever == null) {
+ contextInfo = null;
+ } else {
+ contextInfo = retriever.retrieveContextInfo(requestedContext);
+ /*
+ * 'contextInfo' can still be null here, which would
+ * indicate the retriever does not supply this context.
+ * We will still write this information so that the
+ * tracer can know about it.
+ */
+ }
+
+ /* Serialize the result to the buffers */
+ // FIXME Eventually pass the retriever name only once?
+ String fullContextName = (UST_APP_CTX_PREFIX + requestedRetrieverName + ':' + requestedContext);
+ byte[] strArray = fullContextName.getBytes(UTF8_CHARSET);
+
+ entriesBuffer.putInt(stringsDos.size());
+ stringsDos.write(strArray);
+ stringsDos.writeChar('\0');
+
+ LttngUstAgentLogger.log(ContextInfoSerializer.class,
+ "ContextInfoSerializer: Context to be sent through JNI: " + fullContextName + '=' +
+ (contextInfo == null ? "null" : contextInfo.toString()));
+
+ serializeContextInfo(entriesBuffer, stringsDos, contextInfo);
+ }