java.lang.instrument.Instrumentation文档翻译

生产级机器学习服务的可观测性与稳定性实战 机器学习模型部署不是终点,而是工程化交付的起点。从基础概念看,可观察性(Observability)指通过指标、链路追踪和日志三大支柱,实现对系统内部状态的推断能力;其核心原理在于将黑盒推理过程转化为可量化、可关联、可归因的数据流。技术价值体现在快速故障定位、主动漂移防御与合规审计就绪,支撑高可用ML服务在金融风控、电商推荐等关键场景稳定运行。本文聚焦真实生产环境中的可观测性落地与稳定性保障,深入解析Triton推理引擎性能调优、Feast特征服务一致性机制,并结合OpenTelemetry与Grafana 阅读详情

包:java.lang.instrument

Instrumentation接口


  • public interface Instrumentation

这个类提供了插装(Instrument)Java编程语言代码的服务。插装(Instrument)是在方法上添加字节码,获取数据后提供给工具(tools)使用。这些改变完全是附加的(additive),因此这些工具并没有改变应用的状态和行为。

这些温和的工具(benign tools)包括monitoring agents, profilers, coverage analyzers 甚至 loggers。

有两种方法获取Instrumentation接口的实例,他们在 包规范 中均有描述 。一旦agent获取了Instrumentation接口的实例,就可以在任何时间调用(call)该实例的方法。这个接口自JDK 1.5开始提供。

  1. 当JVM同agent一起启动(launch)时。这种情况下,Instrumentation 实例被传递(passed)给agent的premain 方法.

  2. 当JVM提供了虚拟机启动后再启动agent的机制时。这种情况下,Instrumentation 实例被传递(passed)给agent的agentmain 方法.

This class provides services needed to instrument Java programming language code. Instrumentation is the addition of byte-codes to methods for the purpose of gathering data to be utilized by tools. Since the changes are purely additive, these tools do not modify application state or behavior. Examples of such benign tools include monitoring agents, profilers, coverage analyzers, and event loggers.

There are two ways to obtain an instance of the Instrumentation interface:

These mechanisms are described in the package specification.

Once an agent acquires an Instrumentation instance, the agent may call methods on the instance at any time.

Since:

