Class TtlAgent

java.lang.Object
com.alibaba.ttl.threadpool.agent.TtlAgent

public final class TtlAgent extends Object
TTL Java Agent.

The configuration/arguments for TTL agent

Configure TTL agent via agent arguments, format is k1:v1,k2:v2. Below is available configuration keys.

Disable inheritable for thread pool

Enable "disable inheritable" for thread pool, config by key ttl.agent.disable.inheritable.for.thread.pool. When no configuration for this key, default does not enabled. Since version 2.10.1.

More info about "disable inheritable" see TransmittableThreadLocal.

Configuration example:
-javaagent:/path/to/transmittable-thread-local-2.x.y.jar=ttl.agent.disable.inheritable.for.thread.pool:true

The log configuration

The log of TTL Java Agent is config by key ttl.agent.logger. Since version 2.6.0.
  • ttl.agent.logger : STDERR
    only log to stderr when error. This is default, when no/unrecognized configuration for key ttl.agent.logger.
  • ttl.agent.logger : STDOUT
    Log to stdout, more info than ttl.agent.logger:STDERR; This is needed when developing.

configuration example:

  • -javaagent:/path/to/transmittable-thread-local-2.x.y.jar
  • -javaagent:/path/to/transmittable-thread-local-2.x.y.jar=ttl.agent.logger:STDOUT

Enable/disable TimerTask class decoration

Enable/disable TimerTask class decoration is config by key ttl.agent.enable.timer.task. Since version 2.7.0.

When no configuration for this key, default is enabled.
Note: Since version 2.11.2 the default value is true(enable TimerTask class decoration); Before version 2.11.1 default value is false.

Configuration example:

  • -javaagent:/path/to/transmittable-thread-local-2.x.y.jar=ttl.agent.enable.timer.task:false
  • -javaagent:/path/to/transmittable-thread-local-2.x.y.jar=ttl.agent.enable.timer.task:true

Multi key configuration example

-javaagent:/path/to/transmittable-thread-local-2.x.y.jar=ttl.agent.logger:STDOUT,ttl.agent.disable.inheritable.for.thread.pool:true

About boot classpath for TTL agent

NOTE: Since v2.6.0, TTL agent jar will auto add self to boot classpath. But you should NOT modify the downloaded TTL jar file name in the maven repo(eg: transmittable-thread-local-2.x.y.jar).
if you modified the downloaded TTL agent jar file name(eg: ttl-foo-name-changed.jar), you must add TTL agent jar to boot classpath manually by java option -Xbootclasspath/a:path/to/ttl-foo-name-changed.jar.

The implementation of auto adding self agent jar to boot classpath use the Boot-Class-Path property of manifest file(META-INF/MANIFEST.MF) in the TTL Java Agent Jar:

Boot-Class-Path
A list of paths to be searched by the bootstrap class loader. Paths represent directories or libraries (commonly referred to as JAR or zip libraries on many platforms). These paths are searched by the bootstrap class loader after the platform specific mechanisms of locating a class have failed. Paths are searched in the order listed.

More info about Boot-Class-Path see The mechanism for instrumentation.

Since:
0.9.0
Author:
Jerry Lee (oldratlee at gmail dot com)
See Also: