why doesn't java has instant turnaround - con-fess 2012
TRANSCRIPT
Why Doesn’t Java Have Instant Turnaround?Anton Arhipov | ZeroTurnaround
whoami
Anton ArhipovJRebel ZeroTurnaround
http://arhipov.blogspot.com@antonarhipov
@javarebel
Turnaround Cycle
Make a change
Build, deploy,
wait
Check the
change
Diversity
dev << PROD
Operations
Standards
Vendors
Turnaround Cycle
Make a change
Build, deploy,
wait
Check the
change
Navigation
Application deployment
Turnaround Time Sink
Container startup time
OOM
Container Startup Time
http://dow.ngra.de/2010/12/14/jee-oss-container-startup-times-apples-vs-oranges/
http://zeroturnaround.com/java-ee-productivity-report-2011/
http://zeroturnaround.com/java-ee-productivity-report-2011/
Build
Make a change
Build, deploy,
wait
Check the
change
Build
Package everything into WAR/EAR
Package modules into JARs
Compile classes
Copy static resources
Resolve dependencies
Exploded Directory Deployment
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();
}
}
“…I know about JRebel, but I cannot pay for it, so I tried Maven…” - Stackoverflow
This works:mvn jetty:run
others?
MyApp.war
virtual mapping
getResource(“hello.html”) read(“src/main/.../hello.html”)
Build
Package everything into WAR/EAR
Package modules into JARs
Compile classes
Copy static resources
Resolve dependencies
Build
Package everything into WAR/EAR
Package modules into JARs
Compile classes
Copy static resources
Resolve dependencies
Why Code Reloading is Hard?
Why Code Reloading is Hard?
Externalized Temporary
Serializable Derivative
State
How To Reload a Class?
MyObject
MyObject.class
OldClassLoader NewClassLoader
MyObject.class
MyObjectRecreate object
Classes
Libraries
OldClassLoader NewClassLoader
Sevlet New ClassesNew
Libraries
Sevlet
Session Session
init()
App State
App State
Serialize/deserialize
Classes
OldClassLoader NewClassLoader
Sevlet New ClassesNew
Libraries
Sevlet
Session Session
App State
App State
Old ComponentClassLoader
New Component ClassLoader
Class Object
Component State
NewClass
NewObject
MyObject
MyObject.class
OldClassLoader
Code101000101100010010
Debugger
HotSwap
New code111000100101010010
New code 111000100101010010
Make changes in IDEHotSwap
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
- -
MyObject
MyObject.class
OldClassLoader
Code101000101100010010 New code
111000100101010010
Make changes in IDE
JRebel
Fram
ewor
k
Configuration(XML, annotations,..)
JRebel
in action
Oh ...The Acid is Kicking In
Questions?
BETARemoting
http://arhipov.blogspot.com@antonarhipov
@javarebel