1.5

  1. When a JVM is launched in a way that indicates an agent class. In that case an Instrumentation instance is passed to the premain method of the agent class.

  2. When a JVM provides a mechanism to start agents sometime after the JVM is launched. In that case an Instrumentation instance is passed to the agentmain method of the agent code.

  • 方法概览

    Modifier and TypeMethod and Description
    void

    addTransformer(ClassFileTransformer transformer)

    注册给定的transformer

    Registers the supplied transformer.

    void

    addTransformer(ClassFileTransformer transformer, boolean canRetransform)

    注册给定的transformer

    Registers the supplied transformer.

    void

    appendToBootstrapClassLoaderSearch(JarFile jarfile)

    指定一个JAR文件,其中包含将会被(to be)BootstrapClassLoader定义的instrumentation类

    Specifies a JAR file with instrumentation classes to be defined by the bootstrap class loader.

    void

    appendToSystemClassLoaderSearch(JarFile jarfile)

    指定一个JAR文件,其中包含将会被(to be)SystemClassLoader定义的instrumentation类

    Specifies a JAR file with instrumentation classes to be defined by the system class loader.

    Class[]

    getAllLoadedClasses()

    返回当前JVM加载的所有类的array

    Returns an array of all classes currently loaded by the JVM.

    Class[]

    getInitiatedClasses(ClassLoader loader)

    返回当前JVM initiating loader加载的所有类的array

    Returns an array of all classes for which loader is an initiating loader.

    long

    getObjectSize(Object objectToSize)

    返回基于特定实现的指定对象消耗存储量的特定近似值。

    Returns an implementation-specific approximation of the amount of storage consumed by the specified object.

    boolean

    isModifiableClass(Class<?> theClass)

    决定一个类能够被 retransformation or redefinition修改

    Determines whether a class is modifiable by retransformation or redefinition.

    boolean

    isNativeMethodPrefixSupported()

    返回当前JVM配置能否支持设置一个native方法前缀

    Returns whether the current JVM configuration supports setting a native method prefix.

    boolean

    isRedefineClassesSupported()

    返回当前JVM配置能否支持类的redefinition

    Returns whether or not the current JVM configuration supports redefinition of classes.

    boolean

    isRetransformClassesSupported()

    返回当前JVM配置能否支持类的retransformation

    Returns whether or not the current JVM configuration supports retransformation of classes.

    void

    redefineClasses(ClassDefinition... definitions)

    使用提供的类文件重新定义提供的类集

    Redefine the supplied set of classes using the supplied class files.

    boolean

    removeTransformer(ClassFileTransformer transformer)

    注册提供的transformer

    Unregisters the supplied transformer.

    void

    retransformClasses(Class<?>... classes)

    Retransform提供的类集

    Retransform the supplied set of classes.

    void

    setNativeMethodPrefix(ClassFileTransformer transformer, String prefix)

    此方法通过允许使用应用于名称的前缀重试来修改本机方法解析的失败处理

    This method modifies the failure handling of native method resolution by allowing retry with a prefix applied to the name.

    • Method Detail

      • addTransformer

        void addTransformer(ClassFileTransformer transformer,
                            boolean canRetransform)
        Registers the supplied transformer. All future class definitions will be seen by the transformer, except definitions of classes upon which any registered transformer is dependent. The transformer is called when classes are loaded, when they are redefined. and if canRetransform is true, when they are retransformed. See ClassFileTransformer.transform for the order of transform calls. If a transformer throws an exception during execution, the JVM will still call the other registered transformers in order. The same transformer may be added more than once, but it is strongly discouraged -- avoid this by creating a new instance of transformer class.

        This method is intended for use in instrumentation, as described in the class specification.

        Parameters:

        transformer - the transformer to register

        canRetransform - can this transformer's transformations be retransformed

        Throws:

        NullPointerException - if passed a null transformer

        UnsupportedOperationException - if canRetransform is true and the current configuration of the JVM does not allow retransformation (isRetransformClassesSupported() is false)

        Since:

        1.6

      • addTransformer

        void addTransformer(ClassFileTransformer transformer)
        Registers the supplied transformer.

        Same as addTransformer(transformer, false).

        Parameters:

        transformer - the transformer to register

        Throws:

        NullPointerException - if passed a null transformer

        See Also:

        addTransformer(ClassFileTransformer,boolean)

      • removeTransformer

        boolean removeTransformer(ClassFileTransformer transformer)

        Unregisters the supplied transformer. Future class definitions will not be shown to the transformer. Removes the most-recently-added matching instance of the transformer. Due to the multi-threaded nature of class loading, it is possible for a transformer to receive calls after it has been removed. Transformers should be written defensively to expect this situation.

        Parameters:

        transformer - the transformer to unregister

        Returns:

        true if the transformer was found and removed, false if the transformer was not found

        Throws:

        NullPointerException - if passed a null transformer

      • isRetransformClassesSupported

        boolean isRetransformClassesSupported()

        Returns whether or not the current JVM configuration supports retransformation of classes. The ability to retransform an already loaded class is an optional capability of a JVM. Retransformation will only be supported if the Can-Retransform-Classes manifest attribute is set to true in the agent JAR file (as described in the package specification) and the JVM supports this capability. During a single instantiation of a single JVM, multiple calls to this method will always return the same answer.

        Returns:

        true if the current JVM configuration supports retransformation of classes, false if not.

        Since:

        1.6

        See Also:

        retransformClasses(java.lang.Class<?>...)

      • retransformClasses

        void retransformClasses(Class<?>... classes)
                         throws UnmodifiableClassException
        Retransform the supplied set of classes.

        This function facilitates the instrumentation of already loaded classes. When classes are initially loaded or when they are redefined, the initial class file bytes can be transformed with the ClassFileTransformer. This function reruns the transformation process (whether or not a transformation has previously occurred). This retransformation follows these steps:

        • starting from the initial class file bytes
        • for each transformer that was added with canRetransform false, the bytes returned by transform during the last class load or redefine are reused as the output of the transformation; note that this is equivalent to reapplying the previous transformation, unaltered; except that transform is not called
        • for each transformer that was added with canRetransform true, the transform method is called in these transformers
        • the transformed class file bytes are installed as the new definition of the class

        The order of transformation is described in the transform method. This same order is used in the automatic reapplication of retransformation incapable transforms.

        The initial class file bytes represent the bytes passed to ClassLoader.defineClass or redefineClasses (before any transformations were applied), however they might not exactly match them. The constant pool might not have the same layout or contents. The constant pool may have more or fewer entries. Constant pool entries may be in a different order; however, constant pool indices in the bytecodes of methods will correspond. Some attributes may not be present. Where order is not meaningful, for example the order of methods, order might not be preserved.

        This method operates on a set in order to allow interdependent changes to more than one class at the same time (a retransformation of class A can require a retransformation of class B).

        If a retransformed method has active stack frames, those active frames continue to run the bytecodes of the original method. The retransformed method will be used on new invokes.

        This method does not cause any initialization except that which would occur under the customary JVM semantics. In other words, redefining a class does not cause its initializers to be run. The values of static variables will remain as they were prior to the call.

        Instances of the retransformed class are not affected.

        The retransformation may change method bodies, the constant pool and attributes. The retransformation must not add, remove or rename fields or methods, change the signatures of methods, or change inheritance. These restrictions maybe be lifted in future versions. The class file bytes are not checked, verified and installed until after the transformations have been applied, if the resultant bytes are in error this method will throw an exception.

        If this method throws an exception, no classes have been retransformed.

        This method is intended for use in instrumentation, as described in the class specification.

        Parameters:

        classes - array of classes to retransform; a zero-length array is allowed, in this case, this method does nothing

        Throws:

        UnmodifiableClassException - if a specified class cannot be modified (isModifiableClass(java.lang.Class<?>) would return false)

        UnsupportedOperationException - if the current configuration of the JVM does not allow retransformation (isRetransformClassesSupported() is false) or the retransformation attempted to make unsupported changes

        ClassFormatError - if the data did not contain a valid class

        NoClassDefFoundError - if the name in the class file is not equal to the name of the class

        UnsupportedClassVersionError - if the class file version numbers are not supported

        ClassCircularityError - if the new classes contain a circularity

        LinkageError - if a linkage error occurs

        NullPointerException - if the supplied classes array or any of its components is null.

        Since:

        1.6

        See Also:

        isRetransformClassesSupported(), addTransformer(java.lang.instrument.ClassFileTransformer, boolean), ClassFileTransformer

      • isRedefineClassesSupported

        boolean isRedefineClassesSupported()

        Returns whether or not the current JVM configuration supports redefinition of classes. The ability to redefine an already loaded class is an optional capability of a JVM. Redefinition will only be supported if the Can-Redefine-Classes manifest attribute is set to true in the agent JAR file (as described in the package specification) and the JVM supports this capability. During a single instantiation of a single JVM, multiple calls to this method will always return the same answer.

        Returns:

        true if the current JVM configuration supports redefinition of classes, false if not.

        See Also:

        redefineClasses(java.lang.instrument.ClassDefinition...)

      • redefineClasses

        void redefineClasses(ClassDefinition... definitions)
                      throws ClassNotFoundException,
                             UnmodifiableClassException
        Redefine the supplied set of classes using the supplied class files.

        This method is used to replace the definition of a class without reference to the existing class file bytes, as one might do when recompiling from source for fix-and-continue debugging. Where the existing class file bytes are to be transformed (for example in bytecode instrumentation) retransformClasses should be used.

        This method operates on a set in order to allow interdependent changes to more than one class at the same time (a redefinition of class A can require a redefinition of class B).

        If a redefined method has active stack frames, those active frames continue to run the bytecodes of the original method. The redefined method will be used on new invokes.

        This method does not cause any initialization except that which would occur under the customary JVM semantics. In other words, redefining a class does not cause its initializers to be run. The values of static variables will remain as they were prior to the call.

        Instances of the redefined class are not affected.

        The redefinition may change method bodies, the constant pool and attributes. The redefinition must not add, remove or rename fields or methods, change the signatures of methods, or change inheritance. These restrictions maybe be lifted in future versions. The class file bytes are not checked, verified and installed until after the transformations have been applied, if the resultant bytes are in error this method will throw an exception.

        If this method throws an exception, no classes have been redefined.

        This method is intended for use in instrumentation, as described in the class specification.

        Parameters:

        definitions - array of classes to redefine with corresponding definitions; a zero-length array is allowed, in this case, this method does nothing

        Throws:

        UnmodifiableClassException - if a specified class cannot be modified (isModifiableClass(java.lang.Class<?>) would return false)

        UnsupportedOperationException - if the current configuration of the JVM does not allow redefinition (isRedefineClassesSupported() is false) or the redefinition attempted to make unsupported changes

        ClassFormatError - if the data did not contain a valid class

        NoClassDefFoundError - if the name in the class file is not equal to the name of the class

        UnsupportedClassVersionError - if the class file version numbers are not supported

        ClassCircularityError - if the new classes contain a circularity

        LinkageError - if a linkage error occurs

        NullPointerException - if the supplied definitions array or any of its components is null

        ClassNotFoundException - Can never be thrown (present for compatibility reasons only)

        See Also:

        isRedefineClassesSupported(), addTransformer(java.lang.instrument.ClassFileTransformer, boolean), ClassFileTransformer

      • getAllLoadedClasses

        Class[] getAllLoadedClasses()

        Returns an array of all classes currently loaded by the JVM.

        Returns:

        an array containing all the classes loaded by the JVM, zero-length if there are none

      • getInitiatedClasses

        Class[] getInitiatedClasses(ClassLoader loader)

        Returns an array of all classes for which loader is an initiating loader. If the supplied loader is null, classes initiated by the bootstrap class loader are returned.

        Parameters:

        loader - the loader whose initiated class list will be returned

        Returns:

        an array containing all the classes for which loader is an initiating loader, zero-length if there are none

      • getObjectSize

        long getObjectSize(Object objectToSize)

        Returns an implementation-specific approximation of the amount of storage consumed by the specified object. The result may include some or all of the object's overhead, and thus is useful for comparison within an implementation but not between implementations. The estimate may change during a single invocation of the JVM.

        Parameters:

        objectToSize - the object to size

        Returns:

        an implementation-specific approximation of the amount of storage consumed by the specified object

        Throws:

        NullPointerException - if the supplied Object is null.

      • appendToBootstrapClassLoaderSearch

        void appendToBootstrapClassLoaderSearch(JarFile jarfile)

        指定一个JAR文件,其中包含bootstrap class loader定义的instrument类。

        当虚拟机的内置类加载器(称为“bootstrap类加载器”)搜索一个类失败时,JAR文件中的条目也将被搜索。

        可以多次使用此方法来添加多个JAR文件,以便按照调用此方法的顺序进行搜索。

        代理应该注意确保JAR不包含任何类或资源,而不是引导类加载器为了插装而定义的类或资源。不遵守此警告可能导致难以诊断的意外行为。例如,假设有一个装入器L,L的委托父级是引导类装入器。此外,类C(由L定义的类)中的方法引用了非公共访问器类C$1。如果JAR文件包含一个C$1类,那么对引导类装入器的委托将导致引导类装入器定义C$1。在本例中,将抛出可能导致应用程序失败的IllegalAccessError。避免这些类型问题的一种方法是为插装类使用唯一的包名。

        JVM规范指定,后续尝试解析Java虚拟机以前尝试解析失败的符号引用时,总是会失败,并出现与初始解析尝试相同的错误。因此,如果JAR文件包含与Java虚拟机尝试解析引用失败的类对应的条目,则后续解析该引用的尝试将失败,并出现与初始尝试相同的错误。

      • Specifies a JAR file with instrumentation classes to be defined by the bootstrap class loader.

        When the virtual machine's built-in class loader, known as the "bootstrap class loader", unsuccessfully searches for a class, the entries in the JAR file will be searched as well.

        This method may be used multiple times to add multiple JAR files to be searched in the order that this method was invoked.

        The agent should take care to ensure that the JAR does not contain any classes or resources other than those to be defined by the bootstrap class loader for the purpose of instrumentation. Failure to observe this warning could result in unexpected behavior that is difficult to diagnose. For example, suppose there is a loader L, and L's parent for delegation is the bootstrap class loader. Furthermore, a method in class C, a class defined by L, makes reference to a non-public accessor class C$1. If the JAR file contains a class C$1 then the delegation to the bootstrap class loader will cause C$1 to be defined by the bootstrap class loader. In this example an IllegalAccessError will be thrown that may cause the application to fail. One approach to avoiding these types of issues, is to use a unique package name for the instrumentation classes.

        The Java™ Virtual Machine Specification specifies that a subsequent attempt to resolve a symbolic reference that the Java virtual machine has previously unsuccessfully attempted to resolve always fails with the same error that was thrown as a result of the initial resolution attempt. Consequently, if the JAR file contains an entry that corresponds to a class for which the Java virtual machine has unsuccessfully attempted to resolve a reference, then subsequent attempts to resolve that reference will fail with the same error as the initial attempt.

        Parameters:

        jarfile - The JAR file to be searched when the bootstrap class loader unsuccessfully searches for a class.

        Throws:

        NullPointerException - If jarfile is null.

        Since:

        1.6

        See Also:

        appendToSystemClassLoaderSearch(java.util.jar.JarFile), ClassLoader, JarFile

      • appendToSystemClassLoaderSearch

        void appendToSystemClassLoaderSearch(JarFile jarfile)
        Specifies a JAR file with instrumentation classes to be defined by the system class loader. When the system class loader for delegation (see getSystemClassLoader()) unsuccessfully searches for a class, the entries in the JarFile will be searched as well.

        This method may be used multiple times to add multiple JAR files to be searched in the order that this method was invoked.

        The agent should take care to ensure that the JAR does not contain any classes or resources other than those to be defined by the system class loader for the purpose of instrumentation. Failure to observe this warning could result in unexpected behavior that is difficult to diagnose (see appendToBootstrapClassLoaderSearch).

        The system class loader supports adding a JAR file to be searched if it implements a method named appendToClassPathForInstrumentation which takes a single parameter of type java.lang.String. The method is not required to have public access. The name of the JAR file is obtained by invoking the getName() method on the jarfile and this is provided as the parameter to the appendToClassPathForInstrumentation method.

        The Java™ Virtual Machine Specification specifies that a subsequent attempt to resolve a symbolic reference that the Java virtual machine has previously unsuccessfully attempted to resolve always fails with the same error that was thrown as a result of the initial resolution attempt. Consequently, if the JAR file contains an entry that corresponds to a class for which the Java virtual machine has unsuccessfully attempted to resolve a reference, then subsequent attempts to resolve that reference will fail with the same error as the initial attempt.

        This method does not change the value of java.class.path system property.

        Parameters:

        jarfile - The JAR file to be searched when the system class loader unsuccessfully searches for a class.

        Throws:

        UnsupportedOperationException - If the system class loader does not support appending a a JAR file to be searched.

        NullPointerException - If jarfile is null.

        Since:

        1.6

        See Also:

        appendToBootstrapClassLoaderSearch(java.util.jar.JarFile), ClassLoader.getSystemClassLoader(), JarFile

      • isNativeMethodPrefixSupported

        boolean isNativeMethodPrefixSupported()

        Returns whether the current JVM configuration supports setting a native method prefix. The ability to set a native method prefix is an optional capability of a JVM. Setting a native method prefix will only be supported if the Can-Set-Native-Method-Prefix manifest attribute is set to true in the agent JAR file (as described in the package specification) and the JVM supports this capability. During a single instantiation of a single JVM, multiple calls to this method will always return the same answer.

        Returns:

        true if the current JVM configuration supports setting a native method prefix, false if not.

        Since:

        1.6

        See Also:

        setNativeMethodPrefix(java.lang.instrument.ClassFileTransformer, java.lang.String)

      • setNativeMethodPrefix

        void setNativeMethodPrefix(ClassFileTransformer transformer,
                                   String prefix)
        This method modifies the failure handling of native method resolution by allowing retry with a prefix applied to the name. When used with the ClassFileTransformer, it enables native methods to be instrumented.

        Since native methods cannot be directly instrumented (they have no bytecodes), they must be wrapped with a non-native method which can be instrumented. For example, if we had:

           native boolean foo(int x);

        We could transform the class file (with the ClassFileTransformer during the initial definition of the class) so that this becomes:

           boolean foo(int x) {
             ... record entry to foo ...
             return wrapped_foo(x);
           }
        
           native boolean wrapped_foo(int x);

        Where foo becomes a wrapper for the actual native method with the appended prefix "wrapped_". Note that "wrapped_" would be a poor choice of prefix since it might conceivably form the name of an existing method thus something like "$$$MyAgentWrapped$$$_" would be better but would make these examples less readable.

        The wrapper will allow data to be collected on the native method call, but now the problem becomes linking up the wrapped method with the native implementation. That is, the method wrapped_foo needs to be resolved to the native implementation of foo, which might be:

           Java_somePackage_someClass_foo(JNIEnv* env, jint x)

        This function allows the prefix to be specified and the proper resolution to occur. Specifically, when the standard resolution fails, the resolution is retried taking the prefix into consideration. There are two ways that resolution occurs, explicit resolution with the JNI function RegisterNatives and the normal automatic resolution. For RegisterNatives, the JVM will attempt this association:

        
           method(foo) -> nativeImplementation(foo)
         

        When this fails, the resolution will be retried with the specified prefix prepended to the method name, yielding the correct resolution:

        
           method(wrapped_foo) -> nativeImplementation(foo)
         

        For automatic resolution, the JVM will attempt:

        
           method(wrapped_foo) -> nativeImplementation(wrapped_foo)
         

        When this fails, the resolution will be retried with the specified prefix deleted from the implementation name, yielding the correct resolution:

        
           method(wrapped_foo) -> nativeImplementation(foo)
         

        Note that since the prefix is only used when standard resolution fails, native methods can be wrapped selectively.

        Since each ClassFileTransformer can do its own transformation of the bytecodes, more than one layer of wrappers may be applied. Thus each transformer needs its own prefix. Since transformations are applied in order, the prefixes, if applied, will be applied in the same order (see addTransformer). Thus if three transformers applied wrappers, foo might become $trans3_$trans2_$trans1_foo. But if, say, the second transformer did not apply a wrapper to foo it would be just $trans3_$trans1_foo. To be able to efficiently determine the sequence of prefixes, an intermediate prefix is only applied if its non-native wrapper exists. Thus, in the last example, even though $trans1_foo is not a native method, the $trans1_ prefix is applied since $trans1_foo exists.

        Parameters:

        transformer - The ClassFileTransformer which wraps using this prefix.

        prefix - The prefix to apply to wrapped native methods when retrying a failed native method resolution. If prefix is either null or the empty string, then failed native method resolutions are not retried for this transformer.

        Throws:

        NullPointerException - if passed a null transformer.

        UnsupportedOperationException - if the current configuration of the JVM does not allow setting a native method prefix (isNativeMethodPrefixSupported() is false).

        IllegalArgumentException - if the transformer is not registered (see addTransformer).

        Since:

        1.6

一起玩转GNU Radio:调制解调大合集 本文汇总了GNU Radio中多种常见的调制解调方法及其参考文献链接,便于今后查看,供大家参考! 阅读详情

相关推荐

[LaTeX] 使用natbib宏包实现参考文献的“作者-年份”引用格式及常见编译错误排查

本文详细介绍了在LaTeX中使用natbib宏包实现参考文献“作者-年份”引用格式的完整流程。从宏包配置、.bib文件准备到标准编译步骤,重点解析了常见的“Bibliography not compatible with author-year”错误成因,并提供了彻底清理辅助文件等解决方案,帮助用户高效排版符合学术规范的参考文献。

moon9的博客 481

java.lang.instument包超详解

Java5之后,增加了一个包java.lang.instrument,这个包的东西很少,两个接口,ClassFileTransformer和Instrumentation,一个类ClassDefinition,还有两个Exception:IllegalClassFormatException和UnmodifiableClassException; 先看一下这个包的描述吧,下面是JavaDoc的

来啊 快活啊 4739

模仿学习与强化学习结合(IL+RL)有没有代表性论文?未来发展趋势如何?

IL与RL的结合正成为AI研究热点,尤其在机器人控制、复杂博弈等需要边学边练的场景。经典方法如Dagger(2010)和GAIL(2016)开创了先用模仿学习预热、再用强化学习微调的模式。近期工作如IN-RIL(2024)提出交替训练策略,显著提升样本效率。开源项目RoboSchool和StableBaselines3为相关研究提供支持。未来趋势包括:1)混合式智能体结合人类经验与自主探索;2)突破小样本学习、自然语言交互等方向;3)提升安全性、样本效率和可解释性。

