[Deadlock] Move `Agent-Version` property reading away from the class loading stage (#436)

This commit is contained in:
吴晟 Wu Sheng 2023-01-06 09:11:20 +08:00 committed by GitHub
parent dd6c91c906
commit 3ff8c23d0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -23,6 +23,7 @@ Release Notes.
* Add support for KafkaClients 3.x.
* Support to customize the collect period of JVM relative metrics.
* Upgrade netty-codec-http2 to 4.1.86.Final.
* Move `Agent-Version` property reading away from the class loading stage to avoid deadlock when use `jarsigner`.
#### Documentation

View File

@ -40,7 +40,7 @@ import org.apache.skywalking.apm.agent.core.logging.api.LogManager;
*/
public class AgentIDDecorator implements ChannelDecorator {
private static final ILog LOGGER = LogManager.getLogger(AgentIDDecorator.class);
private static final Metadata.Key<String> AGENT_VERSION_HEAD_HEADER_NAME = Metadata.Key.of("Agent-Version", Metadata.ASCII_STRING_MARSHALLER);
private static Metadata.Key<String> AGENT_VERSION_HEAD_HEADER_NAME;
private String version = "UNKNOWN";
public AgentIDDecorator() {
@ -61,6 +61,7 @@ public class AgentIDDecorator implements ChannelDecorator {
}
}
}
AGENT_VERSION_HEAD_HEADER_NAME = Metadata.Key.of("Agent-Version", Metadata.ASCII_STRING_MARSHALLER);
} catch (Exception e) {
LOGGER.warn("Can't read version from MANIFEST.MF in the agent jar");
}