Class CachedAttachmentProvider

java.lang.Object
co.elastic.apm.attach.CachedAttachmentProvider
All Implemented Interfaces:
net.bytebuddy.agent.ByteBuddyAgent.AttachmentProvider

public class CachedAttachmentProvider extends Object implements net.bytebuddy.agent.ByteBuddyAgent.AttachmentProvider
Successive attachments with a tools.jar-based ByteBuddyAgent.AttachmentProvider would lead to the VirtualMachine class to be loaded from multiple class loaders (see ByteBuddyAgent.AttachmentProvider.ForStandardToolsJarVm.attempt()). That leads to a UnsatisfiedLinkError on Java 7 and 8 because the native library libattach can only be loaded by one class loader. By caching the ByteBuddyAgent.AttachmentProvider.Accessor, the same VirtualMachine class is reused so that there is no attempt to load the libattach library from another class loader.
  • Nested Class Summary

    Nested classes/interfaces inherited from interface net.bytebuddy.agent.ByteBuddyAgent.AttachmentProvider

    net.bytebuddy.agent.ByteBuddyAgent.AttachmentProvider.Accessor, net.bytebuddy.agent.ByteBuddyAgent.AttachmentProvider.Compound, net.bytebuddy.agent.ByteBuddyAgent.AttachmentProvider.ForEmulatedAttachment, net.bytebuddy.agent.ByteBuddyAgent.AttachmentProvider.ForJ9Vm, net.bytebuddy.agent.ByteBuddyAgent.AttachmentProvider.ForModularizedVm, net.bytebuddy.agent.ByteBuddyAgent.AttachmentProvider.ForStandardToolsJarVm, net.bytebuddy.agent.ByteBuddyAgent.AttachmentProvider.ForUserDefinedToolsJar
  • Field Summary

    Fields inherited from interface net.bytebuddy.agent.ByteBuddyAgent.AttachmentProvider

    DEFAULT
  • Method Summary

    Modifier and Type
    Method
    Description
    net.bytebuddy.agent.ByteBuddyAgent.AttachmentProvider.Accessor
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • attempt

      public net.bytebuddy.agent.ByteBuddyAgent.AttachmentProvider.Accessor attempt()
      Specified by:
      attempt in interface net.bytebuddy.agent.ByteBuddyAgent.AttachmentProvider