CyberSoma的博客 2248

Java SE 6 新特性: Instrumentation 新功能

2006 年底,Sun 公司发布了 Java Standard Edition 6(Java SE 6)的最终正式版,代号 Mustang(野马)。跟 Tiger(Java SE 5)相比,Mustang 在性能方面有了不错的提升。与 Tiger 在 API 库方面的大幅度加强相比,虽然 Mustang 在 API 库方面的新特性显得不太多,但是也提供了许多实用和方便的功能:在脚本,WebServ...

weixin_30773135的博客 319

基于企业微信客服与GPT-3构建合规微信AI助手:从原理到部署实践

在人工智能与即时通讯融合的浪潮中,自然语言处理(NLP)与API集成成为构建智能对话系统的核心技术。其原理在于通过API网关接收用户输入,调用云端大语言模型进行处理,再将结果返回给用户,实现自动化交互。这项技术的核心价值在于将前沿AI能力无缝嵌入到日常高频应用场景中,极大地提升了客服自动化、智能问答与个性化服务的效率与体验。企业微信作为官方认可的企服平台,其开放的客服API接口为开发者提供了稳定、合规的消息通道,是连接微信生态与外部AI服务的理想桥梁。本文聚焦于如何利用企业微信客服API与OpenAI的GP

weixin_28727943的博客 627

