alibaba / alibaba/one-java-agent

One Java Agent本身是否支持重新加载

Open
#2 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
579
Forks
128
PR merge metrics
No merged PRs in 30d

Description

One Java Agent本身是一个Java Agent,它要支持两种Java Agent的工作方式:

* premain
* agentmain

但如果按普通的方式实现,java agent jar会被加到 SystemClassLoader里,那么这个Agent本身是没办法实现更新的。

如果要支持动态更新,那么就要像arthas那样,再包装一层,引用一个自定义的ClassLoader,再来启动。

但这样子会带来复杂性:

1. Agent wrapper这一层代码,它本身是要有日志输出到哪/怎么加载配置项等问题的
1. Agent core这一层,它能否加载到SystemClassLoader的类?
1. plugin 的ClassLoader,它的parent是否应该是 Agent core的ClassLoader?
1. plugin 里的代码,能否加载到 SystemClassLoader里的类?

---

考虑到复杂性,是否简单起见,One Java Agent本身即一个传统的Java Agent,它自身不考虑可以更新?

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing how the Java Agent is launched in premain and agentmain, then review the issue's proposed wrapper, agent core, and plugin ClassLoader boundaries. No source files, tests, or entry points are named in the issue, so first identify those areas and clarify whether dynamic reloading is required before implementation. Done means an agreed loading design and documented class-loading behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
devtools
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.