Refactor Java agent to let applications manage the log handlers
authorAlexandre Montplaisir <alexmonthy@efficios.com>
Wed, 22 Jul 2015 02:56:15 +0000 (22:56 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 29 Jul 2015 01:32:17 +0000 (21:32 -0400)
commitd60dfbe48a0ceff16852f46419bcbc405502c61d
tree396742e2f610ba47a45bb5ce1b7d7c992463ab4e
parent9493af145a30229f5369c9d902b1badc0ce7deba
Refactor Java agent to let applications manage the log handlers

Major refactoring of the UST Java agent and its JUL and log4j
logging facilities.

Split up the big LTTngAgent class into two separate agent
singletons, one for JUL and one for log4j.
The large parts of common code remain in the -common package
in AbstractLttngAgent, with the API-specific implementations
in their respective -jul or -log4j package.
This removes the need for circular-dependencies (which were
worked around using reflection) between the common and the
other packages.

The applications are now expected to instantiate their
JUL Handler or log4j LogAppender themselves, and to attach
them to corresponding Logger objects. The LttngLogHandler and
LttngLogAppender classes are now made public to allow this.

Agents are now spawned automatically on demand, as Handler
objects are created. Once the last handler/appender is
close()'d, the agent is disposed as well. This reduces the
number of threads and socket connections to the minimum that
is necessary.

The two separate tracepoints in the JNI libraries, "tracepointS"
and "tracepointU", are now merged into one. Events sent to
either the root or user session daemon will use the same call.

The LTTngAgent.getLTTngAgent() API is kept for compatibility
with applications using it, but now marked @Deprecated. The
functionality underneath was re-implemented using the new
classes, but the behaviour should be kept the same.

Signed-off-by: Alexandre Montplaisir <alexmonthy@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
36 files changed:
.gitignore
doc/examples/java-jul/Hello.java
doc/examples/java-log4j/Hello.java
doc/java-agent.txt
liblttng-ust-java-agent/java/lttng-ust-agent-common/Makefile.am
liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/AbstractLttngAgent.java [new file with mode: 0644]
liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/ILttngAgent.java [new file with mode: 0644]
liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/ILttngHandler.java [new file with mode: 0644]
liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/LTTngAgent.java
liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/LTTngSessiondCmd2_6.java [deleted file]
liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/LTTngTCPSessiondClient.java [deleted file]
liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/LogFramework.java [deleted file]
liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/LogFrameworkSkeleton.java [deleted file]
liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/client/ISessiondCommand.java [new file with mode: 0644]
liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/client/ISessiondResponse.java [new file with mode: 0644]
liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/client/LttngTcpSessiondClient.java [new file with mode: 0644]
liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/client/SessiondDisableHandler.java [new file with mode: 0644]
liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/client/SessiondEnableHandler.java [new file with mode: 0644]
liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/client/SessiondHeaderCommand.java [new file with mode: 0644]
liblttng-ust-java-agent/java/lttng-ust-agent-common/org/lttng/ust/agent/client/SessiondListLoggersResponse.java [new file with mode: 0644]
liblttng-ust-java-agent/java/lttng-ust-agent-jul/Makefile.am
liblttng-ust-java-agent/java/lttng-ust-agent-jul/org/lttng/ust/agent/jul/LTTngJUL.java [deleted file]
liblttng-ust-java-agent/java/lttng-ust-agent-jul/org/lttng/ust/agent/jul/LTTngLogHandler.java [deleted file]
liblttng-ust-java-agent/java/lttng-ust-agent-jul/org/lttng/ust/agent/jul/LttngJulAgent.java [new file with mode: 0644]
liblttng-ust-java-agent/java/lttng-ust-agent-jul/org/lttng/ust/agent/jul/LttngLogHandler.java [new file with mode: 0644]
liblttng-ust-java-agent/java/lttng-ust-agent-log4j/Makefile.am
liblttng-ust-java-agent/java/lttng-ust-agent-log4j/org/lttng/ust/agent/log4j/LTTngLog4j.java [deleted file]
liblttng-ust-java-agent/java/lttng-ust-agent-log4j/org/lttng/ust/agent/log4j/LTTngLogAppender.java [deleted file]
liblttng-ust-java-agent/java/lttng-ust-agent-log4j/org/lttng/ust/agent/log4j/LttngLog4jAgent.java [new file with mode: 0644]
liblttng-ust-java-agent/java/lttng-ust-agent-log4j/org/lttng/ust/agent/log4j/LttngLogAppender.java [new file with mode: 0644]
liblttng-ust-java-agent/jni/jul/Makefile.am
liblttng-ust-java-agent/jni/jul/lttng_ust_jul.c
liblttng-ust-java-agent/jni/jul/lttng_ust_jul.h
liblttng-ust-java-agent/jni/log4j/Makefile.am
liblttng-ust-java-agent/jni/log4j/lttng_ust_log4j.c
liblttng-ust-java-agent/jni/log4j/lttng_ust_log4j.h
This page took 0.029935 seconds and 5 git commands to generate.