【图像去噪】论文复现:CLIP用于图像去噪提升泛化性!CLIPDenoising的Pytorch源码复现,跑通CLIPDenoising全流程,图文结合,网络结构梳理和拆解,对应源码注释!

论文题目:Transfer CLIP for Generalizable Image Denoising —— 用于可泛化图像去噪的转移CLIP。【图像去噪】论文精读:Transfer CLIP for Generalizable Image Denoising(CLIPDenoising)CLIPDenoising理论部分详解见上面对应的论文精读,本文以源码为主,理论部分只是粗略回顾。启发:多看其他领域的文章,分析是否能应用在去噪领域,这是产生idea的要素之一;

主要更新底层视觉(去噪、超分等)相关的科研内容,形式为【论文精读】+【论文复现】 1412

Java的Instrumentation类原理分析

利用 java.lang.instrument 做动态 Instrumentation 是 Java SE 5 的新特性,它把 Java 的 instrument 功能从本地代码中解放出来,使之可以用 Java 代码的方式解决问题。使用 Instrumentation,开发者可以构建一个独立于应用程序的代理程序(Agent),用来监测和协助运行在 JVM 上的程序,甚至能够替换和修改某些类的定义。

JavaEdge全是干货的技术号 4130

【实战篇】【硅基流动API+Cherry Studio搭建个人知识库全流程解析:从零到精通的超详细指南】

