订阅所有JSP/Servlet的日志 订阅 | 这是最新一篇日志 上一篇 | 下一篇日志 下一篇 ]
JAVA技术

不用重启使用新Class - JavaRebel Brings Class Reloading

附件
javarebel-logo.gif(5.8 K)
 
切换到幻灯片模式

JavaRebel Brings Class Reloading to Java


JavaRebel reloads changes to Java classes on-the-fly without redeploy or restart including new methods and fields. It is a generic solution that works for standalone Java applications as well as application servers. For the impatient: watch the demonstration screencast (~5 mins) and download.

Ever since HotSwap support has been introduced in Java 1.4 people have been craving for more. As witnessed by this bug in the Sun database and numerous other discussions changing method bodies was just not enough. Dynamic languages like Ruby were quick enough to capitalize on this lack, touting Java EE development as slow and cumbersome.

As time passed by, people have tried to work around the limitation by reloading classes along with their classloader. However since this requires reconstruction of the object state, it will only work in a controlled and limited environment ?e.g. that of a web framework like RIFE, Tapestry 5 and so on.

Just as many others, we were working on a workaround. However, instead of limiting ourselves to the facilities provided by the Java platform, we devised a whole new approach. Using bytecode modification and a little bit of magic, JavaRebel extends the JVM with the ability to reload almost arbitrary changes to classes on-the-fly. This includes adding and removing both methods and fields and the only forbidden changes are to 'extends' and 'implements' clauses. Since all the existing object instances are preserved the application and server can continue running and code changes are immediately visible in the application.

Watch the demonstration screencast (~5 mins), read the feature list or just download JavaRebel from ZeroTurnaround.com and give it a try. Disclaimer: JavaRebel is commercial software with a free trial for 14 days and developer seat cost at 99$.


Features


JavaRebel reloads only individual class files (e.g. the ones in WEB-INF/classes). This allows to use IDE to compile the classes to the output folder and see the changes immediately. The following changes are supported:



  • Changing, adding and removing class/interface methods

  • Changing, adding and removing class fields

  • Changing, adding and removing class constructors

  • Overriding existing methods

  • Creating new classes or renaming old ones (as long as some other class superclass doesn’t change)

  • Changing method parameter or return types or field type without changing its name

  • Changing, adding and removing class/interface constant fields is supported, but will not get reinitialized and thus is only useful for primitive types and Strings


Changing superclass and implemented interfaces is not supported and in such cases JavaRebel will issue a warning.


Note that JavaRebel adds a performance penalty to the application and should be used only in a development environment. Be sure to to switch it off for performance tests.


Comparison


This compares the changes that JavaRebel can reload to those that Sun JVM implementation reloads when debugger is attached (HotSwap).


























































Sun JVM HotSwap JavaRebel
Creating new classes + +
Changing method bodies + +
Adding/removing methods - +
Adding/removing constructors - +
Adding/removing fields - +
Overriding methods - +
Changing method or field types - +
Changing interfaces - +
Changing superclass - -
Changing implemented interfaces - -

Supported JVMs



  • Sun Java 1.4.x

  • Sun Java 5.x

  • Sun Java 6.x

  • JRockit JVM 8.1sp6 or later

  • JRockit JVM 9.x 1.5.0_06 or later


Supported Application Servers:



  • BEA Weblogic 8.x, 9.x, 10.x

  • Oracle OC4J 10.x

  • Oracle OC4J 9.x (on Java 5 or later)

  • Tomcat 4.x, 5.x, 6.x (on Java 5 or later)

  • JBoss 3.x, 4.x (on Java 5 or later)

  • Jetty 5.x, 6.x (on Java 5 or later)



视频演示地址:http://files.zeroturnaround.com/docs/javarebel-jpetstore-screencast/

官方网址:http://www.zeroturnaround.com/javarebel/features

平均得分
(0 次评分)





文章来自: 本站原创
标签: Class JavaRebel Reloading 
评论: 39 | 查看次数: 7099
  • 共有 39 条评论
  • 1
  • 2
  • 3
  • |
  • >>
yanlink [2010-07-31 15:02:42]
yanlink [2010-07-31 15:02:41]
yanlink [2010-06-18 15:00:37]
2010watches [2010-06-10 16:06:55]
xiaoxue00 [2010-06-04 12:16:21]
100% Satisfait Fast & Safe World Gold le moins cher carto wow , 3 $ = 1000G
Tous les serveurs (carto wow) 30% de réduction rapide satisfait à 100% et sécuritaire carte wow
Le moins cher carte wow , $ 2 = 1000G Prix spécial au sein de ce mois-ci!
beeflee [2009-10-13 13:24:57]
beeflee [2009-08-25 14:47:16]
beeflee [2009-08-24 17:54:31]
beeflee [2009-06-09 12:08:26]
sijialgc [2009-05-04 15:50:43]
beeflee [2009-04-29 14:58:48]
pailiko001 [2009-03-12 10:02:28]
游客 [2009-01-09 17:33:25]
游客 [2009-01-09 08:45:42]
游客 [2009-01-08 14:15:45]
不倫ありませんか!メル友無料募集サイト女子高生人妻DX人妻Magic!!出会い探し人妻がハマる出会い系プチ家出掲示板NO.1!リターンズ素敵な恋人探し素敵なメル友探しスタビLuxury出会い系サーチ出会いの森セフレPlaySpotセックスフレンド大陸出会い系オンリー出会い-Loversセフレステーションご近所の人妻探し出会い探し出会い系サイトFreedom出会い系案内所ピンクの恋人セックスフレンド無料サイト-プレミアムメル友を探そう出会い放題ご近所のアイシテル!メル友ちぇき!セフレ伝説ご近所のメル友探し不倫人妻秘密サークル
  • 共有 39 条评论
  • 1
  • 2
  • 3
  • |
  • >>
发表评论
昵 称:  登录
内 容:
选 项:
字数限制 1000 字 | UBB代码 开启 | [img]标签 开启