Td Bos Javase6 Patel

  • November 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Td Bos Javase6 Patel as PDF for free.

More details

  • Words: 2,250
  • Pages: 54
Java SE 6 Top 10 Features, Java SE 7, and OpenJDK Rima Patel Sriganesh Staff Engineer Sun Microsystems, Inc.

Java SE

Platform Evolution

1995

1997

1999

J2SE 1.2 JDK 1.0 “Playground” J2SE 1.3 “Kestrel” JDK 1.1

2001

J2SE 1.4 “Merlin”

2003

2005

2007

2009

Java SE 6 J2SE 5.0 “Tiger”

Java SE 7

2

Java SE 6 and 7 Platform Evolution

Java SE 7 Released

JDK 6 Released JRE 6 Released

2006

2007

2008

2009

First pieces Open Sourced “It’s not a matter of when but how”

OpenJDK™ Launch + OpenJDK Board Formation

3

JDK 6 Adoption

JDK 6 Downloads Between December, 2006 and May, 2007

Java SE 6 J2SE 5.0 J2SE 1.4.2 J2SE 1.3.1

2,090,155 downloads of the JDK Version 6

4

JRE 6 Adoption

JRE Downloads Between December, 2004 and May, 2007 55,000,000

Completed Monthly Downloads

50,000,000 45,000,000 40,000,000 35,000,000 30,000,000 25,000,000 20,000,000 15,000,000 10,000,000

JRE software for the Java SE 6 platform!

5,000,000 0 1/2004

1/2005

1/2006

1/2007

5

Project OpenJDK

Provides Fully Build-able Open Source Java SE Platform Implementation ●



Any open source project can create and distribute compatible open source implementation OpenJDK is an open source project that implements Java SE 6 (and beyond) platform ● ●

Based on Sun's JDK Majority of the code released under GPLv2 ●



Exception: Encumbered components, which are released in binary form under Binary License for OpenJDK

Comes with a test harness for unit, functional, and regression tests (except compatibility tests which belong in the TCK)

6

Java SE 6 Platform: Top 10 Features Scripting

Ability to mix JavaScript™technology with Java code

Web Services

Easy to use Web Service APIs

Database

Updated JDBC APIs, all-Java database in JDK

Desktop

AWT/Swing API enhancements, Consumer JRE

Monitoring and Management

JDK Tools

Compiler Access

APIs to control the compiler

Pluggable Annotations

Define your own annotation processors

Java SE For Deployment

Consumer JRE

Security

Further support for security APIs

Performance

Performance, performance, performance

7

1. Scripting

Motivation for Scripting Support • Provides an opportunity to benefit from different scripting languages on the Java platform • Produces an environment in which developers and end users can collaborate to create more useful, dynamic applications > By delivering Java applications that can be customized via

scripts

• Extends scripting languages using the powerful Java technology libraries > Reuse of Java code modules in scripting languages

9

Scripting • Scripting for the Java Platform (JSR 223) > Framework APIs for adding script engines > Developer APIs to mix script fragments with Java

language code

• A JavaScript engine is included in JDK 6 > Mozilla Rhino engine

• Many other JSR 223 compliant scripting engines (Groovy, Ruby, Python, et al) can be downloaded from > scripting.dev.java.net 10

Mixing Script Fragments with Java Code // create a ScriptEngineManager ScriptEngineManager m = new ScriptEngineManager(); // get an instance of JavaScript script engine ScriptEngine engine = m.getEngineByName("js"); // evaluate a script engine.eval("alert(\"Hello World!\")");

11

Using Java Libraries From Scripts From Scripting.js Sample In JDK 6

//use Java APIs to create a Swing JFrame var fr = new javax.swing.JFrame(); fr.setSize(200,200); //access public get/set methods as fields fr.defaultCloseOperation = javax.swing.WindowConstants.DISPOSE_ON_CLOSE; fr.title = 'A GUI in JavaScript'; fr.visible = true; fr.getContentPane().setLayout(new java.awt.FlowLayout()); var btn = new javax.swing.JButton(“Push Me”); fr.getContentPane().add(btn);

12

2. Web Services

XML and Web Services • • • •

JAX-WS is part of Java SE 6 platform Data binding using JAXB 2.0 Updates to the JAXP, which includes StaX Standards supported > SOAP 1.2 > WS-I Basic Profile 1.1 > XML-binary Optimized Packaging (XOP) and SOAP Message

Transmission Optimization Mechanism (MTOM) > Representational State Transfer (REST)

14

Web Services on Java SE 6 Platform Server-side Programming Model

1. Write a Plain Old Java Object (POJO) implementing the service behaviour 2. Mark it with @WebService annotation 3. Optionally, inject a @WebServiceContext 4. Publish the Web service endpoint through Endpoint.publish() method > WSDL is automatically generated at runtime

5. Point your clients at the Web Services Description Language (WSDL), for example: . > http://myserver/myapp/MyService?WSDL 15

