Top Banner
hashtag: #j8fk Future of Java EE with SE 8 (Revised) Jun 14, 2014 Hirofumi Iwasaki http:// www.mushagaeshi.com Java Community @Fukuoka
56

Future of Java EE with SE 8 (revised)

Jan 15, 2015

Download

Technology

Happy Java 8 release! But for Java EE 7? Is the SE 8 works for EE 7? this slide shows the current situation of applying SE 8 to EE 7. This is the revised version of "JJUG CCC 2014 Spring" session, for the "Java 8 workshop at Fukuoka".
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Future of Java EE with SE 8 (revised)

hashtag: #j8fk

Future of Java EE with SE 8(Revised)

Jun 14, 2014Hirofumi Iwasakihttp://www.mushagaeshi.com

Java Community @Fukuoka

Page 2: Future of Java EE with SE 8 (revised)

hashtag: #j8fk

2

Speaker Biography

Hirofumi Iwasaki twitter: @HirofumiIwasaki (English)

Carrier Planning, designing & implements for many huge enterprise

systems for financial, manufacturer, public systems with enterprise middleware, especially Java EE & .NET in Japan for about 16 years.

Opus, Lectures, etc. Lectures: Java Day Tokyo 2014, JJUG CCC 2014 Spring, WebLogic

key person roundtable (2012-2013), etc. Magazine: @IT (2005-2010), CIO Magazine (2009), IT Architect

(2005-2009), Web+DB Press (2005), Java World (2001-2004), DB Magazine (2000), etc.

Page 3: Future of Java EE with SE 8 (revised)

hashtag: #j8fk

3

Today’s Topics

1. Status of Adapting Java 8 in EE Servers

2. Java SE 8 Updating - Basic Topics for EE 7

3. Java SE 8 Updating - Advanced Topics for EE 7

Page 4: Future of Java EE with SE 8 (revised)

hashtag: #j8fk

4

8Happy Java 8 Release!

But for Java EE ?

Useful for EE?

Page 5: Future of Java EE with SE 8 (revised)

hashtag: #j8fk

5

1. Status of Adapting Java 8

in EE Servers

Page 6: Future of Java EE with SE 8 (revised)

hashtag: #j8fk

6

What's Java EE (1/2) Standard specifications for application

servers

Commercial

Open Source

etc.

Java EE Specification

Liberty Profile etc.

+

Page 7: Future of Java EE with SE 8 (revised)

hashtag: #j8fk

7

What's Java EE (2/2)

For ENTERPRISE systems (Enterprise Edition) specifications (full profile)

'Enterprise' means transactional. Core architecture is EJB (JTA & CMT) with auto transaction

systems. Transactional connectivity for other systems with JPA (JDBC),

JMS, RMI-IIOP. Web architecture with JSF (Servlet & Facelet), JAX.

Each Java EE specification covers general enterprise requirements.

Not for personal usage. Use Java SE only. Not for build-in usage. Use Java ME. For your enterprise system Use Java EE with Java SE.

Page 8: Future of Java EE with SE 8 (revised)

hashtag: #j8fk

8

The History of Java EE

J2EE 1.2

(1999)

J2EE 1.3

(2001)

J2EE 1.4

(2003)

Java EE 5

(2006)

Java EE 6

(2009)

Java EE 7

(2013)

Born! PandemicEra

IntegrationEra

Mess Era(for EE spec)

Unite to SingleStandard

Again!

Page 10: Future of Java EE with SE 8 (revised)

hashtag: #j8fk

10

Java EE Application Servers VersionsVendor App Server EE 1.4

(2003-) EE 5(2006-)

EE 6(2009-)

EE 7(2013-)

Open Source GlassFish - 2.x 3.x 4.0

Oracle WebLogic 9.x 10.x 12.x -

IBM WebSphere 5.1 6.x, 7.x 8.x -

IBM Liberty Profile

- - 8.5 -

Open Source Geronimo - 2.x 3.x -

Open Source TomEE+ - - 1.x -

Red Hat JBoss 4.x 5.1 7.1 -

Red Hat WildFly - - - 8.0

