zero redeployment with jrebel

18
Zero redeploym entw ith JR ebel Minh Hoang TO Portal Team

Upload: minh-hoang

Post on 26-May-2015

497 views

Category:

Documents


0 download

DESCRIPTION

JRebel traning at eXo

TRANSCRIPT

Page 1: Zero redeployment with JRebel

Zero redeployment with JRebel

Minh Hoang TO

Portal Team

Page 2: Zero redeployment with JRebel

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?

Page 3: Zero redeployment with JRebel

www.exoplatform.com - Copyright 2012 eXo Platform 3

JRebel

Page 4: Zero redeployment with 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

Page 5: Zero redeployment with JRebel

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

Page 6: Zero redeployment with JRebel

www.exoplatform.com - Copyright 2012 eXo Platform 6

GateIn zero-deployment

Page 7: Zero redeployment with JRebel

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

Page 8: Zero redeployment with JRebel

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

Page 9: Zero redeployment with JRebel

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

Page 10: Zero redeployment with JRebel

www.exoplatform.com - Copyright 2012 eXo Platform 10

rebel.xml

Page 11: Zero redeployment with JRebel

www.exoplatform.com - Copyright 2012 eXo Platform 11

rebel.xml

Page 12: Zero redeployment with JRebel

www.exoplatform.com - Copyright 2012 eXo Platform 12

JRebel agent starts

Page 13: Zero redeployment with JRebel

www.exoplatform.com - Copyright 2012 eXo Platform 13

Demo starting ...

Page 14: Zero redeployment with JRebel

www.exoplatform.com - Copyright 2012 eXo Platform 14

How does JRebel work?

Page 15: Zero redeployment with JRebel

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

Page 16: Zero redeployment with JRebel

www.exoplatform.com - Copyright 2012 eXo Platform 16

Class redefinition

Page 17: Zero redeployment with JRebel

www.exoplatform.com - Copyright 2012 eXo Platform 17

MANIFEST.MF

Page 18: Zero redeployment with JRebel

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