1 / 37

CON3736: JDK 8 Compact Profiles for Embedded and ADF-Mobile on iOS devices

CON3736: JDK 8 Compact Profiles for Embedded and ADF-Mobile on iOS devices. Bob Vandette Java SE Mobile & Embedded Lead.

odelia
Télécharger la présentation

CON3736: JDK 8 Compact Profiles for Embedded and ADF-Mobile on iOS devices

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CON3736: JDK 8 Compact Profiles for Embedded and ADF-Mobile on iOS devices Bob VandetteJava SE Mobile & Embedded Lead

  2. The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle.

  3. Program Agenda • Compact Profiles Overview • Building Compact Profiles from OpenJDK • Reference Implementation Details • Java SE Embedded Compact Profile Support • Creating Embedded Compact Profiles • Compact Profile based Products and Use Cases • Demos

  4. Java SE 8 Compact Profiles Profiles Introduction • Three new Java SE Runtimes (Compact Profiles) in JDK 8 • Described in OpenJDK Java Enhancement Proposal 161 (http://openjdk.java.net/jeps/161) • Java SE compatible subsets • Developers can choose an appropriate runtime based on the resources available in their target hardware • Benefits • Significantly smaller base Java runtime • Platform for smaller FX only graphical UI stack • New tool for Java SE Embedded which allows selection of runtime options • Quicker download • Basis for Java ME / CDC Converged product • Similar to Foundation profile & optional packages • Enables migration of CDC headless applications

  5. Java SE 8 Compact Profiles Profiles Introduction SE Full JRE SE 8 Compact Profiles Optional Components 3 UI & Toolkits Integration Libraries Compact3 Class libraries 2 Other Base Libraries Compact2 Class libraries 1 Lang & Util Base Libraries Base Compact1 Classes Hotspot VM Hotspot VM

  6. Contents

  7. Java SE 8 APIs java.applet java.awt .**(13 packages) java.beans java.beans.beancontext javax.accessibility javax.activation javax.activity javax.annotation javax.imageio javax.imageio.event javax.imageio.metadata javax.imageio.plugins.bmp javax.imageio.plugins.jpeg javax.imageio.spi javax.imageio.stream javax.jws javax.jws.soap javax.print javax.print.attribute javax.print.attribute.standard javax.print.event javax.rmi javax.rmi.CORBA javax.sound.midi javax.sound.midi.spi javax.sound.sampled javax.sound.sampled.spi javax.swing.** (18 packages) javax.xml.bind javax.xml.bind.annotation javax.xml.bind.annotation.adapters javax.xml.bind.attachment javax.xml.bind.helpers javax.xml.bind.util javax.xml.soap javax.xml.ws javax.xml.ws.handler javax.xml.ws.handler.soap javax.xml.ws.http javax.xml.ws.soap javax.xml.ws.spi javax.xml.ws.spi.http javax.xml.ws.wsaddressing org.omg.** (28 packages) http://openjdk.java.net/jeps/161 java.io java.lang java.lang.annotation java.lang.invoke java.lang.ref java.lang.reflect java.math java.net java.nio java.nio.channels java.nio.channels.spi java.nio.charset java.nio.charset.spi java.nio.file java.nio.file.attribute java.nio.file.spi java.security java.security.cert java.security.interfaces java.security.spec java.text java.text.spi java.time java.time.chrono java.time.format java.time.temporal java.time.zone java.util java.util.concurrent java.util.concurrent.atomic java.util.concurrent.locks java.util.function java.util.jar java.util.logging java.util.regex java.util.spi java.util.stream java.util.zip javax.crypto javax.crypto.interfaces javax.crypto.spec javax.net javax.net.ssl javax.script javax.security.auth javax.security.auth.callback javax.security.auth.login javax.security.auth.spi javax.security.auth.x500 javax.security.cert java.lang.instrument java.lang.management java.security.acl java.util.prefs javax.annotation.processing javax.lang.model javax.lang.model.element javax.lang.model.type javax.lang.model.util javax.management javax.management.loading javax.management.modelmbean javax.management.monitor javax.management.openmbean javax.management.relation javax.management.remote javax.management.remote.rmi javax.management.timer javax.naming javax.naming.directory javax.naming.event javax.naming.ldap javax.naming.spi javax.security.auth.kerberos javax.security.sasl javax.sql.rowset javax.sql.rowset.serial javax.sql.rowset.spi javax.tools javax.xml.crypto javax.xml.crypto.dom javax.xml.crypto.dsig javax.xml.crypto.dsig.dom javax.xml.crypto.dsig.keyinfo javax.xml.crypto.dsig.spec org.ietf.jgss java.rmi java.rmi.activation java.rmi.dgc java.rmi.registry java.rmi.server java.sql javax.rmi.ssl javax.sql javax.transaction javax.transaction.xa javax.xml javax.xml.datatype javax.xml.namespace javax.xml.parsers javax.xml.stream javax.xml.stream.events javax.xml.stream.util javax.xml.transform javax.xml.transform.dom javax.xml.transform.sax javax.xml.transform.stax javax.xml.transform.stream javax.xml.validation javax.xml.xpath org.w3c.dom org.w3c.dom.bootstrap org.w3c.dom.events org.w3c.dom.ls org.xml.sax org.xml.sax.ext org.xml.sax.helpers compact1 compact2 compact3 compact2 compact3 compact1 Full Java SE

  8. More on Contents • Aside from APIs, no sub-setting of JLS, JVMS or other specifications • API packages for all types referenced in JLS for Java SE 8 are in compact1 • Aside from API wrinkles below, the contents of each API packages is identical to the full Java SE platform • No super-setting, no sub-setting • API wrinkles to deal with dependency on java.beans • The following 6 methods are not present in subset Profiles: java.util.logging.LogManager.addPropertyChangeListener java.util.logging.LogManager.removePropertyChangeListener java.util.jar.Pack200.Packer.addPropertyChangeListener java.util.jar.Pack200.Packer.removePropertyChangeListener java.util.jar.Pack200.Unpacker.addPropertyChangeListener java.util.jar.Pack200.Unpacker.removePropertyChangeListener • The 6 methods are deprecated in Java SE 8 • The 6 methods are proposed to be removed in a future release

  9. Profiles builds • New Linux-only “profiles” make target • Creates 3 compact profile images • JRE layout • Not upgradable - can't add to compact1 image to get compact2 for example • Different class files • Build generates sun.misc.Version for each profile • Build runs tool to remove add/removePropertyChangeListener methods so different LogManager, Packer, Unpacker classes

  10. Building Linux x86 Compact Profiles $ hg fclone http://hg.openjdk.java.net/jdk8/jdk8/ $ cd jdk8 $ make images profiles : ## Finished profiles (build time 00:00:27) ----- Build times ------- Start 2013-03-17 14:47:35 End 2013-03-17 14:58:26 00:00:25 corba 00:00:15 demos 00:01:50 hotspot 00:00:24 images 00:00:21 jaxp 00:00:31 jaxws 00:05:37 jdk 00:00:43 langtools 00:00:18 nashorn 00:00:27 profiles 00:10:51 TOTAL ------------------------- Finished building Java(TM) for target 'images profiles' $ cd images $ ls -d *image j2re-compact1-image j2re-compact2-image j2re-compact3-image j2re-image j2sdk-image

  11. Profiles configuration in build • Profile contents defined in:jdk/makefiles/profiles-includes.txt jdk/makefiles/profiles-rtjar-includes.txt • May need to update when adding new API packages or doing other maintenance • Profiles builds runs a simple dependency analyzer to check images • Checks for references to types that do not exist • Checks both boot class path and JAR files in extensions directory • Build fails if reference to unknown type found • refs.allowed file for cases where this is necessary (jsse.jar for example)

  12. Breaking the build • Suppose we add a method to java.lang.Thread that returns a java.lang.management.ThreadMXbean (compact3) $ make profiles : Creating rt.jar profile_1 Compressed=false Creating resources.jar Updating rt.jar profile_1 Analyzing /u/alanb/ws/tl/build/linux-x86_64-normal-server-release/images/j2re-compact1-image/lib/rt.jar Analyzing /u/alanb/ws/tl/build/linux-x86_64-normal-server-release/images/j2re-compact1-image/lib/tzdb.jar Analyzing /u/alanb/ws/tl/build/linux-x86_64-normal-server-release/images/j2re-compact1-image/lib/resources.jar Analyzing /u/alanb/ws/tl/build/linux-x86_64-normal-server-release/images/j2re-compact1-image/lib/jce.jar Analyzing /u/alanb/ws/tl/build/linux-x86_64-normal-server-release/images/j2re-compact1-image/lib/jsse.jar java.lang.Thread -> java.lang.management.ThreadMXBean (unknown type) One or more unexpected references encountered Check /u/alanb/ws/tl/jdk/make/build/tools/deps/refs.allowed is up to date make[2]: *** [/u/alanb/ws/tl/build/linux-x86_64-normal-server-release/images/libprofile_1/_jars_checked] Error 255 make[1]: *** [profile_1] Error 2 make: *** [profiles-only] Error 2 • Keep module graph in mind when adding new dependencies • When in doubt, ask!

  13. Identification • No API or system property to identify profile at runtime - this is deliberate! • Easy for tests to use reflection to determine profile at runtime if needed • Applications that make optional use of APIs can use reflection guard to check if type exists before using it. • Profile name in java -version output and release file $ java -version Java(TM) SE Runtime Environment (build 1.8.0-internal, profile compact1) Java HotSpot(TM) 32-Bit Client VM (build 25.0-b22, mixed mode) $ cat j2re-compact1-image/release JAVA_VERSION="1.8.0" OS_NAME="Linux" OS_VERSION="2.6" OS_ARCH="i586" JAVA_PROFILE="compact1"

  14. Compiling with javac • Compile against target runtime with javac –bootclasspath, or • javac –profile <profile> $ javac -profile compact2 Test.java Test.java:7: error: ThreadMXBean is not available in profile 'compact2' ThreadMXBean bean = ManagementFactory.getThreadMXBean(); ^ Test.java:7: error: ManagementFactory is not available in profile 'compact2' ThreadMXBean bean = ManagementFactory.getThreadMXBean(); ^ 2 errors

  15. NetBeans

  16. Analyzing existing code/libraries with jdeps $ jdeps Usage: jdeps <options> <classes...> where <classes> can be a pathname to a .class file, a directory, a JAR file, or a fully-qualified classname or wildcard "*". Possible options include: -s --summary Print dependency summary only -v --verbose Print additional information -V <level> --verbose-level=<level> Print package-level or class-level dependencies Valid levels are: "package" and "class" -c <path> --classpath=<path> Specify where to find class files -p <pkg name> --package=<pkg name> Restrict analysis to classes in this package (may be given multiple times) -e <regex> --regex=<regex> Restrict analysis to packages matching pattern (-p and -e are exclusive) -P --profile Show profile or the file containing a package -R --recursive Recursively traverse all dependencies --version Version information

  17. javadoc/doclet

  18. Products derived from Java SE 8 sources

  19. Java SE 8 Compact Profiles Reference Implementation (RI) versus Embedded • RI – Compact Profiles Reference Implementation • Implementation of Compact Profiles Only • No Embedded Features or addition size reductions • Linux x86 only • Embedded Compact Profiles – Commercial Product • Size reduced JREs are possible • Embedded JRE customization tool provided (jrecreate) • Additional reductions can be applied using tool • Minimal VM available in bundle (3MB VM versus 6-9MB) • Multiple architectures supported (ARM (3), PPC (2), x86)

  20. Java SE 8 Compact Profiles Bundle types

  21. Java SE 8 Embedded Profiles What’s an ejdk? Java SE Embedded Download Package Contents ejdk1.8.0 ejdk1.8.0/bin jrecreate script ejdk1.8.0/lib JRECreate.jar ejdk1.8.0/{arch} ejdk1.8.0/{arch}/compact1 ejdk1.8.0/{arch}/compact2 ejdk1.8.0/{arch}/compact3 ejdk1.8.0/{arch}/jre ejdk1.8.0/{arch}/extensions optional components

  22. Java SE 8 Embedded Compact Profiles Process used to create custom Java Embedded 8 Runtimes

  23. Java SE 8 Embedded Profiles jrecreate tool

  24. Java SE 8 Embedded Profiles Example of jrecreate use To create the smallest JRE (~12MB) into /home/myjre/smallest-jre % shjrecreate.sh -d /home/myjres/smallest-jre –vm minimal --profile compact1 To create a traditional full JRE in /home/myjre/full-jre with the server VM % shjrecreate.sh -d /home/myjre/full-jre –vm server

  25. Java SE 8 Embedded Profiles Currently Supported Platforms and Releases

  26. Java SE 8 Embedded Profiles Optional Components FX Embedded Example • Optional components that can be added to any compact profile • FX embedded graphics stack • Localization support • Optional security providers • Debugging/Profiling support (JVMTI) • Nashorn JavaScript Engine Embedded Java FX App Java FX Embedded Compact1 Profile Minimal Hotspot VM

  27. Embedded Specific Graphic Stack Even FX has Profiles Goals • Enable Java SE deployments on smart graphical embedded devices • Provide high quality (GPU accelerated) graphics stack for resource constrained devices • Provide a common graphics architecture across all Java SE platforms

  28. Java SE 8 Compact Profiles Sizes Current Static Footprint Sizes (JDK 8 B104) Embedded FX Size arm hard-float

  29. Java SE 8 Embedded Profiles Graphics Footprint Savings over traditional SE Embedded SE Embedded Graphics Stack FX Embedded Stack Swing/AWT App Embedded Java FX App Swing/AWT/Java2D Classes Java FX Embedded Runtime 18MB SE Embedded Runtime Compact1 Profile 52MB Hotspot VM Minimal Hotspot VM Native Toolkit & X11 Libraries Desktop/Window/Session Managers X Server OpenGLES2 Library Linux Kernel + Framebuffer driver Linux Kernel + Framebuffer driver

  30. Java SE 8 Embedded Profiles FX Embedded Hardware Platforms • Reference Platform • BeagleBoard XM with PowerVR SGx530 GPU • Sanity testing for portability on other platforms • Raspberry Pi • Freescale iMX53 & IMX6 boards • PandaBoard

  31. Compact Profile Use Case 1: Java SE Embedded 8 Examples Kiosks Java FX Kiosk App Electronic Tollbooth Java FX Embedded Compact1 Profile Minimal Hotspot VM Customer Billing Vehicle Detection Violator Ticketing Provisioning Support Home Gateway Compact2 Profile HVAC Control App Lighting Control App Home Security App Minimal Hotspot VM Java Embedded Suite Compact2 Profile Minimal Hotspot VM

  32. Compact Profile Use Case 2: ADF Mobile Future release of ADF-Mobile iOS Java UIWebView UIView ADFMC Framework User Java Code Cordova Minimum VM Compact2 Profile ADFMC iOS Framework VMChannel SE Mobile 8 Components

  33. Potential Use Case: App Store Deployment • Currently no support for Windows or Mac Compact Profiles • Would require compact profile implementation on these OS’s • Could enable Application Store deployment • Apple OSX Store deployment • Windows 8 App Store deployment • Java SE 8 on Mobile devices

  34. DEMO

  35. Any Questions?

  36. Graphic Section Divider

More Related