You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
arthas/assets/mc.html.163bbc1b.js

9 lines
3.1 KiB
JavaScript

3 years ago
import{_ as i,o as l,c as d,a as e,b as a,w as o,e as s,d as r,r as t}from"./app.391b0e4e.js";const m={},p=e("h1",{id:"mc",tabindex:"-1"},[e("a",{class:"header-anchor",href:"#mc","aria-hidden":"true"},"#"),s(" mc")],-1),u={href:"https://arthas.aliyun.com/doc/arthas-tutorials?language=en&id=command-mc-retransform",target:"_blank",rel:"noopener noreferrer"},h=e("code",null,"mc-retransform",-1),_=s(" online tutorial"),v=r(`<div class="custom-container tip"><p class="custom-container-title">TIP</p><p>Memory compiler, compiles <code>.java</code> files into <code>.class</code> files in memory.</p></div><div class="language-bash ext-sh line-numbers-mode"><pre class="language-bash"><code><span class="token function">mc</span> /tmp/Test.java
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><p>The classloader can be specified with the <code>-c</code> option:</p><div class="language-bash ext-sh line-numbers-mode"><pre class="language-bash"><code><span class="token function">mc</span> -c 327a647b /tmp/Test.java
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div><p>You can also specify the ClassLoader with the <code>--classLoaderClass</code> option:</p><div class="language-bash ext-sh line-numbers-mode"><pre class="language-bash"><code>$ <span class="token function">mc</span> --classLoaderClass org.springframework.boot.loader.LaunchedURLClassLoader /tmp/UserController.java -d /tmp
Memory compiler output:
/tmp/com/example/demo/arthas/user/UserController.class
Affect<span class="token punctuation">(</span>row-cnt:1<span class="token punctuation">)</span> cost <span class="token keyword">in</span> <span class="token number">346</span> ms
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div><div class="line-number"></div></div></div><p>The output directory can be specified with the <code>-d</code> option:</p><div class="language-bash ext-sh line-numbers-mode"><pre class="language-bash"><code><span class="token function">mc</span> -d /tmp/output /tmp/ClassA.java /tmp/ClassB.java
</code></pre><div class="line-numbers" aria-hidden="true"><div class="line-number"></div></div></div>`,8),f=s("After compiling the "),b=e("code",null,".class",-1),g=s(" file, you can use the "),k=s("retransform"),x=s(" command to re-define the loaded classes in JVM."),y={class:"custom-container warning"},C=e("p",{class:"custom-container-title"},"WARNING",-1),L=s("Note that the mc command may fail. If the compilation fails, the "),w=e("code",null,".class",-1),N=s(" file can be compiled locally and uploaded to the server. Refer to the "),j=s("retransform"),T=s(" command description for details.");function I(R,V){const c=t("ExternalLinkIcon"),n=t("RouterLink");return l(),d("div",null,[p,e("p",null,[e("a",u,[h,_,a(c)])]),v,e("p",null,[f,b,g,a(n,{to:"/en/doc/retransform.html"},{default:o(()=>[k]),_:1}),x]),e("div",y,[C,e("p",null,[L,w,N,a(n,{to:"/en/doc/retransform.html"},{default:o(()=>[j]),_:1}),T])])])}var B=i(m,[["render",I],["__file","mc.html.vue"]]);export{B as default};