transmittable-thread-local | 📌 TransmittableThreadLocal , the missing Java™ std | Architecture library

 by   alibaba Java Version: 2.14.3 License: Apache-2.0

kandi X-RAY | transmittable-thread-local Summary

kandi X-RAY | transmittable-thread-local Summary

transmittable-thread-local is a Java library typically used in Architecture applications. transmittable-thread-local has no bugs, it has no vulnerabilities, it has build file available, it has a Permissive License and it has medium support. You can download it from GitHub, Maven.

English Documentation | 中文文档.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              transmittable-thread-local has a medium active ecosystem.
              It has 6490 star(s) with 1594 fork(s). There are 271 watchers for this library.
              OutlinedDot
              It had no major release in the last 12 months.
              There are 20 open issues and 233 have been closed. On average issues are closed in 390 days. There are 2 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of transmittable-thread-local is 2.14.3

            kandi-Quality Quality

              transmittable-thread-local has no bugs reported.

            kandi-Security Security

              transmittable-thread-local has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.

            kandi-License License

              transmittable-thread-local is licensed under the Apache-2.0 License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              transmittable-thread-local releases are available to install and integrate.
              Deployable package is available in Maven.
              Build file is available. You can build the component from source.
              Installation instructions are not available. Examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of transmittable-thread-local
            Get all kandi verified functions for this library.

            transmittable-thread-local Key Features

            No Key Features are available at this moment for transmittable-thread-local.

            transmittable-thread-local Examples and Code Snippets

            No Code Snippets are available at this moment for transmittable-thread-local.

            Community Discussions

            Trending Discussions on transmittable-thread-local

            QUESTION

            Classpath problems while Instrumenting Springboot application
            Asked 2020-Feb-17 at 21:43

            I have a springboot application which I'm trying to instrument using bytebuddy. I'm running into classpath issues which I'm not able to understand.

            Firstly, the following is other literature on this:

            https://github.com/raphw/byte-buddy/issues/473

            https://github.com/raphw/byte-buddy/issues/87

            Unable to instrument apache httpclient using javaagent for spring boot uber jar application

            https://github.com/raphw/byte-buddy/issues/109

            https://github.com/raphw/byte-buddy/issues/473

            https://github.com/raphw/byte-buddy/issues/489

            https://github.com/spring-projects/spring-boot/issues/4868

            https://github.com/alibaba/transmittable-thread-local/issues/161

            Problem is that Spring-boot bundles the application into one uber-jar, which contains other jars inside it

            A thing to note here is, that if I run the application using IntelliJ, it doesn't use the uber-jar and runs via main class with a bunch of jars as classpath arguments.

            Due to this difference, When running via uber-jar(java -jar target/demo-0.0.1-SNAPSHOT.jar), some classes are not available at the time the Agent runs. The classes are loadable at the time of application main, as spring-boot uses its own classloader, which is created at some time b/w agent and application main methods.

            I'll describe the behaviour at various points of time below:

            At time of PreMain of Agent
            • Thread.currentThread().getContextClassLoader() = Launcher$AppClassLoader
            • Agent.class.classLoader = Launcher$AppClassLoader
            • Class.forName("org.springframework.web.servlet.HandlerAdapter") => ClassNotFoundException
            • Class.forName("javax.servlet.http.HttpServletRequest") => ClassNotFoundException

            Both spring and javax classes are not loaded as they are not directly in the classpath as per the App Classloader. It's part of an inner jar, something like app.jar!/BOOT-INF/lib/some.jar App Classloader won't be able to load this.

            At time of Main of Application Class
            • Thread.currentThread().getContextClassLoader() = org.springframework.boot.loader.LaunchedURLClassLoader
            • DemoApplication.class.classloader = same as above
            • Class.forName("org.springframework.web.servlet.HandlerAdapter") => loads successfully
            • Same for javax class, loads successfully.

            After loading, Class.forName("javax.servlet.http.HttpServletRequest").classLoader is also the same LaunchedURLClassLoader.

            At the time of builder.visit call (when bytebuddy is modifying the class definitions) Code:

            I have two classes, SpringBootInterceptor (which contains the intercept method) and SpringBootInterceptorOne (which contains the entry and exit method)

            ...

            ANSWER

            Answered 2020-Feb-17 at 21:43

            The problem is that the advice class will be loaded on the system class loader as a part of the agent whereas the actual application code is loaded on a sub-class loader that is not visible to the system class loader. This situation does not change if you load your agent on the boot loader either. Therefore, the agent cannot load the HttpServletRequest class which is part of the uber-jar.

            This is a typical problem with agents and Byte Buddy has a standard way to circumvent it by using a Transformer.ForAdvice instance instead of using the Advice class directly. Byte Buddy then creates a virtual class loader hierarchy that considers classes represented by both class loaders.

            Update: The problem is that you are calling down to your interceptor that is defined in the system class loader where the class in question is not available. The annotated code will be inlined but the invoked method will not. If you copy-pasted the code into the annotated method, the behavior is as you'd expect it. Byte Buddy uses the annotated code as template and reuses a lot of information emitted by javac to guarantee a speedy conversion. Therefore, the library cannot simply copy the method and should rather feed the entire method body to javac.

            Source https://stackoverflow.com/questions/60237664

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install transmittable-thread-local

            You can download it from GitHub, Maven.
            You can use transmittable-thread-local like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the transmittable-thread-local component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            Install
            Maven
            Gradle
            CLONE
          • HTTPS

            https://github.com/alibaba/transmittable-thread-local.git

          • CLI

            gh repo clone alibaba/transmittable-thread-local

          • sshUrl

            git@github.com:alibaba/transmittable-thread-local.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link