2 * Copyright (C) 2015 - EfficiOS Inc., Alexandre Montplaisir <alexmonthy@efficios.com>
3 * Copyright (C) 2013 - David Goulet <dgoulet@efficios.com>
5 * This library is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU Lesser General Public License, version 2.1 only,
7 * as published by the Free Software Foundation.
9 * This library is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
14 * You should have received a copy of the GNU Lesser General Public License
15 * along with this library; if not, write to the Free Software Foundation,
16 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 package org.lttng.ust.agent.client;
21 import java.nio.ByteBuffer;
22 import java.nio.ByteOrder;
25 * Session daemon command indicating to the Java agent that some events were
26 * disabled in the tracing session.
28 * @author Alexandre Montplaisir
29 * @author David Goulet
31 class SessiondDisableEventCommand implements ISessiondCommand {
33 /** Event name to disable from the tracing session */
34 private final String eventName;
36 public SessiondDisableEventCommand(byte[] data) {
38 throw new IllegalArgumentException();
40 ByteBuffer buf = ByteBuffer.wrap(data);
41 buf.order(ByteOrder.LITTLE_ENDIAN);
42 eventName = new String(data).trim();
46 public LttngAgentResponse execute(ILttngTcpClientListener agent) {
47 boolean success = agent.eventDisabled(this.eventName);
48 return (success ? LttngAgentResponse.SUCESS_RESPONSE : DISABLE_EVENT_FAILURE_RESPONSE);
52 * Response sent when the disable-event command asks to disable an
55 private static final LttngAgentResponse DISABLE_EVENT_FAILURE_RESPONSE = new LttngAgentResponse() {
57 public ReturnCode getReturnCode() {
58 return ReturnCode.CODE_UNK_LOGGER_NAME;