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?

Martin Kersten
  • 5,127
  • 8
  • 46
  • 77
  • 5
    One of the JRebel developers once did a little overview of different code swap solutions on the market - http://stackoverflow.com/a/17642585/2269816 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. – Tarmo R Nov 28 '13 at 10:26

2 Answers2

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.

eis
  • 51,991
  • 13
  • 150
  • 199
  • 1
    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. – Martin Kersten Nov 28 '13 at 11:15
  • @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. – eis Nov 28 '13 at 11:33
  • 2
    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. – Martin Kersten Nov 28 '13 at 13:31
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.

Ivan Dubrov
  • 4,778
  • 2
  • 29
  • 41
  • Thanks. I will check it out. I need it for development so It will be awesome if it works. – Martin Kersten Jun 13 '14 at 10:06
  • 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). – Martin Kersten Jun 13 '14 at 10:08
  • 3
    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. – Martin Vysny Aug 07 '14 at 11:50
  • 2
    Also, http://hotswapagent.org build on top of DCEVM may add a value when using Spring, Hibernate or just to reload any specified resource. – xmedeko Mar 02 '15 at 12:44
  • @MartinKersten I'm *very* late at the party, but isn't that what [JRebel](https://zeroturnaround.com/software/jrebel/) does for java? – eis Aug 06 '18 at 06:57
  • @eis Partially. JRebel support some but not all use-cases (as far as I remember, might have changed nowadays) – Martin Kersten Aug 08 '18 at 10:58