48

Partner Webcast - The Revolution of Oracle Java 8

Embed Size (px)

DESCRIPTION

Java 8, released in March 2014, is a revolutionary release of the world’s #1 development platform. It is the single largest upgrade ever to the programming model, with coordinated core code evolution of the virtual machine, core language, and libraries catching fire and opening up rich possibilities for java Developers Join this webcast to get an overview of what is in Java 8 from a business perspective and how with Java 8, you are uniquely positioned to extend innovation in your solutions through the largest, open, standards-based, community-driven platform. [Read More https://blogs.oracle.com/imc/entry/the_revolution_of_oracle_java]

Citation preview

Page 1: Partner Webcast - The Revolution of Oracle Java 8
Page 3: Partner Webcast - The Revolution of Oracle Java 8

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

The Revolution of Java 8

Victor Ameh Oracle Fusion Middleware Technology Specialist A&C Technology Adoption Office | Partner Business Development, ECEMEA August 21, 2014 [email protected]

Oracle Confidential – Internal/Restricted/Highly Restricted

Page 4: Partner Webcast - The Revolution of Oracle Java 8

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Safe Harbor Statement

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.

4

Page 5: Partner Webcast - The Revolution of Oracle Java 8

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Program Agenda

1

2

3

4

5

What in Java 8 SE is Revolutionary

Changes in Java Core Libraries

Lambda Expressions and Java Language Features

Modifications in Java Virtual Machines

Java Flight Recorder and Java Mission Control 5.3

Java 8 Security

Summary - Q&A

5

6

7

Page 6: Partner Webcast - The Revolution of Oracle Java 8

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Program Agenda

1

2

3

4

5

What in Java 8 SE is New & Revolutionary

Changes in Java Core Libraries

Lambda Expressions and Java Language Features

Modifications in Java Virtual Machines

Java Flight Recorder and Java Mission Control 5.3

Java 8 Security

Summary - Q&A

6

6

7

Page 7: Partner Webcast - The Revolution of Oracle Java 8

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Why Java SE 8 is Revolutionary

• Java 8 SE features the most Significant Upgrade to Java programming model since Java SE 5.

• Facilitates improved developer productivity through reduced boilerplate code.

• Enhances project modularization with use of Compact Profiles in Java SE 8.

• Modernize your applications with new changes in the Java language and core java libraries.

7

Page 8: Partner Webcast - The Revolution of Oracle Java 8

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Java SE 7

Java 7

APIs Language

Java SE 7

CDC 1.1

CDC 1.1 (based on SE 1.4.2)

CLDC 1.1 (based on SE 1.3)

CLDC 1.1

Page 9: Partner Webcast - The Revolution of Oracle Java 8

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Java SE 8 Java SE 8

Java ME 8

Java 8

Java ME 8

APIs Language

Page 10: Partner Webcast - The Revolution of Oracle Java 8

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Why Java SE 8 is Revolutionary

• It enables Internet of Things

• Enhanced Graphics in JavaFX release of the JDK 8

• Major enhancement to the JVM to improve performance in Java 8

- Retired rarely used Garbage Collection Combinations

- Removed Perm Gen to improve Heap Space Tuning.

• Embedded Technology and development on embedded systems is greatly enhanced

10

Page 11: Partner Webcast - The Revolution of Oracle Java 8

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Program Agenda

1

2

3

4

5

What in Java 8 SE is New & Revolutionary

Changes in Java Core Libraries

Lambda Expressions and Java Language Features

Modifications in Java Virtual Machines

Java Flight Recorder and Java Mission Control 5.3

Java 8 Security

Summary - Q&A

11

6

7

Page 12: Partner Webcast - The Revolution of Oracle Java 8

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Changes in Java SE 8 Core Libraries Features New Date and Time APIs • A New date, time and calendar API for the Java SE 8 platform

• Developed and integrated via JSR-310 with the aim of replacing java.util.Date,

• Calendar, TimeZone and Date Format

• Supports standard time concepts

• - Partial, duration, period ,intervals

• - date, time , instant, and time-zone

• Provides a limited set of calendar systems and be extensible to others

• Immutable value types for a multi-core world

12

Page 13: Partner Webcast - The Revolution of Oracle Java 8

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Changes in Java SE 8 Core Libraries Features Core Ideas for the New Date and Time API

• Immutable – value classes

• Domain driven design

• Separation of chronologies

13

Page 14: Partner Webcast - The Revolution of Oracle Java 8

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Changes in Java SE 8 Core Libraries Features Range of types in Date and Time APIs

14

