ttl-agent/src/main/java/com/alibaba/ttl3/agent/TtlAgent.java [165:239]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    public static final String TTL_AGENT_LOGGER_KEY = "ttl.agent.logger";

    /**
     * the TTL agent configuration key: Disable inheritable for thread pool
     *
     * @see TtlAgent
     */
    public static final String TTL_AGENT_DISABLE_INHERITABLE_FOR_THREAD_POOL_KEY = "ttl.agent.disable.inheritable.for.thread.pool";

    /**
     * the TTL agent configuration key: Enable TimerTask class decoration
     *
     * @see TtlAgent
     */
    public static final String TTL_AGENT_ENABLE_TIMER_TASK_KEY = "ttl.agent.enable.timer.task";

    /**
     * the TTL agent configuration key: logging the transform class received by TTL Agent
     *
     * @see TtlAgent
     */
    public static final String TTL_AGENT_LOG_CLASS_TRANSFORM_KEY = "ttl.agent.log.class.transform";


    // ======== TTL Agent internal States ========

    private static volatile Map<String, String> kvs;

    private static volatile boolean ttlAgentLoaded = false;

    /**
     * Entrance method of TTL Java Agent.
     *
     * @see TtlAgent
     */
    public static void premain(final String agentArgs, @NonNull final Instrumentation inst) {
        kvs = TtlAgentHelper.splitCommaColonStringToKV(agentArgs);

        Logger.setLoggerImplType(getLoggerType());
        final Logger logger = Logger.getLogger(TtlAgent.class);

        try {
            logger.info("[TtlAgent.premain] begin, agentArgs: " + agentArgs + ", Instrumentation: " + inst);

            logger.info(logTtlAgentConfig());

            final List<TtlTransformlet> transformletList = new ArrayList<>();

            transformletList.add(new JdkExecutorTtlTransformlet());
            transformletList.add(new PriorityBlockingQueueTtlTransformlet());

            transformletList.add(new ForkJoinTtlTransformlet());

            if (isEnableTimerTask()) transformletList.add(new TimerTaskTtlTransformlet());

            final ClassFileTransformer transformer = new TtlTransformer(transformletList, isLogClassTransform());
            inst.addTransformer(transformer, true);
            logger.info("[TtlAgent.premain] add Transformer " + transformer.getClass().getName() + " success");

            logger.info("[TtlAgent.premain] end");

            ttlAgentLoaded = true;
        } catch (Exception e) {
            String msg = "Fail to load TtlAgent , cause: " + e.toString();
            logger.error(msg, e);
            throw new IllegalStateException(msg, e);
        }
    }

    private static String logTtlAgentConfig() {
        return "TTL Agent configurations:"
                + "\n    " + TTL_AGENT_LOGGER_KEY + "=" + getLoggerType()
                + "\n    " + TTL_AGENT_LOG_CLASS_TRANSFORM_KEY + "=" + isLogClassTransform()
                + "\n    " + TTL_AGENT_DISABLE_INHERITABLE_FOR_THREAD_POOL_KEY + "=" + isDisableInheritableForThreadPool()
                + "\n    " + TTL_AGENT_ENABLE_TIMER_TASK_KEY + "=" + isEnableTimerTask();
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



ttl2-compatible/src/main/java/com/alibaba/ttl/threadpool/agent/TtlAgent.java [162:239]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    public static final String TTL_AGENT_LOGGER_KEY = "ttl.agent.logger";

    /**
     * the TTL agent configuration key: Disable inheritable for thread pool
     *
     * @see TtlAgent
     * @since 3.0.0
     */
    public static final String TTL_AGENT_DISABLE_INHERITABLE_FOR_THREAD_POOL_KEY = "ttl.agent.disable.inheritable.for.thread.pool";

    /**
     * the TTL agent configuration key: Enable TimerTask class decoration
     *
     * @see TtlAgent
     * @since 3.0.0
     */
    public static final String TTL_AGENT_ENABLE_TIMER_TASK_KEY = "ttl.agent.enable.timer.task";

    /**
     * the TTL agent configuration key: logging the transform class received by TTL Agent
     *
     * @see TtlAgent
     * @since 3.0.0
     */
    public static final String TTL_AGENT_LOG_CLASS_TRANSFORM_KEY = "ttl.agent.log.class.transform";


    // ======== TTL Agent internal States ========

    private static volatile Map<String, String> kvs;

    private static volatile boolean ttlAgentLoaded = false;

    /**
     * Entrance method of TTL Java Agent.
     *
     * @see TtlAgent
     */
    public static void premain(final String agentArgs, @NonNull final Instrumentation inst) {
        kvs = TtlAgentHelper.splitCommaColonStringToKV(agentArgs);

        Logger.setLoggerImplType(getLoggerType());
        final Logger logger = Logger.getLogger(TtlAgent.class);

        try {
            logger.info("[TtlAgent.premain] begin, agentArgs: " + agentArgs + ", Instrumentation: " + inst);

            logger.info(logTtlAgentConfig());

            final List<TtlTransformlet> transformletList = new ArrayList<>();

            transformletList.add(new JdkExecutorTtlTransformlet());
            transformletList.add(new PriorityBlockingQueueTtlTransformlet());

            transformletList.add(new ForkJoinTtlTransformlet());

            if (isEnableTimerTask()) transformletList.add(new TimerTaskTtlTransformlet());

            final ClassFileTransformer transformer = new TtlTransformer(transformletList, isLogClassTransform());
            inst.addTransformer(transformer, true);
            logger.info("[TtlAgent.premain] add Transformer " + transformer.getClass().getName() + " success");

            logger.info("[TtlAgent.premain] end");

            ttlAgentLoaded = true;
        } catch (Exception e) {
            String msg = "Fail to load TtlAgent , cause: " + e.toString();
            logger.error(msg, e);
            throw new IllegalStateException(msg, e);
        }
    }

    private static String logTtlAgentConfig() {
        return "TTL Agent configurations:"
            + "\n    " + TTL_AGENT_LOGGER_KEY + "=" + getLoggerType()
            + "\n    " + TTL_AGENT_LOG_CLASS_TRANSFORM_KEY + "=" + isLogClassTransform()
            + "\n    " + TTL_AGENT_DISABLE_INHERITABLE_FOR_THREAD_POOL_KEY + "=" + isDisableInheritableForThreadPool()
            + "\n    " + TTL_AGENT_ENABLE_TIMER_TASK_KEY + "=" + isEnableTimerTask();
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



