2 * SPDX-License-Identifier: LGPL-2.1-only
4 * Copyright (C) 2015 EfficiOS Inc.
5 * Copyright (C) 2015 Alexandre Montplaisir <alexmonthy@efficios.com>
6 * Copyright (C) 2013 David Goulet <dgoulet@efficios.com>
9 package org.lttng.ust.agent.client;
11 import java.nio.ByteBuffer;
12 import java.nio.ByteOrder;
15 * Session daemon command indicating to the Java agent that some events were
16 * disabled in the tracing session.
18 * @author Alexandre Montplaisir
19 * @author David Goulet
21 class SessiondDisableEventCommand extends SessiondCommand {
24 * Response sent when the disable-event command asks to disable an
27 private static final LttngAgentResponse DISABLE_EVENT_FAILURE_RESPONSE = new LttngAgentResponse() {
29 public ReturnCode getReturnCode() {
30 return ReturnCode.CODE_UNKNOWN_LOGGER_NAME;
34 /** Event name to disable from the tracing session */
35 private final String eventName;
37 public SessiondDisableEventCommand(byte[] data) {
39 throw new IllegalArgumentException();
41 ByteBuffer buf = ByteBuffer.wrap(data);
42 buf.order(ByteOrder.BIG_ENDIAN);
43 eventName = new String(data, SESSIOND_PROTOCOL_CHARSET).trim();
47 public LttngAgentResponse execute(ILttngTcpClientListener agent) {
48 boolean success = agent.eventDisabled(this.eventName);
49 return (success ? LttngAgentResponse.SUCESS_RESPONSE : DISABLE_EVENT_FAILURE_RESPONSE);
53 public String toString() {
54 return "SessiondDisableEventCommand["
55 + "eventName=" + eventName