Fujitsu Interstage 9.0,9.1 9.2,10.x,11.0

11.1 -

Hitachi Cosminexus 7.x 8.x 9.x -The de facto latest version

is still EE 6

Page 11: Future of Java EE with SE 8 (revised)

hashtag: #j8fk

11

Java SE Support of Java EE App ServersVendor App

ServerEE 6 (2009 -) EE 7 (2013-)

Ver. SE Ver. Ver. SE Ver.

Open Source GlassFish 3.x SE 7 4.0 SE 7

Oracle WebLogic 12.1.x SE 6, SE 7 - -

IBM WebSphere 8.x SE 6, SE 7 - -

Open Source Geronimo 3.x SE 6, SE 7 - -

Open Source TomEE+ 1.x SE 7 - -

Red Hat JBoss 7.x SE 6, SE 7 - -

Red Hat WildFly - - 8.0 SE 7, SE 8

Fujitsu Interstage 11.1 SE 6, SE 7 - -

Hitachi Cosminexus 9.x SE 7 - -SE 8 is not thestandard yet

*

* WebLogic 12.1.1 only

Page 12: Future of Java EE with SE 8 (revised)

hashtag: #j8fk

12

Don’t Feel Let Down!Now They’re Adopting!

Page 13: Future of Java EE with SE 8 (revised)

hashtag: #j8fk

13

Nice!

Page 14: Future of Java EE with SE 8 (revised)

hashtag: #j8fk

14

Excellent!

Page 15: Future of Java EE with SE 8 (revised)

hashtag: #j8fk

15

2. Java SE 8 Updates Overview

Basic Topicsfor EE

Page 16: Future of Java EE with SE 8 (revised)

hashtag: #j8fk

16

Java SE 8 New Functions

LambdaD

ate

Tim

e A

PI

New VM

JavaFX

DefaultMethod

Stream APITypeAnnotationImprovement

JavaS

crip

tEn

gin

e

UNICODE6.2

…and others

Page 17: Future of Java EE with SE 8 (revised)

hashtag: #j8fk

17

Java SE 8 Deleted Functions

JDBC-ODBCBridge

com

.su

n.m

isc.*

So long..

Page 18: Future of Java EE with SE 8 (revised)

hashtag: #j8fk

18

SE 8 New Feature – Lambda with Stream API

List<String> aList = Arrays.asList(new String[]{"a", "b", "c", "d", "e"}); // Normalfor (String x : aList) {    System.out.println(x);}  // Lambda with parallel streamaList.parallelStream().forEachOrdered(x -> System.out.println(x));

Stream API(auto parallel threading)

Lambda Expression(just a syntax sugar)

Might not work with EE 7

Page 19: Future of Java EE with SE 8 (revised)

hashtag: #j8fk

19

Lambda with Stream API – Auto Conversion

Don’t worry.NetBeans supports you!

Automatic Conversion

Page 20: Future of Java EE with SE 8 (revised)

hashtag: #j8fk

20

SE 8 New Feature – New Date Time API (Basic)

// Calendar.Calendar cal = Calendar.getInstance(); // Date.int year = cal.get(Calendar.YEAR);int month = cal.get(Calendar.MONTH) + 1;int day = cal.get(Calendar.DAY_OF_MONTH); // Time.int hour = cal.get(Calendar.HOUR);int minutes = cal.get(Calendar.MINUTE);int second = cal.get(Calendar.SECOND);int millisecond = cal.get(Calendar.MILLISECOND);

// Local Date Time.LocalDateTime dateTime = LocalDateTime.now();

// Local Date.LocalDate date = dateTime.toLocalDate();int year = date.getYear();int month = date.getMonthValue();int day = date.getDayOfMonth();DayOfWeek dayOfWeek = date.getDayOfWeek();

// Local Time.LocalTime time = dateTime.toLocalTime();int hour = time.getHour();int minute = time.getMinute();int second = time.getSecond();int nanoSecond = time.getNano();

Java 1.2 – Java 7 Java 8 –

-1

From Millisecond to Nanosecond(.000 .000000000)

Page 21: Future of Java EE with SE 8 (revised)