在人工智能技术高速发展的今天,基于大语言模型的知识库已成为开发者提效的必备工具。然而云端服务存在响应延迟、数据隐私、硬件依赖等痛点。通过硅基流动API与的深度整合,我们既能享受大模型的强大能力,又能实现本地化部署与高效管理。本文将从环境配置到高阶调优,手把手带你构建企业级知识库系统。

商务合作|问题讨论|交流学习 请联系作者微信,加微信请务必注明来意,博客主页有联系方式 1082

Java性能监控系列——java.lang.instrument

Instrumentation是Java5提供的新特性。使用Instrumentation,开发者可以构建一个代理,用来监测运行在JVM上的程序。监测一般是通过在执行某个类文件之前,对该类文件的字节码进行适当的修改进行的。        java.lang.instrument中需要关注的是ClassFileTransformer和Instrumentation接口。每个代理类必须实现 Clas

看看写写,记录所学,权当笔记の 3827

【AI Agent系列】【MetaGPT】9. 一句话订阅专属信息 - 订阅智能体进阶,实现一个更通用的订阅智能体(2)

订阅智能体进阶(2)。不用爬虫,直接提取网页信息。从RunSubscription分离出AddSubscriptionTask的action,并且让SubscriptionRunner单独运行。

同学小张的博客 1587

