Why Doesn't Java Has Instant Turnaround - Con-FESS 2012

36
Why Doesn’t Java Have Instant Turnaround? Anton Arhipov | ZeroTurnaround

Transcript of Why Doesn't Java Has Instant Turnaround - Con-FESS 2012

Page 1: Why Doesn't Java Has Instant Turnaround - Con-FESS 2012

Why Doesn’t Java Have Instant Turnaround?Anton Arhipov | ZeroTurnaround

Page 2: Why Doesn't Java Has Instant Turnaround - Con-FESS 2012

whoami

Anton ArhipovJRebel ZeroTurnaround

http://arhipov.blogspot.com@antonarhipov

@javarebel

Page 3: Why Doesn't Java Has Instant Turnaround - Con-FESS 2012
Page 4: Why Doesn't Java Has Instant Turnaround - Con-FESS 2012

Turnaround Cycle

Make a change

Build, deploy,

wait

Check the

change

Page 5: Why Doesn't Java Has Instant Turnaround - Con-FESS 2012

Diversity

Page 6: Why Doesn't Java Has Instant Turnaround - Con-FESS 2012

dev << PROD

Operations

Standards

Vendors

Page 7: Why Doesn't Java Has Instant Turnaround - Con-FESS 2012

Turnaround Cycle

Make a change

Build, deploy,

wait

Check the

change

Page 8: Why Doesn't Java Has Instant Turnaround - Con-FESS 2012

Navigation

Application deployment

Turnaround Time Sink

Container startup time

OOM

Page 9: Why Doesn't Java Has Instant Turnaround - Con-FESS 2012

Container Startup Time

http://dow.ngra.de/2010/12/14/jee-oss-container-startup-times-apples-vs-oranges/

Page 10: Why Doesn't Java Has Instant Turnaround - Con-FESS 2012

http://zeroturnaround.com/java-ee-productivity-report-2011/

Page 11: Why Doesn't Java Has Instant Turnaround - Con-FESS 2012

http://zeroturnaround.com/java-ee-productivity-report-2011/

Page 12: Why Doesn't Java Has Instant Turnaround - Con-FESS 2012

Build

Make a change

Build, deploy,

wait

Check the

change

Page 13: Why Doesn't Java Has Instant Turnaround - Con-FESS 2012

Build

Package everything into WAR/EAR

Package modules into JARs

Compile classes

Copy static resources

Resolve dependencies

Page 14: Why Doesn't Java Has Instant Turnaround - Con-FESS 2012

Exploded Directory Deployment

Page 15: Why Doesn't Java Has Instant Turnaround - Con-FESS 2012

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();

}

}

Page 16: Why Doesn't Java Has Instant Turnaround - Con-FESS 2012

“…I know about JRebel, but I cannot pay for it, so I tried Maven…” - Stackoverflow

Page 17: Why Doesn't Java Has Instant Turnaround - Con-FESS 2012

This works:mvn jetty:run

others?

Page 18: Why Doesn't Java Has Instant Turnaround - Con-FESS 2012

MyApp.war

virtual mapping

getResource(“hello.html”) read(“src/main/.../hello.html”)

Page 19: Why Doesn't Java Has Instant Turnaround - Con-FESS 2012

Build

Package everything into WAR/EAR

Package modules into JARs

Compile classes

Copy static resources

Resolve dependencies

Page 20: Why Doesn't Java Has Instant Turnaround - Con-FESS 2012

Build

Package everything into WAR/EAR

Package modules into JARs

Compile classes

Copy static resources

Resolve dependencies

Page 21: Why Doesn't Java Has Instant Turnaround - Con-FESS 2012

Why Code Reloading is Hard?

Page 22: Why Doesn't Java Has Instant Turnaround - Con-FESS 2012

Why Code Reloading is Hard?

Externalized Temporary

Serializable Derivative

State

Page 23: Why Doesn't Java Has Instant Turnaround - Con-FESS 2012

How To Reload a Class?

MyObject

MyObject.class

OldClassLoader NewClassLoader

MyObject.class

MyObjectRecreate object

Page 24: Why Doesn't Java Has Instant Turnaround - Con-FESS 2012

Classes

Libraries

OldClassLoader NewClassLoader

Sevlet New ClassesNew

Libraries

Sevlet

Session Session

init()

App State

App State

Serialize/deserialize

Page 25: Why Doesn't Java Has Instant Turnaround - Con-FESS 2012

Classes

OldClassLoader NewClassLoader

Sevlet New ClassesNew

Libraries

Sevlet

Session Session

App State

App State

Page 26: Why Doesn't Java Has Instant Turnaround - Con-FESS 2012
Page 27: Why Doesn't Java Has Instant Turnaround - Con-FESS 2012
Page 28: Why Doesn't Java Has Instant Turnaround - Con-FESS 2012

Old ComponentClassLoader

New Component ClassLoader

Class Object

Component State

NewClass

NewObject

Page 29: Why Doesn't Java Has Instant Turnaround - Con-FESS 2012

MyObject

MyObject.class

OldClassLoader

Code101000101100010010

Debugger

HotSwap

New code111000100101010010

New code 111000100101010010

Make changes in IDEHotSwap

Page 30: Why Doesn't Java Has Instant Turnaround - Con-FESS 2012

JRebel vs HotSwapHotSwap JRebel

Changing method bodies + +Adding/removing methods - +Adding/removing constructors - +Adding/removing fields - +Adding/removing classes - +Adding/removing annotations - +Replacing superclass - -Adding/removing implemented interfaces

- -

Page 31: Why Doesn't Java Has Instant Turnaround - Con-FESS 2012

MyObject

MyObject.class

OldClassLoader

Code101000101100010010 New code

111000100101010010

Make changes in IDE

JRebel

Fram

ewor

k

Configuration(XML, annotations,..)

JRebel

Page 32: Why Doesn't Java Has Instant Turnaround - Con-FESS 2012

in action

Page 33: Why Doesn't Java Has Instant Turnaround - Con-FESS 2012

Oh ...The Acid is Kicking In

Questions?

Page 34: Why Doesn't Java Has Instant Turnaround - Con-FESS 2012
Page 35: Why Doesn't Java Has Instant Turnaround - Con-FESS 2012

BETARemoting

Page 36: Why Doesn't Java Has Instant Turnaround - Con-FESS 2012

http://arhipov.blogspot.com@antonarhipov

@javarebel