Download - Zero redeployment with JRebel
Zero redeployment with JRebel
Minh Hoang TO
Portal Team
www.exoplatform.com - Copyright 2012 eXo Platform 2
Agenda
1. JRebel1. JRebel
2. GateIn zero-redeployment2. GateIn zero-redeployment
3. How does JRebel work?3. How does JRebel work?
www.exoplatform.com - Copyright 2012 eXo Platform 3
JRebel
www.exoplatform.com - Copyright 2012 eXo Platform 4
- Developer(s): - Developer(s): Zero TurnaroundZero Turnaround
- Written in: - Written in: JavaJava
- License: - License: ProprietaryProprietary
- Highlighted features:- Highlighted features:
Immediately visible code changes without redeployingImmediately visible code changes without redeploying
Easy installation and simple configurationEasy installation and simple configuration
www.exoplatform.com - Copyright 2012 eXo Platform 5
Free license plans
OSS planOSS plan
Commiters of Open Source projects have access to free licenseCommiters of Open Source projects have access to free license
Social planSocial plan
Free license in exchange of privileged to post on Twitter/Facebook accountFree license in exchange of privileged to post on Twitter/Facebook account
www.exoplatform.com - Copyright 2012 eXo Platform 6
GateIn zero-deployment
www.exoplatform.com - Copyright 2012 eXo Platform 7
GateIn code changes in IDE are reflected immediately on browser without the GateIn code changes in IDE are reflected immediately on browser without the need of redeploying. Say GOODBYE to tedious redeploy workneed of redeploying. Say GOODBYE to tedious redeploy work
Productive dev environment applicable to any eXo product:Productive dev environment applicable to any eXo product:
Social, Wiki, Forum, ECMS, Platform Social, Wiki, Forum, ECMS, Platform
www.exoplatform.com - Copyright 2012 eXo Platform 8
Demo
- Targeted Maven artifacts:- Targeted Maven artifacts:
exo.portal.webui.portal exo.portal.webui.portal (basic UI components of GateIn portal)(basic UI components of GateIn portal)
exo.portlet.exoadmin exo.portlet.exoadmin (core portlets of GateIn)(core portlets of GateIn)
- Expectation:- Expectation:
Code changes on portal/portlet components from those two artifacts take Code changes on portal/portlet components from those two artifacts take effect on browser without the need of redeploying .war to Tomcat effect on browser without the need of redeploying .war to Tomcat
www.exoplatform.com - Copyright 2012 eXo Platform 9
Before demo
1. Customize 1. Customize packaging/tomcat/pkg/src/main/resources/tomcat/bin/gatein-dev.shpackaging/tomcat/pkg/src/main/resources/tomcat/bin/gatein-dev.sh
2. Generate 2. Generate rebel.xmlrebel.xml in targeted Maven artifacts in targeted Maven artifacts
3. Build and run GateIn3. Build and run GateIn
www.exoplatform.com - Copyright 2012 eXo Platform 10
rebel.xml
www.exoplatform.com - Copyright 2012 eXo Platform 11
rebel.xml
www.exoplatform.com - Copyright 2012 eXo Platform 12
JRebel agent starts
www.exoplatform.com - Copyright 2012 eXo Platform 13
Demo starting ...
www.exoplatform.com - Copyright 2012 eXo Platform 14
How does JRebel work?
www.exoplatform.com - Copyright 2012 eXo Platform 15
Object & Class
MyObject obj = new MyObject();MyObject obj = new MyObject();
Class<?> type = obj.getClass();Class<?> type = obj.getClass();
1. Behavior of method call on 'obj' is determined by 'type'1. Behavior of method call on 'obj' is determined by 'type'
2. 'type' is identified by MyObject.class bytecode and context ClassLoader of the 2. 'type' is identified by MyObject.class bytecode and context ClassLoader of the code MyObject obj = new MyObject(); code MyObject obj = new MyObject();
3. Once loaded, 'type' could not be unloaded or changed (class loader holds a 3. Once loaded, 'type' could not be unloaded or changed (class loader holds a vector of loaded classes)vector of loaded classes)
4. JRebel approach to redefine 'type'4. JRebel approach to redefine 'type'
Black box as Black box as JRebel is not open sourceJRebel is not open source! But described as a combination of! But described as a combination of Instrumentation API + Byte code handling + Class loader Instrumentation API + Byte code handling + Class loader
www.exoplatform.com - Copyright 2012 eXo Platform 16
Class redefinition
www.exoplatform.com - Copyright 2012 eXo Platform 17
MANIFEST.MF
www.exoplatform.com - Copyright 2012 eXo Platform 18
JRebel agent
The code in AgentInstall is likely to beThe code in AgentInstall is likely to be