Advanced Code Hot Swapping in JDK 8?
Asked Answered
R

2

28

I am looking for better HotSwapping in the JavaVM. Being able to only apply method body changes is okay but quite limiting.

The options available is JRebel and a discontinued project called Dynamic Code Evolution Virtual Machine (DCEVM).

There is a JEP 159 out there that was written by the core developper of DCEVM. A blog post from 2011 mentioned that the developers of DCEVM now work for Oracle to integrate this into the JDK.

Do we have this kind of support for JDK 8 beta already or was it postponed to JDK 9?

I need hot swapping for adding and removing and renaming private methods mostly. This would help alot. Is there a product allowing me to do so (beside JRebel which PR-campaigns got me upset).

The last supported version of DCEVM is for 1.6u24 and it only provides 32-bit linux binaries. Since I use 1.7 and 64bit Linux this is both a show stopper for me.

There is also another project available on github called Fakereplace. Can this be easily used for my purpose or should I not investigate into this?

Rehabilitation answered 28/11, 2013 at 9:51 Comment(1)
One of the JRebel developers once did a little overview of different code swap solutions on the market - https://mcmap.net/q/504634/-what-are-the-differences-between-the-various-java-plugins-for-hot-class-reloading-and-which-one-is-the-most-intuitive In my personal opinion JRebel gets the work done very well, no competitor can come close at the moment. Not using a tool only because You dislike their marketing is probably although the tool itself is top quality, is mainly hurting Yourself.Mylander
G
12

JEPs coming in JDK 8 and JDK 9 are listed in this page. JEP-159 is not among them. From jep index you can see that JEP-159 is not yet targeted to any JDK release, not even jdk 10.

JEP-159 status is currently "Submitted". The process is described as follows:

A successful JEP passes through the following states:

  • Draft — In circulation by the author for initial review and consensus-building
  • Posted — Entered into the JEP Archive by the author for wider review
  • Submitted — Declared by the author to be ready for evaluation
  • Candidate — Accepted for inclusion in the Roadmap by the OpenJDK Lead
  • Funded — Judged by a Group or Area Lead to be fully funded
  • Completed — Finished and delivered

So it's not yet accepted for any roadmap.

Gillette answered 28/11, 2013 at 10:20 Comment(3)
That's why I wonder if there is a pre-alpha version or something comparable available. The DCEVM project was quite evolved so I wonder why there is no 1.7 version and have hoped for a 1.8 version.Rehabilitation
@MartinKersten I don't see how there would be any pre-alpha-version available since it hasn't even been included into any scope, at least yet.Gillette
I hoped for something like a fragment one can install and run. Seeing the DCEVM version was working for JDK6 and those people hired by Oracle for two years now, I hoped for something that shows the current development. I just hope Oracle did not decide to stop its own affords and resign this team.Rehabilitation
D
12

There is a fork of DCEVM maintained in the repository on Github. It was recently updated for Java 8. The binaries are available through the GitHub releases or on the downloads page.

For simple things, like adding/removing methods, it should be pretty reliable (verified by automated tests in 16 different configurations). However, it still could eventually crash JVM, so it is by no means should be used in production.

Demoniac answered 21/4, 2014 at 16:36 Comment(6)
Thanks. I will check it out. I need it for development so It will be awesome if it works.Rehabilitation
I just want to change rendering methods for html pages on the fly to give me an experience similar to PHP. Once I got the result I would adapt the unit tests for the page to expect the corrected outcome. Today I have to restart the front end server every time instead of just automatically reload the page every time the code changes (just added a dart function to the page asking the server for status).Rehabilitation
Thank you very much, I just tried it with oracle java 1.8.0_05 x86-64 on linux and it works beautifully. The fastdebug is quite slow though, so use the "product" profile.Kirovograd
Also, hotswapagent.org build on top of DCEVM may add a value when using Spring, Hibernate or just to reload any specified resource.Potter
@MartinKersten I'm very late at the party, but isn't that what JRebel does for java?Gillette
@Gillette Partially. JRebel support some but not all use-cases (as far as I remember, might have changed nowadays)Rehabilitation

© 2022 - 2024 — McMap. All rights reserved.