Rapid Java Application Development
JUG.ru25.02.2012
Turnaround Cycle
Make a change
Build, deploy,
wait
Check the
change
Technology Zoo
dev << PROD
Operations
Standards
Vendors
Turnaround Cycle
Make a change
Build, deploy,
wait
Check the
change
Navigation
Application deployment
Turnaround Time Sink
Container boot 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/
Build
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
Build
Why Code Reloading is Hard?Externalized
Temporary
Serializable
Derivative
State
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
Twin ClassLoader Issues
JVM
Classes
Libraries
OldClassLoader NewClassLoader
Objects and
Code
Classes
Libraries
Objects and
CodeOutOfMemoryErrorClassCastException
…
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
Take a break!