X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;f=liblttng-ust-java-agent%2Fjava%2Flttng-ust-agent-common%2Forg%2Flttng%2Fust%2Fagent%2Ffilter%2FIFilterChangeListener.java;fp=liblttng-ust-java-agent%2Fjava%2Flttng-ust-agent-common%2Forg%2Flttng%2Fust%2Fagent%2Ffilter%2FIFilterChangeListener.java;h=90883c7a4c02e15d00b319d9c5ea135da86d769b;hb=4fb826b158cbd2cea8f4a91457f49417c261777d;hp=0000000000000000000000000000000000000000;hpb=3daf5cba66edbd7d8b608be1372a1665189b3c67;p=lttng-ust.git diff --git a/liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/filter/IFilterChangeListener.java b/liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/filter/IFilterChangeListener.java new file mode 100644 index 00000000..90883c7a --- /dev/null +++ b/liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/filter/IFilterChangeListener.java @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2015 - EfficiOS Inc., Alexandre Montplaisir + * + * This library is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License, version 2.1 only, + * as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License + * for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this library; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +package org.lttng.ust.agent.filter; + +import org.lttng.ust.agent.session.EventRule; + +/** + * Filter notification listener interface. + *

+ * Applications wanting to be notified of event filtering rule changes should + * implement this interface, then register their listener using + * {@link FilterChangeNotifier#registerListener}. + *

+ *

+ * The callbacks defined in this interface will be called whenever an event rule + * is added or removed. The manager will take care of the reference-counting in + * case multiple tracing sessions enable the exact same rules. For example, the + * {@link #eventRuleRemoved} callback is only called when there are no more + * session interested into it. + *

+ *

+ * Do not forget to unregister the listener after use, using + * {@link FilterChangeNotifier#unregisterListener}. If you do not, or if + * you use an anonymous listener for example, these will remain attached until + * the complete shutdown of the application. + *

+ *

+ * Only one thread is used to dispatch notifications, sequentially. This means + * that if a callback hangs it will prevent other listeners from receiving + * notifications. Please take care of not blocking inside the listener + * callbacks, and use separate threads for potentially long or blocking + * operations. + *

+ * + * @author Alexandre Montplaisir + */ +public interface IFilterChangeListener { + + /** + * Notification that a new event rule is now enabled in the tracing + * sessions. + * + * @param rule + * The event rule that was enabled + */ + void eventRuleAdded(EventRule rule); + + /** + * Notification that an existing event rule is now disabled in the tracing + * sessions. + * + * @param rule + * The event rule that was disabled + */ + void eventRuleRemoved(EventRule rule); +}