Cleanup: Remove unused import in JUL Java agent
[lttng-ust.git] / liblttng-ust-java-agent / java / lttng-ust-agent-common / org / lttng / ust / agent / client / SessiondDisableEventCommand.java
CommitLineData
d60dfbe4 1/*
301a3ddb 2 * Copyright (C) 2015 - EfficiOS Inc., Alexandre Montplaisir <alexmonthy@efficios.com>
d60dfbe4
AM
3 * Copyright (C) 2013 - David Goulet <dgoulet@efficios.com>
4 *
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.
8 *
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
12 * for more details.
13 *
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
17 */
18
19package org.lttng.ust.agent.client;
20
21import java.nio.ByteBuffer;
22import java.nio.ByteOrder;
23
301a3ddb
AM
24/**
25 * Session daemon command indicating to the Java agent that some events were
26 * disabled in the tracing session.
27 *
28 * @author Alexandre Montplaisir
29 * @author David Goulet
30 */
1d193914 31class SessiondDisableEventCommand extends SessiondCommand {
d60dfbe4
AM
32
33 /** Event name to disable from the tracing session */
301a3ddb 34 private final String eventName;
d60dfbe4 35
301a3ddb
AM
36 public SessiondDisableEventCommand(byte[] data) {
37 if (data == null) {
38 throw new IllegalArgumentException();
39 }
d60dfbe4 40 ByteBuffer buf = ByteBuffer.wrap(data);
abac44cd 41 buf.order(ByteOrder.BIG_ENDIAN);
22191ffd 42 eventName = new String(data, SESSIOND_PROTOCOL_CHARSET).trim();
d60dfbe4
AM
43 }
44
45 @Override
3165c2f5 46 public LttngAgentResponse execute(ILttngTcpClientListener agent) {
301a3ddb 47 boolean success = agent.eventDisabled(this.eventName);
93253569 48 return (success ? LttngAgentResponse.SUCESS_RESPONSE : DISABLE_EVENT_FAILURE_RESPONSE);
d60dfbe4 49 }
2c240349
AM
50
51 /**
52 * Response sent when the disable-event command asks to disable an
53 * unknown event.
54 */
93253569 55 private static final LttngAgentResponse DISABLE_EVENT_FAILURE_RESPONSE = new LttngAgentResponse() {
2c240349
AM
56 @Override
57 public ReturnCode getReturnCode() {
8ab5c06b 58 return ReturnCode.CODE_UNKNOWN_LOGGER_NAME;
2c240349 59 }
2c240349 60 };
d60dfbe4 61}
This page took 0.02607 seconds and 4 git commands to generate.