Web Service – Example // Create a service implementation @WebService public class Calculator { @Resource WebServiceContext context; public int add(int a, int b) { return a+b; } } // Create and publish the endpoint Calculator calculator = new Calculator(); Endpoint endpoint = Endpoint.publish (“http://localhost/calculator”,calculator);

16

Web Services on Java SE 6 Platform Client-side Programming Model

1.Point the tool to the service WSDL 2.Generate client-side artifacts 3.Create a service class instance (new) 4.Get a proxy using getxxxPort() 5.Invoke service operations

17

Web Service Client // Create a Service object CalculatorService svc = new CalculatorService(); // Create a proxy from the Service object Calculator proxy = svc.getCalculatorPort(); // Invoke a Web service operation int answer = proxy.add(35, 7);

18

3. Database

Java Database Connectivity (JDBC) 4.0 • No need for loading driver through class.forName() > Driver automatically loaded through JAR Service mechanism upon first attempt to connect to DB

• SQLXML Data Type > Mapping to the SQL XML data type

• Support for WebRowSet > CachedRowSet + XML Serialization

(WebRowSet.writeXML())

• Java DB database bundled with JDK 6 > Java DB is based on Apache Derby 20

4. More Desktop APIs

More Desktop APIs • AWT improvements > > > > >

Tray icon Splash screen Desktop class Dialog modality enhancements and API Text printing

• Swing improvements > GroupLayout – basis for NetBeans GUI Builder

(Matisse) > JTable sorting and filtering > SwingWorker

22

Tray Icon Support • Lets you access the system tray of the host OS in order to add graphics, pop-up menus, and floating tip functionality to the system tray // Construct a TrayIcon TrayIcon trayIcon = new TrayIcon(image, "Tray Demo", popupMenu); // Set the TrayIcon properties trayIcon.addActionListener(actionListener); // Add the tray icon SystemTray.getSystemTray().add(trayIcon);

23

Splash Screen Support • Displays a splash screen instantly – before the JVM™ starts! > Display from command line java -splash:image.gif TheApp

> Display from MANIFEST.MF Splashscreen-Image: image.gif

• Use the Java2D API to control painting from the application SplashScreen splash = SplashScreen.getSplashScreen(); Graphics2D g = splash.createGraphics(); // your painting code here splash.update();

24

Desktop Class • New class – java.awt.Desktop • File processing > Opening, editing, and printing files with applications

registered in native system

• Browsing > Opening a URL with the default browser

• Email > Sending a message with the default mail client

• Depends on platform capabilities to work > Desktop.isDesktopSupported() 25

SwingWorker For Easy Multi-threaded Application Development With Swing

• • • • • •

Makes it easy to offload work to separate threads Makes use of concurrency package Makes it more generic Supports partial results Supports PropertyChangeListener More information -

> http://java.sun.com/docs/books/tutorial/uiswing/concurrency/ 26

SwingWorker – Example final JLabel label; class MeaningOfLifeFinder extends SwingWorker<String, Object> { @Override public String doInBackground() { return findTheMeaningOfLife(); } @Override protected void done() { try { label.setText(get()); } catch (Exception ignore) { } } } // Call this from the Event Dispatch Thread (new MeaningOfLifeFinder()).execute();

27

javax.swing.GroupLayout Class • New layout manager to support new Matisse GUI builder > NetBeans™ IDE ships with Matisse > Can also use GroupLayout in J2SE 1.5 software

using stand-alone library

• More capabilities for relative positioning of components • Works with horizontal and vertical layout separately

28

Using GroupLayout Class Horizontal

Vertical

Both Horizontal and Vertical

29

Performance and LAF • We improved actual performance > Graphics hardware acceleration on Windows

• We improved perceived performance > True double buffering

• We improved the native look & feels > Updated Swing LAFs for Windows/Unix > LCD text rendering

30

5. Monitoring & Management

Monitoring and Management • Attach on demand for > jconsole – Can connect to applications that did not

start up with the JMX agent > jstack – takes a 'photograph' of all the threads and what they are up to in their own stack frames > jmap – takes a detailed 'photograph' of what's going on in memory at any one point in time > jhat – forensic expert that will help you interpret the result of jmap

32

6. Compiler Access

Compiler Access • Opens up programmatic access to javac for inprocess compilation of dynamically generated Java code • Really aimed at people who create tools for Java development and for frameworks > JavaServer Pages (JSP) or PHP construction kit

engines that need to generate a bunch of classes on demand > Average developers will benefit indirectly from faster performing tool > Jasper JSP engine runs JSP TCK 3.5x faster 34

7. Pluggable Annotations

Pluggable Annotations • JSR 175 of JDK 5 standardized how annotations are declared in Java code but annotation processing details were relegated as an implementation detail • JSR 269, Pluggable Annotation Processing API, standardizes annotation processing as well > The annotation processors act as plug-ins to the

compiler, hence "pluggable annotation processing”

36

Pluggable Annotations – Example • Allow developers to define new annotations... @ForReview public void myMethod() {...}

• ...and APIs to define components that process them... import javax.annotation.processing.*;

