Rapid Java Application    Development        JUG.ru       25.02.2012
Turnaround CycleMake a change                Check the change            Build, deploy, wait
Technology Zoo
VendorsStandards            Operations      dev <<    PROD
Turnaround CycleMake a change                Check the change            Build, deploy, wait
Turnaround Time Sink                  Navigation         OOMApplication              deploymentContainer boot time
Container Startup Timehttp://dow.ngra.de/2010/12/14/jee-oss-container-startup-times-apples-vs-oranges/
http://zeroturnaround.com/java-ee-productivity-report-2011/
Build     Resolve dependencies     Copy static resources        Compile classes   Package modules into JARsPackage everyth...
Exploded Directory Deployment
Jetty Launcherpublic class Launcher {    public static void main(String[] args) {        Server server = new Server();    ...
“…I know about JRebel, but I cannotpay for it, so I tried Maven…”                          - Stackoverflow
This works:mvn jetty:run  others?
getResource(“hello.html”)   read(“src/main/.../hello.html”)
Build     Resolve dependencies     Copy static resources        Compile classes   Package modules into JARsPackage everyth...
Build     Resolve dependencies     Copy static resources     Compile classes   Package modules into JARsPackage everything...
Why Code Reloading is Hard?Externalized     Temporary           StateSerializable     Derivative
OldClassLoader         NewClassLoader MyObject.class                     MyObject.class                  Recreate objectMy...
Serialize/deserialize                                                      init()       Session                           ...
Twin ClassLoader IssuesClasses                 Classes             Objects                Objects            and Code     ...
Component State                   New        NewClass     Object                   Class     Object Old Component      New...
HotSwap               Make changes in IDE      OldClassLoader  MyObject.class   New                       HotSwap   Code c...
JRebel vs HotSwap                               HotSwap   JRebelChanging method bodies           +         +Adding/removin...
JRebel          Make changes in IDE                  OldClassLoaderFramework              MyObject.class               Cod...
in action
Oh ...The Acid is Kicking In     Take a break!
Rapid java application development @ JUG.ru 25.02.2012
Rapid java application development @ JUG.ru 25.02.2012
Upcoming SlideShare
Loading in …5
×

Rapid java application development @ JUG.ru 25.02.2012

6,534 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
6,534
On SlideShare
0
From Embeds
0
Number of Embeds
5,213
Actions
Shares
0
Downloads
24
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • Vendors make money on production =&gt; development is secondaryOperations rule development, best practices are heavily influenced by production needsMultiple participants in the standard working groups means a choice between reducing scope of the standard or reducing its qualityStory: when we tried pitching JRebel to a large Java app server vendor the answer was: why bother?
  • Jetty has support for any app layout, but docs are missing. Maven Jetty plugin is the only workable application of this functionality.RAD &amp; Websphere have decent integration that tries to copy the minimal amount of files possible. Copying isn’t a great idea, though.Weblogic has the split directory structure functionality which is powerful on paperEclipse, NetBeans and IntelliJ IDEA have support for publishing applications from the IDE, which varies from decent to awful.SpringSource has fairly decent integration between tooling and server, but only for tc Server.Jboss used to run Ant on every update in Eclipse, Netbeans still does that
  • Externalized ~= PHP, Database, memcachedetcTemporary ~= StatelessJava frameworks/servers often have too much derivative state and it takes too long to createSerializing helps when it can§
  • If you want to preserve the state, this is what you have to do.
  • Class loader scopeEvery deployed application gets a dedicated class loaderState recreationApplication state is recovered by reinitializationSession state is (optionally) serialized and deserialized in the new class loaderReloading timeApplication reinitialization time, typically around one minuteProblemsLeaks memoryLazy caches need to be warmed up every time
  • DEMO (appserver simulation)New objects are not instances of old classesinstanceof returns falseCasting throws an exceptionNew classes are not members of the old packagesCan get an IllegalAccessException when calling a perfectly legal methodMemory leaks are easyIf you hold a reference to any object in the old classloader you will hold all old classes (including their static fields)
  • Class loader scopeClass loader per component/serviceState recreationState restored by framework (component/service recreated)Reloading time(Almost) InstantProblemsOnly managed components can be reloadedManaged components referring unmanaged code can be a problem (twin class issues)
  • Rapid java application development @ JUG.ru 25.02.2012

    1. 1. Rapid Java Application Development JUG.ru 25.02.2012
    2. 2. Turnaround CycleMake a change Check the change Build, deploy, wait
    3. 3. Technology Zoo
    4. 4. VendorsStandards Operations dev << PROD
    5. 5. Turnaround CycleMake a change Check the change Build, deploy, wait
    6. 6. Turnaround Time Sink Navigation OOMApplication deploymentContainer boot time
    7. 7. Container Startup Timehttp://dow.ngra.de/2010/12/14/jee-oss-container-startup-times-apples-vs-oranges/
    8. 8. http://zeroturnaround.com/java-ee-productivity-report-2011/
    9. 9. Build Resolve dependencies Copy static resources Compile classes Package modules into JARsPackage everything into WAR/EAR
    10. 10. Exploded Directory Deployment
    11. 11. Jetty Launcherpublic class Launcher { public static void main(String[] args) { Server server = new Server(); SelectChannelConnector connector = new SelectChannelConnector(); connector.setPort(8080); server.addConnector(connector); WebAppContext context = new WebAppContext("war", "/"); server.setHandler(context); server.start(); }}
    12. 12. “…I know about JRebel, but I cannotpay for it, so I tried Maven…” - Stackoverflow
    13. 13. This works:mvn jetty:run others?
    14. 14. getResource(“hello.html”) read(“src/main/.../hello.html”)
    15. 15. Build Resolve dependencies Copy static resources Compile classes Package modules into JARsPackage everything into WAR/EAR
    16. 16. Build Resolve dependencies Copy static resources Compile classes Package modules into JARsPackage everything into WAR/EAR
    17. 17. Why Code Reloading is Hard?Externalized Temporary StateSerializable Derivative
    18. 18. OldClassLoader NewClassLoader MyObject.class MyObject.class Recreate objectMyObject MyObject
    19. 19. Serialize/deserialize init() Session Session Sevlet New SevletClasses Classes App App New StateLibraries State Libraries OldClassLoader NewClassLoader
    20. 20. Twin ClassLoader IssuesClasses Classes Objects Objects and Code and CodeLibraries Libraries OutOfMemoryError ClassCastException OldClassLoader … NewClassLoader JVM
    21. 21. Component State New NewClass Object Class Object Old Component New Component ClassLoader ClassLoader
    22. 22. HotSwap Make changes in IDE OldClassLoader MyObject.class New HotSwap Code code Debugger 111000100 101000101 101010010 100010010 New code 111000100 101010010MyObject
    23. 23. JRebel vs HotSwap HotSwap JRebelChanging method bodies + +Adding/removing methods - +Adding/removing constructors - +Adding/removing fields - +Adding/removing classes - +Adding/removing annotations - +Replacing superclass - -Adding/removing implemented - -interfaces
    24. 24. JRebel Make changes in IDE OldClassLoaderFramework MyObject.class Code 101000101 New code JRebel 100010010 111000100 101010010 MyObject Configuration (XML, annotations,..)
    25. 25. in action
    26. 26. Oh ...The Acid is Kicking In Take a break!

    ×