JAVA代码热部署,在线不停服动态更新
本地debug的时候,可以实时编译并更新代码,线上也可以不停服来动态更新类,即所说的java热部署。
1
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
public class JavaAgent {
public static final Logger logger = LoggerFactory.getLogger(JavaAgent.class); private static String classesPath; static { // 当前进程pid /** File file = new File(filePath); filePath = file.getAbsolutePath();//得到windows下的正确路径 private static void init() throws IOException, AttachNotSupportedException, AgentLoadException, AgentInitializationException { Instrumentation instrumentation = JavaDynAgent.getInstrumentation(); private static void destroy() throws IOException { /** try { public static void main(String[] args) throws Exception { javaAgent(null, new String[] {"com.agileeagle.webgame.framework.util.PortUtil"}); PortUtil.test(); |
1
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
public class JavaDynAgent {
private static Instrumentation instrumentation; private static Object lockObject = new Object(); public JavaDynAgent() { public static void agentmain(String args, Instrumentation inst) { } public static Instrumentation getInstrumentation() { |
最新文章
- Tomcat启动失败Unrecognized Windows Sockets error: 0: JVM_Bind
- make things simple
- 传输层(2)-TCP连接的建立和终止、TIME_WAIT状态
- [源码]RandomId 生成随机字符串
- C# 7.0 新特性4: 返回引用
- mysql体系结构
- sql like in 语句获取以逗号分割的字段内的数据
- Hibernate的关系配置
- 托管服务帐号(Managed Service Account)
- YAHOO 34 条前端优化建议
- JVM学习笔记一:内存管理
- ROS零门槛学渣教程系列(二)——Linux常用指令:mkdir、tar、 unzip、cp、scp、mv、rm、find、apt、ssh
- 搞懂Xamarin.Forms布局,看这篇应该就够了吧
- ASP.NET 管道
- 09-babel
- web网页测试用例(非常实用)
- Java并发编程(十一)-- Java中的锁详解
- Python列表的一点用法
- synchronized 和 lock 的区别
- noip第1课资料