hashtag: #j8fk

21

SE 8 New Feature – New Date Time API (Calculation)

// Date CalculationCalendar threeWAfter = Calendar.getInstance();threeWAfter.setLenient(false);threeWAfter.add(Calendar.DAY_OF_MONTH, 7 * 3); Calendar fourMBefore = Calendar.getInstance();fourMBefore.setLenient(false);fourMBefore.add(Calendar.MONTH, -4); // Time CalculationCalendar sevenHAfter = Calendar.getInstance();sevenHAfter.setLenient(false);sevenHAfter.add(Calendar.HOUR, 7); Calendar threeMBefore = Calendar.getInstance();threeMBefore.setLenient(false);threeMBefore.add(Calendar.MINUTE, -3);

// Local Date Time.LocalDateTime dateTime = LocalDateTime.now();LocalDate date = dateTime.toLocalDate();LocalTime time = dateTime.toLocalTime();

// Date CalculationLocalDate threeWAfter = date.plusWeeks(3);

LocalDate fourMBefore = date.minusMonths(4);

// Time calculationLocalTime sevenHAfter = time.plusHours(7);

LocalTime threeMBefore = time.minusMinutes(3);

Java 1.2 – Java 7 Java 8 –

Simplified, sophisticated style!

Page 22: Future of Java EE with SE 8 (revised)

hashtag: #j8fk

22

SE 8 New Feature – New Date Time API (JDBC)

ANSI SQL Java SE 8

DATE java.time.LocalDate

TIME java.time.LocalDate

TIMESTAMP java.time.LocalDateTime

TIME WITH TIMEZONE java.time.OffsetTime

TIMESTAMP WITH TIMEZONE java.time.OffsetDateTime

http://www.oracle.com/technetwork/articles/java/jf14-date-time-2125367.html

Might not work with EE 7

Page 23: Future of Java EE with SE 8 (revised)

hashtag: #j8fk

23

SE 8 New Feature – Type Annotation Improvement

Page 24: Future of Java EE with SE 8 (revised)

hashtag: #j8fk

24

SE 8 New Feature – Type Annotation Improvement

Page 25: Future of Java EE with SE 8 (revised)

hashtag: #j8fk

25

Java SE 8 applying pointsfor EE 7

Page 27: Future of Java EE with SE 8 (revised)

hashtag: #j8fk

27

Basic of Applying SE 8 feature in EE 7 Apps

EE 7 didn’t consider the SE 8 in their specification. EE 7 spec don’t know the SE 8.

Many SE 8 new functions might be work correctly if the app server supported the SE 8 as their VM. Lambda expressions Stream APIs (limited) New date time APIs (limited) etc.

Page 28: Future of Java EE with SE 8 (revised)

hashtag: #j8fk

28

Basic of Applying SE 8 feature in EE 7 Apps

But some conflicted specs might not be worked correctly Stream API (multithreading with EJB 3.2, e.g.

parallel stream) New date time APIs (JDBC new mappings with

JPA 2.1) etc.

Wait the Java EE 8 for the full support of SE 8

Page 29: Future of Java EE with SE 8 (revised)

hashtag: #j8fk

29

3. Java SE 8 Updates Overview

Advanced Topicsfor EE

Page 30: Future of Java EE with SE 8 (revised)

hashtag: #j8fk

30

Study of Limitation Casewith SE 8 in EE 7

Page 31: Future of Java EE with SE 8 (revised)

hashtag: #j8fk

31

Let’s take a lookof EJB 3.2 (EE 7)

with Parallel Stream,with Glassfish 4.0.1 beta.

Page 32: Future of Java EE with SE 8 (revised)

hashtag: #j8fk

32

Downloaded from here.

Page 33: Future of Java EE with SE 8 (revised)

hashtag: #j8fk

33

NetBeans 8 detected 4.0.1

Page 34: Future of Java EE with SE 8 (revised)

hashtag: #j8fk

34

NetBeans 8 supported JDK 8

Page 35: Future of Java EE with SE 8 (revised)

hashtag: #j8fk

35

Startup succeededwith NetBeans 8.

