In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article is to share with you about how to carry out source code analysis Detect, the editor feels very practical, so share it with you to learn, I hope you can get something after reading this article, say no more, follow the editor to have a look.
Detect
The contents of the buildpack probe include: container, JRE, framework. The details can be seen in components.yml:
# Configuration for components to use in the buildpack---containers:- "JavaBuildpack::Container::DistZip"-"JavaBuildpack::Container::Groovy"-"JavaBuildpack::Container::JavaMain"-"JavaBuildpack::Container::PlayFramework"-"JavaBuildpack::Container::Ratpack"-"JavaBuildpack::Container::SpringBoot"-"JavaBuildpack::Container::SpringBootCLI"-"JavaBuildpack::Container::Tomcat" # In order to use Oracle JREs instead of OpenJDK You must comment out the OpenJDK line and uncomment the Oracle line.# Please see the documentation for more detail.jres:- "JavaBuildpack::Jre::OpenJdkJRE" #-"JavaBuildpack::Jre::OracleJRE" frameworks:- "JavaBuildpack::Framework::AppDynamicsAgent"-"JavaBuildpack::Framework::JavaOpts"-"JavaBuildpack::Framework::MariaDbJDBC"-"JavaBuildpack::Framework::NewRelicAgent"-"JavaBuildpack::Framework::PlayFrameworkAutoReconfiguration"-"JavaBuildpack::Framework::PlayFrameworkJPAPlugin"-"JavaBuildpack :: Framework::PostgresqlJDBC "-" JavaBuildpack::Framework::SpringAutoReconfiguration "-" JavaBuildpack::Framework::SpringInsight "
From this file, you can know the containers, JRE and frameworks supported by the buidpack. Of course you can add it yourself.
The entry to detect is bin/detect, which is a very simple script that calls the with_buildpack static method of JavaBuildpack to create an instance, and then calls the JavaBuildpack.detect method in the code block. Finally, the result of the detect is composed into a string output, and if the probe is not correct, nothing is output.
Components = JavaBuildpack::Buildpack.with_buildpack (build_dir, 'Detect failed with exception% s') do | buildpack | # here with_buildpack creates an instance of JavaBuildpack::Buildpack. You can see buildpack.detectend.compact by viewing buildpack.rb.
Next, look at the JavaBuildpack::Buildpack class, in buildpack.rb.
With_buildpack method
It's in class e handle_error (e, message) end
Pay special attention to the sentence in which the annotation is added with * *, the grammar is relatively roundabout.
Detect method
The detect method detects the container, JRE and framework used by the application respectively.
Def detect tags = tag_detection ('container', @ containers, true) tags.concat tag_detection (' JRE', @ jres, true) unless tags.empty? # if not empty, connect to tags tags.concat tag_detection ('framework', @ frameworks, false) unless tags.empty? Tags
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.