Compiler Extension

Compiler Extension

Extension Description

Java code compiler for dynamically generating bytecode to accelerate calls.

Extension Interface

org.apache.dubbo.common.compiler.Compiler

Extension Configuration

Automatically loaded

Known Extensions

  • org.apache.dubbo.common.compiler.support.JdkCompiler
  • org.apache.dubbo.common.compiler.support.JavassistCompiler

Extension Example

Maven project structure:

  1. src
  2. |-main
  3. |-java
  4. |-com
  5. |-xxx
  6. |-XxxCompiler.java (implements Compiler interface)
  7. |-resources
  8. |-META-INF
  9. |-dubbo
  10. |-org.apache.dubbo.common.compiler.Compiler (text file containing: xxx=com.xxx.XxxCompiler)

XxxCompiler.java:

  1. package com.xxx;
  2. import org.apache.dubbo.common.compiler.Compiler;
  3. public class XxxCompiler implements Compiler {
  4. public Object getExtension(Class<?> type, String name) {
  5. // ...
  6. }
  7. }

META-INF/dubbo/org.apache.dubbo.common.compiler.Compiler:

  1. xxx=com.xxx.XxxCompiler

Feedback

Was this page helpful?

Yes No

Last modified September 30, 2024: Update & Translate Overview Docs (#3040) (d37ebceaea7)