public class ForReviewProcessor extends AbstractProcessor {..}

• ...and integrate them with the Java Compiler javac -processor ForReviewProcessor MyCode.java

37

8. Java SE Platform For Deployment

Core Challenges • Startup time is poor > Especially for cold starts

• Installation is slow and complicated • The JRE software has become very large Irritating for enterprise applications, but worse for consumer applications

39

Consumer JRE Release Targeted In Early 2008

• To be made available as an update to JDK 6 • Contains three main components > Quickstarter > Reduces the start up time for Java applications and applets > Java Kernel > Breaks up the monolithic Java platform into discrete download-able chunks of functionality > Deployment Toolkit > Enables easy detection and installation of the JRE

40

9. Security

9. Security • Added new APIs > XML Digital Signature (XMLDSig) API (JSR 105) > Smart Card I/O API (JSR 268)

• Improved authentication schemes > JAAS-based authentication using LDAP > Native Platform Java GSSAPI (Generic Security

Services Application Programming Interface) integration

42

10. Performance

10. Performance Improvements • Optimized memory access > Object allocation prefetch on x86 and x64 (5.0_06): > Main memory is very slow, 300-600+ cycles away > Objects are allocated sequentially in memory > Prefetch (and load into L1 or L2 cache) a platform-dependent number of cache lines beyond every newly allocated object –

Opteron: 32-bit VM provides six 64-byte cache lines, 64-bit VM provides four

• Large Page support through -XX:+UseLargePages > Maps Java technology heap and generated code cache with 2–4

mb pages rather than 4–8 kb ones > Virtual-to-physical address translation time vastly reduced > By default on for Solaris, off for Linux/Windows

• Biased Locking support • Throughput collector for old generation

44

10. Performance Improvements 120

114.89

Normalized to IBM SDK 5.0 32-bit Linux

110 100 90

Sun Fire™ X4200 server: > 2 Opteron 2.4 Ghz dualcore = 4 cores, 16 gb > 64-bit operating system – Red Hat EL AS 4.0 Update 4 >

100.43

100 89.68

88.8

80

71.2

70 60

54.98

50

53.83

J2SE 5.0_08 Java SE 6 RC1 IBM 5.0 SR2 BEA JRockit 5.0_06 R26.4

40 30 20 10 0

32-bit JVM

64-bit JVM

45

Java SE 7 Highlights

Evolution of Java Language

Potential Changes • Support for superpackages • Language support for Java technology properties • Control abstraction constructs > Closures > Concise instance creation expressions > First class methods

• Operator overloading • Smoothening the rough edges > Shorter variable declaration, strings in switch, Enum

comparisons

47

Turbo Charging Scripting Support • New bytecode – invokedynamic > Dynamic method dispatch > Support for dynamically typed languages on the Java

platform (JSR 292) > Investigating hotswapping

• Bundling of more dynamic language engines with the platform > Beanshell Scripting language (JSR 274) > JRuby, Jython, Beanshell, Groovy > JavaFX technology script 48

Easier Swing Development • JSR 295 – Beans Binding > Formalization of Swing Controller API for connecting

JavaBeans specification

• JSR 303 – Bean Validation > Metadata model to express validation constraints

• JSR 296 – Swing Application Framework > Formalizing support functions

49

Updates in Management • JSR 255: Java Management Extensions (JMX™) Specification, version 2.0 > Namespaces, federated JMX technology servers > opendmk.dev.java.net

• JSR 262: Web Services Connector for JMX Agents > Based on ws management standards > Early Draft Available > ws-jmx-connector.dev.java.net

50

More New I/O APIs • JSR 203 • New file system API java.nio.filesystem.Filesystem > > > > >

Listen for filesystem changes Security attributes (file permissions, ACLs,…) Symbolic links Adds operations: copy, move, walk file tree,… Scalable access to directories

51

Call For Action • Java SE 6 platform > Use it now!

• OpenJDK > Join us in building it!

• Java SE 7 platform > Join us in defining it!

• Interact with JDK developers @ planetjdk.org

52

Java SE 6 Top 10 Features, Java SE 7, and OpenJDK Rima Patel Sriganesh [email protected]

Copyright (c) 2007 Sun Microsystems, Inc. All rights reserved. Sun, Sun Microsystems, the Sun logo, Java, The Java Coffee Cup, JavaOne, Solaris, N1, Sun Fire, J2EE, J2ME, J2SE, and all Java based marks and logos are trademarks or registered trademarks of Sun Microsystems, Inc. in the United States and other countries. All SPARC trademarks are used under license and are trademarks or registered trademarks of SPARC International, Inc. in the U.S. and other countries. Products bearing SPARC trademarks are based upon an architecture developed by Sun Microsystems, Inc. UNIX is a registered trademark in the United States and other countries, exclusively licensed through X/Open Company, Ltd.

54

Related Documents

Td Bos Javase6 Patel
October 2019 12
Td Bos Javafx Cho
October 2019 7
Patel
April 2020 21
Patel
December 2019 41
Td
June 2020 33