【WorkBuddy专栏19】技能的创造与迁移——从零开始打造你的AI工作流

【WorkBuddy专栏19】技能的创造与迁移——从零开始打造你的AI工作流

AI人人懂 369

Java Instrumentation 原理

JDK从1.5版本开始引入了java.lang.instrument包,开发者可以更方便的实现字节码增强。其核心功能由java.lang.instrument.Instrumentation提供,这个接口的方法提供了注册类文件转换器、获取所有已加载的类等功能,允许我们在对已加载和未加载的类进行修改,实现AOP、性能监控等功能。Instrumentation接口的常用方法如下所示。

程序员野蛮成长 609

【产品】 产品设计:ID设计和MD设计详解

1、ID(Industry Design)工业设计 包含外观、材质、手感、颜色配搭,主要界面的实现与及色彩等方面的设计。 2、MD(Mechanical Design)结构设计 以手机为例: 前壳、后壳、手机的摄像镜头位置的选择、固定的方式、电池如何连接和手机的厚薄程度等。 如果是滑盖手机,如何让手机滑上去,怎样实现自动往上弹,SIM卡怎样插和拔的安排,这些都是手机结构设计的范畴。 繁...

产品线负责人 3万+

Java动态追踪技术探究

引子 在遥远的希艾斯星球爪哇国塞沃城中,两名年轻的程序员正在为一件事情苦恼,程序出问题了,一时看不出问题出在哪里,于是有了以下对话: “Debug一下吧。” “线上机器,没开Debug端口。” “看日志,看看请求值和返回值分别是什么?” “那段代码没打印日志。” “改代码,加日志,重新发布一次。” “怀疑是线程池的问题,重启会破坏现场。” 长达几十秒的沉默之后:“据说,排查问题的最高境界,就是只通...

美团技术团队 3252

Devexpress16.2.6破解工具

Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具

温度PID控制PLC程序

温度PID稳定控制程序,适用于欧姆龙PLC,对其他PLC也具有很大参考价值

java动态追踪技术

同步发表于:http://blog.lanjingdejia.com/articles/2019/01/02/1546398000734.html 引子 在遥远的希艾斯星球爪哇国塞沃城中,两名年轻的程序员正在为一件事情苦恼,程序出问题了,一时看不出问题出在哪里,于是有了以下对话: “debug一下吧” “线上机器,没开debug端口” “看日志,看看请求值和返回值分别是什么” “那段代码没打印日...

xinzhongtianxia的博客 2052

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

java技术_Java动态追踪技术那点事

在排查软件程序故障的过程中,程序员们通常是崩溃的。因为往往根据已有各种日志信息,系统信息排查不到根本的原因,而我们又不能在现网中重启服务,上传新的软件包来帮助排查问题(在线的服务是不能中断的情况)。我们以Java语言为例,来了解一下动态追踪那点事。从事过Java编程久一些的程序员,大都有了解或者使用过JSP,回想一下,为什么JSP写的代码就不需要重启JVM呢?让我们先来看看JSP的运行原理:当我们...

weixin_39766910的博客 205

数学建模模型总结