Page 36: Future of Java EE with SE 8 (revised)

hashtag: #j8fk

36

Sample Test Application

<EJB>LambdaLogic.java

<CDI Bean> *IndexBean.java

<JSF Facelet> *index.xhtml

*This is just a workaround due to not working Web Services / REST tester

in GlassFish 4.0.1b5.

Page 37: Future of Java EE with SE 8 (revised)

hashtag: #j8fk

37

Wrote Lambda with (Parallel)Stream in EJB

Page 38: Future of Java EE with SE 8 (revised)

hashtag: #j8fk

38

Wrote CDI Bean for Calling EJB

Page 39: Future of Java EE with SE 8 (revised)

hashtag: #j8fk

39

Wrote CDI Bean for Calling EJB

Page 40: Future of Java EE with SE 8 (revised)

hashtag: #j8fk

40

Results

Both Succeeded.

Page 41: Future of Java EE with SE 8 (revised)

hashtag: #j8fk

41

Really?

Allow for allEE Servers?

Page 42: Future of Java EE with SE 8 (revised)

hashtag: #j8fk

42

Test with WebLogic

(but still EE 6…)

Page 43: Future of Java EE with SE 8 (revised)

hashtag: #j8fk

43

Tested Fork/Join Framework

withWebLogic Server 12.1.2

(yet Java EE 6)

Page 44: Future of Java EE with SE 8 (revised)

hashtag: #j8fk

44

Test it with Fork/Join Framework

(from Java SE 7).

*Parallel Streamimplemented with

Fork/Join Framework.

Page 45: Future of Java EE with SE 8 (revised)

hashtag: #j8fk

45

Just a kiddingcode…

Page 46: Future of Java EE with SE 8 (revised)

hashtag: #j8fk

46

UnknownImplementation

Error ???

Page 47: Future of Java EE with SE 8 (revised)

hashtag: #j8fk

47

Just removedthe EJB annotation,

turn to POJO

Page 48: Future of Java EE with SE 8 (revised)

hashtag: #j8fk

48

Works !?Why?????

Page 49: Future of Java EE with SE 8 (revised)

hashtag: #j8fk

49

Let’s Checkthe EJB 3.2 Specification

Page 50: Future of Java EE with SE 8 (revised)

hashtag: #j8fk

50

EJB 3.2 Spec don’t allowed Manual Multithreading

Still not allowed.Oh…

Page 51: Future of Java EE with SE 8 (revised)

hashtag: #j8fk

51

Parallel Stream Uses Fork/Join Framework

Fork/Join framework was introduced in Java SE 7 Not supported in EJB container.

Parallel Stream uses fork/join framework in its implementation

Might not be supported in EJB 3.2 container in EE 7 Some complicated case might not be worked correctly

Exception management case JTA with container managed transaction in parallel loop case @Asynchronous method call in parallel loop Differed transaction isolation level method calling Security management etc.

Page 52: Future of Java EE with SE 8 (revised)

hashtag: #j8fk

52

Conclusion All Java EE 7 app servers are

not supported SE 8 yet, but some simple case are usable with 8.

Many limitation are still existing for applying SE toEE 7, but useful new functions must be improve the stage of your enterprise.

Anyway,Ready to apply SE 8for the Java EE!

8

Page 53: Future of Java EE with SE 8 (revised)

hashtag: #j8fk

53

Information

Approved My Submissions!

Page 54: Future of Java EE with SE 8 (revised)

hashtag: #j8fk

54

JavaOne and Oracle OpenWorld 2014Two Windows !

September 28 – October 2, 2014San Francisco

Conference: Oracle OpenWorldSession ID: CON2820Session Title: Case Study of Financial Web System Development and Operations with Oracle WebLogic 12cConference: JavaOneSession ID: CON2789Session Title: Java EE 6 adoption in one of the world’s largest online financial systems

Come and Join Us!

Page 55: Future of Java EE with SE 8 (revised)

hashtag: #j8fk

55

Thank you for listening

Page 56: Future of Java EE with SE 8 (revised)

hashtag: #j8fk

56

Q&A