zoukankan      html  css  js  c++  java
  • java 服务器热更新 :Arthas

    Arthas 是Alibaba开源的Java诊断工具,深受开发者喜爱。

    当你遇到以下类似问题而束手无策时,Arthas可以帮助你解决:

    1. 这个类从哪个 jar 包加载的?为什么会报各种类相关的 Exception?

    2. 我改的代码为什么没有执行到?难道是我没 commit?分支搞错了?

    3. 遇到问题无法在线上 debug,难道只能通过加日志再重新发布吗?

    4. 线上遇到某个用户的数据处理有问题,但线上同样无法 debug,线下无法重现!

    5. 是否有一个全局视角来查看系统的运行状况?

    6. 有什么办法可以监控到JVM的实时运行状态?

    1. 下载

    curl -O https://alibaba.github.io/arthas/arthas-boot.jar
    

    2.启动

    java -jar arthas-boot.jar
    

    然后选择我们需要热更新的JVM进程

    3.sc查找加载UserController的ClassLoader

    sc -d *UserServiceImpl | grep classLoaderHash
    

    4.使用 mc 命令编译修改保存的源代码,生成最终 class 文件

    mc -c 33909752 /tmp/UserServiceImpl.java -d /tmp
    

    5.redefine 热更新代码

    redefine /tmp/com/dxx/game/modules/user/service/impl/UserServiceImpl.class
    

    热更新存在一些限制

    并不是所有改动热更新都将会成功,还是存在一些限制。我们仅只能修改方法内部逻辑,属性值等,不能添加,删除方法或字段,也不能更改方法的签名或继承关系。

  • 相关阅读:
    some tips
    ORA00847: MEMORY_TARGET/MEMORY_MAX_TARGET and LOCK_SGA cannot be set together
    Chapter 01Overview of Oracle 9i Database Perfomrmance Tuning
    Chapter 02Diagnostic and Tuning Tools
    变量与常用符号
    Chapter 18Tuning the Operating System
    标准输入输出
    Trace files
    DBADeveloped Tools
    Chapter 03Database Configuration and IO Issues
  • 原文地址:https://www.cnblogs.com/gouge/p/13178781.html
Copyright © 2011-2022 走看看