
플러그인이 라이프사이클을 인식하려면 PluginActivator 인터페이스를 구현할 수 있습니다:
public interface PluginActivator {
// 让插件本身判断是否要启动
boolean enabled(PluginContext context);
public void init(PluginContext context) throws Exception;
/**
* Before calling this method, the {@link PluginState} is
* {@link PluginState#STARTING}, after calling, the {@link PluginState} is
* {@link PluginState#ACTIVE}
*
* @param context
*/
public void start(PluginContext context) throws Exception;
/**
* Before calling this method, the {@link PluginState} is
* {@link PluginState#STOPPING}, after calling, the {@link PluginState} is
* {@link PluginState#RESOLVED}
*
* @param context
*/
public void stop(PluginContext context) throws Exception;
}
플러그인 디렉터리에 plugin.properties를 두고, 원본 agent jar 파일도 함께 배치합니다.
예를 들어:
type=traditional
name=demo-agent
version=1.0.0
agentJarPath=demo-agent.jar
그러면 one java agent가 이 demo-agent를 시작합니다.
mvn clean install로 bytekit을 설치해야 할 수 있습니다mvn clean package -DskipTests && mvn testmvn clean package -P local -DskipTests는 패키징 후 최신 버전을 로컬 ~/oneoneagent 디렉터리에 설치합니다