• Date consists of year, month and day • Time-of-day consists of hour, minute , second - LocalDate- a date with no time and no time-zone - LocalTime – a time with no date and no time-zone - LocalDateTime – combines LocalDate and LocalTime • Time-zones handled separately ZonedDateTime- closest class to java.util Calendar • Instantaneous points in time - Instant – closest class to java util.Date

Page 15: Partner Webcast - The Revolution of Oracle Java 8

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Changes in Java SE 8 Core Libraries Features Range of types in Date and Time APIs

15

Local Date • Stores year-month-day (e.g. 21st August 2014)

• USE cases: birthdays , start/end dates, holiday dates

LocalDate current = LocalDate.now(); LocalDate date =LocalDate.of (2014, Month.AUGUST, 21)

Page 16: Partner Webcast - The Revolution of Oracle Java 8

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Range of types in Date and Time APIs

16

Local Date • Stores year-month-day (e.g. 21st August 2014)

• USE cases: birthdays , start/end dates, holiday dates

LocalDate current = LocalDate.now(); LocalDate date =LocalDate.of (2014, Month.AUGUST, 21) If (current.isAfter(date))… String str= date.to String() ; // 2014-08-21

Changes in Java SE 8 Core Libraries Features

Page 17: Partner Webcast - The Revolution of Oracle Java 8

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Changes in Java SE 8 Core Libraries Features Range of types in Date and Time APIs

17

Local Date manipulation • Simple methods to add/subtract/set

• Immutable, so methods named plus/minus/with

date = date.plusMonths(3).minusDays(1);

Page 18: Partner Webcast - The Revolution of Oracle Java 8

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Changes in Java SE 8 Core Libraries Features Range of types in Date and Time APIs

18

Local Date manipulation • Simple methods to add/subtract/set

• Immutable, so methods named plus/minus/with

date = date.plusMonths(3).minusDays(1); date = date.withDayOfMonth(1);

Page 19: Partner Webcast - The Revolution of Oracle Java 8

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Changes in Java SE 8 Core Libraries Features Range of types in Date and Time APIs

19

Local Date manipulation • Simple methods to add/subtract/set

• Immutable, so methods named plus/minus/with

date = date.plusMonths(3).minusDays(1); date = date.withDayOfMonth(1); Date=date.withMonth(8); Date=date.with(Month.AUGUST);

Page 20: Partner Webcast - The Revolution of Oracle Java 8

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Changes in Java SE 8 Core Libraries Features Date and Time APIs

20

Local Date Adjusters • More complex alterations use adjusters

- Change date to the last day of the month - change date to 2nd Friday of next month

date =date.with(TemporalAdjusters.lastDayofMonth() );

Page 21: Partner Webcast - The Revolution of Oracle Java 8

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Changes in Java SE 8 Core Libraries Features Date and Time APIs

21

Local Date Adjusters • More complex alterations use adjusters

- Change date to the last day of the month - change date to 2nd Friday of next month

date =date.with(TemporalAdjusters.lastDayofMonth() ); date = date.with(lastDayOfMonth() ) ; Date =date.with(next(TUESDAY) );

Page 22: Partner Webcast - The Revolution of Oracle Java 8

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Base 64 Encoding and Decoding

22

• Currently Java Developers are forced to use non-public APIs - sun.misc.BASE64Encoder - sun.misc.BASE64Decoder • Java SE 8 now has a standard way - java.util.Base64.Encoder - java.util. Base64.Decoder - encode, encodeToString , decode, wrap methods

Page 23: Partner Webcast - The Revolution of Oracle Java 8

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Changes in Java SE 8 Core Libraries Features Parallel Array Sorting • Java 8 added parallel sorting capabilities to java.util.Arrays to take

• advantage of multicore/multithread machines (JEP 103)

• The heart of the parallel sorting algorithm lies in

java.util.ArraysParallelSortHelpers. The sorting algorithm is based on

CilkSort (pronounced “silk sort”).

• Parallel Sorting arrays on a multicore machine can achieve performance

improvements at 2 MILLION elements or greater.

• The more data you’re sorting the more of a speed you receive

23

Page 24: Partner Webcast - The Revolution of Oracle Java 8

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | 24

Lambda (JSR 335)

Date/Time API (JSR 310)

Type Annotations (JSR 308)

Compact Profiles

Lambda-Form Representation for Method Handles

Remove the Permanent Generation

Improve Contended Locking

Generalized Target-Type Inference

DocTree API

Parallel Array Sorting Bulk Data Operations

Unicode 6.2

Base64

Prepare for Modularization

Parameter Names

TLS Server Name Indication

Configurable Secure-Random Number Generation

