From 5bfeaeca7fd73ebdc5aa9f555213055272daab29 Mon Sep 17 00:00:00 2001 From: Alexandre Montplaisir Date: Tue, 21 Jul 2015 22:50:54 -0400 Subject: [PATCH] Cleanup: Add Javadoc to all public methods and members Signed-off-by: Alexandre Montplaisir Signed-off-by: Mathieu Desnoyers --- doc/examples/java-jul/Hello.java | 19 +++++++++++++++---- doc/examples/java-log4j/Hello.java | 19 +++++++++++++++---- .../org/lttng/ust/agent/LTTngAgent.java | 17 ++++++++++++++--- .../lttng/ust/agent/LTTngSessiondCmd2_6.java | 4 ++++ .../lttng/ust/agent/LogFrameworkSkeleton.java | 15 ++++++++++++++- .../org/lttng/ust/agent/jul/LTTngJUL.java | 12 +++++++++++- .../org/lttng/ust/agent/log4j/LTTngLog4j.java | 12 +++++++++++- 7 files changed, 84 insertions(+), 14 deletions(-) diff --git a/doc/examples/java-jul/Hello.java b/doc/examples/java-jul/Hello.java index 588ec815..28360c72 100644 --- a/doc/examples/java-jul/Hello.java +++ b/doc/examples/java-jul/Hello.java @@ -27,8 +27,13 @@ import java.util.logging.Logger; */ import org.lttng.ust.agent.LTTngAgent; -public class Hello -{ +/** + * Example application using the LTTng-UST Java JUL agent. + * + * @author David Goulet + */ +public class Hello { + /* Of course :) */ private static final int answer = 42; @@ -38,8 +43,14 @@ public class Hello */ private static LTTngAgent lttngAgent; - public static void main(String args[]) throws Exception - { + /** + * Application start + * + * @param args + * Command-line arguments + * @throws Exception + */ + public static void main(String args[]) throws Exception { /* * For this example, a custom "hello" logger is created. Note that JUL * has a default "global" that can also be used. diff --git a/doc/examples/java-log4j/Hello.java b/doc/examples/java-log4j/Hello.java index 38725cb6..c0393392 100644 --- a/doc/examples/java-log4j/Hello.java +++ b/doc/examples/java-log4j/Hello.java @@ -24,8 +24,13 @@ import org.apache.log4j.BasicConfigurator; import org.apache.log4j.Logger; import org.lttng.ust.agent.LTTngAgent; -public class Hello -{ +/** + * Example application using the LTTng-UST Java JUL agent. + * + * @author Christian Babeux + */ +public class Hello { + /* Of course :) */ private static final int answer = 42; @@ -33,8 +38,14 @@ public class Hello private static LTTngAgent lttngAgent; - public static void main(String args[]) throws Exception - { + /** + * Application start + * + * @param args + * Command-line arguments + * @throws Exception + */ + public static void main(String args[]) throws Exception { BasicConfigurator.configure(); lttngAgent = LTTngAgent.getLTTngAgent(); diff --git a/liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/LTTngAgent.java b/liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/LTTngAgent.java index ca7bc777..e83504d9 100644 --- a/liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/LTTngAgent.java +++ b/liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/LTTngAgent.java @@ -22,6 +22,11 @@ import java.lang.reflect.InvocationTargetException; import java.util.concurrent.Semaphore; import java.util.concurrent.TimeUnit; +/** + * The central agent managing the JUL and Log4j handlers. + * + * @author David Goulet + */ public class LTTngAgent { /* Domains */ @@ -181,8 +186,11 @@ public class LTTngAgent { } } - /* + /** * Public getter to acquire a reference to this singleton object. + * + * @return The agent instance + * @throws IOException */ public static synchronized LTTngAgent getLTTngAgent() throws IOException { if (curAgent == null) { @@ -273,8 +281,11 @@ public class LTTngAgent { return numThreads; } - - public void dispose() throws IOException { + /** + * Dispose the agent. Applications should call this once they are done + * logging. + */ + public void dispose() { if (this.useJUL) { julUserClient.destroy(); julRootClient.destroy(); diff --git a/liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/LTTngSessiondCmd2_6.java b/liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/LTTngSessiondCmd2_6.java index 7a33e425..03635c2e 100644 --- a/liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/LTTngSessiondCmd2_6.java +++ b/liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/LTTngSessiondCmd2_6.java @@ -149,6 +149,8 @@ interface LTTngSessiondCmd2_6 { /** * Execute enable handler action which is to enable the given handler * to the received name. + * + * @param log */ public void execute(LogFramework log) { if (log.enableLogger(this.name)) { @@ -187,6 +189,8 @@ interface LTTngSessiondCmd2_6 { /** * Execute disable handler action which is to disable the given handler * to the received name. + * + * @param log */ public void execute(LogFramework log) { if (log.disableLogger(this.name)) { diff --git a/liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/LogFrameworkSkeleton.java b/liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/LogFrameworkSkeleton.java index 6d1ea9f6..4a58d2e2 100644 --- a/liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/LogFrameworkSkeleton.java +++ b/liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/LogFrameworkSkeleton.java @@ -18,15 +18,23 @@ package org.lttng.ust.agent; -import java.util.Map; import java.util.HashMap; import java.util.Iterator; +import java.util.Map; +/** + * Basic implementation of LogFramework. + * + * @author Christian Babeux + */ public abstract class LogFrameworkSkeleton implements LogFramework { /* A map of event name and reference count */ private final Map enabledLoggers; + /** + * Constructor + */ public LogFrameworkSkeleton() { this.enabledLoggers = new HashMap(); } @@ -88,6 +96,11 @@ public abstract class LogFrameworkSkeleton implements LogFramework { enabledLoggers.clear(); } + /** + * Get the number of enabled events. + * + * @return The number of enabled events + */ protected Integer getEventCount() { return enabledLoggers.size(); } diff --git a/liblttng-ust-java-agent/java/lttng-ust-agent-jul/org/lttng/ust/agent/jul/LTTngJUL.java b/liblttng-ust-java-agent/java/lttng-ust-agent-jul/org/lttng/ust/agent/jul/LTTngJUL.java index 6a3eac95..2f21d62e 100644 --- a/liblttng-ust-java-agent/java/lttng-ust-agent-jul/org/lttng/ust/agent/jul/LTTngJUL.java +++ b/liblttng-ust-java-agent/java/lttng-ust-agent-jul/org/lttng/ust/agent/jul/LTTngJUL.java @@ -21,17 +21,27 @@ package org.lttng.ust.agent.jul; import java.util.Enumeration; import java.util.Iterator; import java.util.Vector; - import java.util.logging.LogManager; import java.util.logging.Logger; import org.lttng.ust.agent.LogFrameworkSkeleton; +/** + * JUL logging framework + * + * @author Christian Babeux + */ public class LTTngJUL extends LogFrameworkSkeleton { private LTTngLogHandler handler; private Boolean attached; + /** + * Constructor + * + * @param isRoot + * If this logger is a root logger or not. + */ public LTTngJUL(Boolean isRoot) { super(); this.handler = new LTTngLogHandler(isRoot); diff --git a/liblttng-ust-java-agent/java/lttng-ust-agent-log4j/org/lttng/ust/agent/log4j/LTTngLog4j.java b/liblttng-ust-java-agent/java/lttng-ust-agent-log4j/org/lttng/ust/agent/log4j/LTTngLog4j.java index 6e892bcc..534cc949 100644 --- a/liblttng-ust-java-agent/java/lttng-ust-agent-log4j/org/lttng/ust/agent/log4j/LTTngLog4j.java +++ b/liblttng-ust-java-agent/java/lttng-ust-agent-log4j/org/lttng/ust/agent/log4j/LTTngLog4j.java @@ -24,14 +24,24 @@ import java.util.Vector; import org.apache.log4j.LogManager; import org.apache.log4j.Logger; - import org.lttng.ust.agent.LogFrameworkSkeleton; +/** + * log4j logging framework + * + * @author Christian Babeux + */ public class LTTngLog4j extends LogFrameworkSkeleton { private LTTngLogAppender appender; private Boolean attached; + /** + * Constructor + * + * @param isRoot + * If this logger is a root logger or not. + */ public LTTngLog4j(Boolean isRoot) { super(); this.appender = new LTTngLogAppender(isRoot); -- 2.34.1