+ uctx = NULL;
+
+ switch (domain) {
+ case LTTNG_DOMAIN_JUL:
+ case LTTNG_DOMAIN_LOG4J:
+ {
+ struct agent *agt;
+
+ if (ctx->ctx != LTTNG_EVENT_CONTEXT_APP_CONTEXT) {
+ /* Other contexts are not needed by the agent. */
+ break;
+ }
+ agt = trace_ust_find_agent(usess, domain);
+
+ if (!agt) {
+ agt = agent_create(domain);
+ if (!agt) {
+ ret = -LTTNG_ERR_NOMEM;
+ goto error;
+ }
+ agent_add(agt, usess->agents);
+ }
+ ret = agent_add_context(ctx, agt);
+ if (ret != LTTNG_OK) {
+ goto error;
+ }
+
+ ret = agent_enable_context(ctx, domain);
+ if (ret != LTTNG_OK) {
+ goto error;
+ }
+ break;
+ }
+ case LTTNG_DOMAIN_UST:
+ break;
+ default:
+ assert(0);
+ }