Java SE 8 Nashorn

Enhanced Verification Errors

Fence Intrinsics

Repeating Annotations

HTTP URL Permissions

Limited doPrivileged

Page 25: Partner Webcast - The Revolution of Oracle Java 8

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Program Agenda

1

2

3

4

5

What in Java 8 SE is New & Revolutionary

Changes in Java Core Libraries

Lambda Expressions and Java Language Features

Modifications in Java Virtual Machines

Java Flight Recorder and Java Mission Control 5.3

Java 8 Security

Summary - Q&A

25

6

7

Page 26: Partner Webcast - The Revolution of Oracle Java 8

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Lambda Expressions and Java Language Features

What is Lambda Expression?

• Lambda expressions are anonymous methods, aimed at mainly addressing the overhead of syntax code by replacing the machinery of anonymous inner classes with a lighter-weight mechanism in applicable cases.

• Lambda expression replaces anonymous classes and removes all boiler plate code, enabling you to write code in functional style, which is some time more readable.

26

Page 27: Partner Webcast - The Revolution of Oracle Java 8

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Implementing Runnable Interface With Lambda Expression Example

//Before Lambda expression

new Thread(new Runnable( ) {

@Override

public void run() {

System.out.println(“ too much boiler code for too little to do");

}

}).start( );

27

Page 28: Partner Webcast - The Revolution of Oracle Java 8

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Implementing Runnable Interface With Lambda Expression Example

//Before Lambda expression

new Thread(new Runnable( ) {

@Override

public void run() {

System.out.println(“ too much boiler code for too little to do");

}

}).start( );

// With Lambda Expression in Java 8

new Thread( () -> System.out.println("In Java8, Lambda expression rocks !!") ).start();

28

Page 29: Partner Webcast - The Revolution of Oracle Java 8

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Stream API with Collections in Java 8

• Java 8 comes with a new Streams API java.util.stream package that allows the processing of elements of a Java Collection in parallel.

• Classes in the new java.util.stream package provide a Stream API to support functional-style operations on streams of elements.

• The Stream API is integrated into the Collections API, which enables bulk operations on collections, such as sequential or parallel map-reduce transformations

• java.util.stream class provides function such mapToInt(), mapToLong(), and map function to apply an operation on all elements of Collections.

29

Page 30: Partner Webcast - The Revolution of Oracle Java 8

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Stream API with Collections in Java 8

• Stream APIs can be used in an array, a generator function or an I/O channel as a source.

• Stream API enables the processing of Collections both sequentially and in parallel. This is very useful for bulk data operation.

List<Order> orders = getListOfOrders();

// sequential version

Stream<Order> stream = orders.stream();

//parallel version

Stream<Order> parallelStream = orders.parallelStream();

30

Page 31: Partner Webcast - The Revolution of Oracle Java 8

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Default Methods

• Default methods enable new functionality to be added to the interfaces of libraries and ensure binary compatibility with code written for older versions of those interfaces.

• Historically, could not add new methods to interfaces • - Would break existing implementations

• This becomes a problem when your core APIs are over 15 years old • - Need a way to evolve existing interfaces

31

Page 32: Partner Webcast - The Revolution of Oracle Java 8

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Default Method Example

Collection <Person> people =…;

int highestAge =

people.stream()

….

32

Page 33: Partner Webcast - The Revolution of Oracle Java 8

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Default Method Examples

Collection <Person> people =…;

int highestAge =

people.stream()

….

Interface Collection<T> {

default Stream<T> stream() {

}

}

33

Page 34: Partner Webcast - The Revolution of Oracle Java 8

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

1

2

3

4

5

What in Java 8 SE is New & Revolutionary

Changes in Java Core Libraries

Lambda Expressions and Java Language Features

Modifications in Java Virtual Machines

Java Flight Recorder and Java Mission Control 5.3

Java 8 Security

Summary - Q&A

34

6

7

Page 35: Partner Webcast - The Revolution of Oracle Java 8

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Modifications in Java Virtual Machines

• Permanent Generation has been removed from Java 8 version of the Hotspot JVM permanently

– No more need to the size of it

– Current objects moved to Java heap or native memory

– Class metadata, Class static variables

• This is related to the convergence of the HotSpot and Jrockit JVMS

• Retire Rarely – Used GC Combinations

35

Page 36: Partner Webcast - The Revolution of Oracle Java 8

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Nashorn JavaScript Engine A Next-Generation JavaScript Engine for the JVM • Can be used as an embedded scripting tool inside Java applications

• Nashorn can be used from Java using the javax.script API

• Nashorn can also be used from an new command line tool jjs

• Provides support for shell scripting

• Full JavaFx support

36

Page 37: Partner Webcast - The Revolution of Oracle Java 8

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Program Agenda

1

2

3

4

5

What in Java 8 SE is New & Revolutionary

Changes in Java Core Libraries

Lambda Expressions and Java Language Features

Modifications in Java Virtual Machines

Java Flight Recorder and Java Mission Control 5.3

Java 8 Security

Summary - Q&A

37

6

7

Page 38: Partner Webcast - The Revolution of Oracle Java 8

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Java Flight Recorder and Java Mission Control 5.3

A tool for production profiling and diagnostics. • Basic monitoring (JMX Console) • Production time profiling and diagnostic (JFR)

The latest version JMC 5.3.0 contains new features and support for JDK 8. • Minor release • Mostly bug fixes and incremental improvements • Now supports Eclipse 4.3.x

38

Page 39: Partner Webcast - The Revolution of Oracle Java 8

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Java Flight Recorder and Java Mission Control 5.3

Focus on low overhead • - Built into the JVM • - Already available runtime information • - High performance implementation

39

Page 40: Partner Webcast - The Revolution of Oracle Java 8

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Program Agenda with Highlight

1

2

3

4

5

What in Java 8 SE is New & Revolutionary

Changes in Java Core Libraries

Lambda Expressions and Java Language Features

Modifications in Java Virtual Machines

Java Flight Recorder and Java Mission Control 5.3

Java 8 Security

Summary - Q&A

40

6

7

Page 41: Partner Webcast - The Revolution of Oracle Java 8

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Java 8 Security

• Stronger Algorithms for Password-Based Encryption

• Improve security of data in transit by moving TLS 1.2 as default

• Enhanced Support for Cert Revocation Checking such as best-effort checking, CRL caching.

• KeyStore Enhancements -A new command option -importpassword is added to the keytool utility, to accept a password and store it securely as a secret key

• SHA-224 Message Digests -The cryptographic algorithms in JDK 8 have been enhanced with the SHA-224 variant of the SHA-2 family of message-digest implementations.

41

Page 42: Partner Webcast - The Revolution of Oracle Java 8

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Program Agenda

1

2

3

4

5

What in Java 8 SE is New & Revolutionary

Changes in Java Core Libraries

Lambda Expressions and Java Language Features

Modifications in Java Virtual Machines

Java Flight Recorder and Java Mission Control 5.3

Java 8 Security

Summary - Q&A

Q 42

6

7

Page 43: Partner Webcast - The Revolution of Oracle Java 8

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Summary

Key Features Benefit Message

Lambda Expressions Easier to distribute processing of

collections over multiple threads

Better application performance with simpler

code for enhanced productivity

Streams More functional programming style Functional style programming comes to Java -

simplification and flexibility

Annotations on types Better compile time error checking Speeds up app dev process

Date and Time API Simplified API Simplified API, improves developer productivity

Compact Profiles Reduced JRE size Expands the possibilities of Java for limited

footprint environments

Nashorn JavaScript

engine

Better JavaScript performance A new script engine with better performance

for Javascript users

JavaFX Better Swing interoperability;

Added HTML 5 features

WebView’s HTML 5 support, 3-D, embed

Swing nodes inside a Scene Graph, new UI

controls

www.oracle.com/java8

Page 44: Partner Webcast - The Revolution of Oracle Java 8

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Summary

Migration to Java 8 SE considerations

• Use Java 8 for new projects

• With Default Stream APIs , leverage on existing implementations and adopt Java 8 SE in further software releases

44

Page 45: Partner Webcast - The Revolution of Oracle Java 8

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

Q&A

45

Victor Ameh Oracle ISV Migration Center Consultant [email protected] ISV Migration Center blog: http://blogs.oracle.com/imc ISV Migration Center email: [email protected]

Page 46: Partner Webcast - The Revolution of Oracle Java 8

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. |

• CONNECT WITH US

• COMMUNICATE WITH US • [email protected]

• oracle.com/subscribe

ASSISTING YOU ADOPT & IMPLEMENT THE LATEST ORACLE TECHNOLOGY

blogs.oracle.com/IMC

twitter.com/oracleIMC

youtube.com/OracleIMCTeam

facebook.com/oracleIMC

ORACLE.COM/PARTNERS/GOTO/HUB-ECEMEA

Page 47: Partner Webcast - The Revolution of Oracle Java 8

Copyright © 2014 Oracle and/or its affiliates. All rights reserved. | 47

Page 48: Partner Webcast - The Revolution of Oracle Java 8