这是本人在两年内准备参加数学建模竞赛搜集到的模型资料,已经经过了本人的筛选和整理,希望能够对准备参加数学建模竞赛的学弟学妹们提供一些帮助!

Java Agent内存马攻防解析:从JVM机制到实战检测

Java Agent是JVM提供的合法监控与诊断机制,它通过Instrumentation接口实现类字节码的动态修改,这一特性在应用性能监控、热部署等场景中具有重要价值。然而,攻击者利用该机制,结合内存马技术,可在目标应用的运行时内存中植入无文件后门,实现高度隐蔽的持久化攻击。内存马通过动态注册Filter、Servlet等组件,并采用加密通信绕过传统安全检测,对Web应用安全构成严重威胁。本文以Agenst和vagent等工具为例,深入剖析Java Agent与内存马结合的技术原理,涵盖JVM类加载机制、

weixin_30394981的博客 412

java技术_Java动态追踪技术探究

在遥远的希艾斯星球爪哇国塞沃城中,两名年轻的程序员正在为一件事情苦恼,程序出问题了,一时看不出问题出在哪里,于是有了以下对话:“Debug一下吧。”“线上机器,没开Debug端口。”“看日志,看看请求值和返回值分别是什么?”“那段代码没打印日志。”“改代码,加日志,重新发布一次。”“怀疑是线程池的问题,重启会破坏现场。”长达几十秒的沉默之后:“据说,排查问题的最高境界,就是只通过Review代码来...

weixin_39724382的博客 102

动态污点分析实战:从原理到Java漏洞挖掘工具搭建

数据流分析是理解软件行为和安全风险的基础技术,它通过追踪数据在程序中的传播路径来识别潜在问题。其核心原理在于标记不可信输入源,并监控数据在运算、传递过程中的流向,最终判断是否触及敏感操作点。这项技术的核心价值在于能将复杂的安全漏洞检测转化为可自动化追踪的数据流问题,极大提升了漏洞挖掘的效率和精度。在应用场景上,它广泛适用于Web安全审计、软件供应链检测以及自动化渗透测试等领域。本文聚焦于动态污点分析这一实现技术,深入剖析其作为自动化漏洞挖掘利器的实现机制,并详细演示如何构建针对Java Web应用的插桩探针

weixin_34072458的博客 372

深入JMX:从核心架构到生产实践,构建Java应用监控与管理能力

在Java应用监控与性能调优领域,JMX(Java Management Extensions)作为一套标准的管理和监控架构,扮演着至关重要的角色。其核心原理基于三层架构模型,通过Instrumentation层暴露MBean(管理构件),由Agent层的MBean Server进行统一管理,再经由Distributed Services层供外部工具访问,实现了对应用内部状态的深度洞察与运行时控制。这项技术的核心价值在于提供了标准的“不停机运维”能力,允许开发者动态调整配置、执行特定操作并监控关键指标,从而

weixin_30571465的博客 430

一篇文章带你揭开 Java Instrumentation 的原理

文章目录一、前言二、热部署初识三、Java Instrumentation四、Java Instrumentation 静态代码示例五、Java Agent 示例 —— attach的使用 一、前言 日常开发中避免不了,修改了代码重新启动应用去验证问题,如果没有热部署,则需要每次修改完就去编译代码再启动,这样子的操作看似简单, 但很耗时,特别电脑配置不高,或者项目比较大的情况 二、热部署初识 热部署其实就是在代码运行时去加载我们动态现在修改过的代码到服务器上,诸如 SpringBoot的devtools插

啊狸的Java的博客 2162

java.lang.instrument笔记

什么是Instrumentation? java Instrumentation指的是可以用独立于应用程序之外的代理(agent)程序来监测和协助运行在JVM上的应用程序。这种监测和协助包括但不限于获取JVM运行时状态,替换和修改类定义等。 Java SE5中使用JVM TI替代了JVM PI和JVM DI。提供一套代理机制,支持独立于JVM应用程序之外的程序以代理的方式连接和访问JVM。j...

iteye_5347的博客 648

字节码进阶之java Instrumentation原理详解

Java Instrumentation是Java API的一部分,它允许开发人员在运行时修改类的字节码。使用此功能,可以实现许多高级操作,例如性能监控、代码覆盖率分析等。通过Java提供的Instrumentation接口,我们能够在运行时改变和监控Java程序,这种能力在许多场景中都非常有用,比如性能调优、故障排查、代码覆盖率分析等。然而,Instrumentation接口的使用和字节码操作本身都是高级主题,需要深入理解JVM和字节码的工作原理。

日拱一卒无有尽,功不唐捐终入海 2280
上一篇: 我爱这个世界
ProLayman
博客等级 码龄10年 105粉丝 192原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值