KEMBAR78
Java EE's Evolution and Relevance | PDF | Java Platform | Java (Programming Language)
0% found this document useful (0 votes)
174 views41 pages

Java EE's Evolution and Relevance

1) Java EE has a long history but some now claim it is experiencing a midlife crisis due to new languages/technologies and Oracle's acquisition of Sun. 2) However, history shows Java always adapts and the ecosystem remains just as relevant as others through innovations like Contexts and Dependency Injection (CDI). 3) CDI provides type-safe dependency injection and loose coupling through events, allowing new languages to integrate well with Java EE.

Uploaded by

MOSC2010
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
174 views41 pages

Java EE's Evolution and Relevance

1) Java EE has a long history but some now claim it is experiencing a midlife crisis due to new languages/technologies and Oracle's acquisition of Sun. 2) However, history shows Java always adapts and the ecosystem remains just as relevant as others through innovations like Contexts and Dependency Injection (CDI). 3) CDI provides type-safe dependency injection and loose coupling through events, allowing new languages to integrate well with Java EE.

Uploaded by

MOSC2010
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 41

Java EE Midlife Crisis

By
Azrul MADISA
azrul.madisa@my.experian.com

1
A brief history of Java EE

2
3
What’s happening of late

4
 Oracle acquisition of Sun
 The pathetic prophets
 “Java is slipping on tiobe! Java is going to die!!
Would somebody please think of the
children!!”
 Onslaught of new languages/technologies
 Is Java in midlife crisis?

5
What history teaches us

6
Java will always adapt

7
“The simple fact remains, then: Java, the
platform, the ecosystem, the environment and
the development community, stands at least as
far from the Abyss of Irrelevancy as any of the
other languages or platforms currently in use
today” – Ted Neward

8
9
Old and reliable
 Patterns
 Distributed computing
 Messaging
 Transaction
management
 Load balancing

10
New

 Contexts and Dependency


Injection (CDI)
 Java EE + Other JVM languages

11
Context and Dependency
Injection

12
Contexts and Dependency
Inject - CDI
 JSR-299
 Type-safe DI, AOP
and Eventing
 Use annotation a
whole lot to achieve
a whole lot more

13
CDI vs. the world
“…more typesafe than Seam, more
stateful and less XML-centric than
Spring, more web and enterprise
application capable than Guice” – Gavin
King, JSR-299 spec lead

14
CDI Dependency Injection (DI)
 Typesafe
 DI with qualifier

15
CDI – DI example
@MyService(PRODUCTION)
public class ProductionShoppingCart implements
ShoppingCart{…}

@MyService(MOCK)
public class MockShoppingCart implements
ShoppingCart{…}

16
CDI – DI example
 Injecting a shopping cart to a servlet

public class Ecommerce extends HttpServlet {


@Inject @MyService(MOCK) ShoppingCart shoppingCart;
protected void doGet( … ){
//use shopping cart
}
}

17
CDI Eventing
 Light weight eventing
 Decouple sender and recipient
 Similar to JMS
 Can use JMS as a broker

POJO
POJO POJO

18
CDI Eventing
 Create the object to be send

public class MyMessage{


private String content=“Yap! Yap! Yap!”;

}

19
CDI Eventing
 Create a sender

public class Women {


@Inject Event<MyMessage> eventUtility;
public void say(){
MyMessage myMessage = new MyMessage();
eventUtility.fire(myMessage);
}
}

20
CDI Eventing
 Create a listener

public class Men {


public void listen( @Observes MyMessage myMessage){
Logger.log(“Message:"+myMessage.getContent());
}
}

21
Challenge

22
 Java Enterprise Application
 In 1 week
 Alone
 Make it work

23
Problem

24
Enterprise Job Scheduling App

 At a scheduled time
 Launch a business process

25
Enterprise Job Scheduling App
 Examples:
 Telcos
 Every week, all usage data need to be processed.
Invoices and bills need to be created
 Banks
 Every night, all credit card applications for the day need
to be processed
 Insurance
 Underwriting for new applications need to be done every
3 working days

26
27
How it works – Telco example

Aggregate all usage data


Step1
for this month
At 12:00 midnight
Every 15th of a month
For each user, create an
Step2
invoice

Scheduler Step3 Send all invoices for printing

Business Process

28
Challenges in creating a scheduler
 Scheduler need an interface
 Preferable web
 Scheduler should be modifiable
 Scheduler should be loosely coupled from the
BP
 BP can change without affecting the scheduler
 Vice-versa
 Scheduler should use standards as much as
possible
 Standard scheduling expression
29
Challenges in creating a
business process
 BP needs to be scalable
 but cannot be “truly” stateless – since BP are
stateful by nature
 BP needs to be somewhat standard
 The standard, BPEL, is too web-services centric
 BP needs a decent tool
 BP is loosely coupled from jobs
 Jobs can change without affecting BP
 BP can change without affecting jobs

30
Challenges in creating a job
 Job need to be asynchronous
 but need to be chained – i.e. “fire and forget” cannot be
used here
 Job need to be simple to create
 Tool support is needed
 Job need to be a standard artefact
 Easier to recruit people who knows standard stuff
 Testability of a job is crucial
 Job need to be as POJO as possible
 Job contain business logic
 Transaction is crucial

31
Challenges in the system as a
whole
 Load-balancing capable
 Transactional
 Rollback / redo
 Use standard solution wherever possible

32
Answering the challenge

HTTP <<Servlet>> JMS <<MDB>>


Web -------------------------------------
----------------
Scheduler BusinessProcess
-------------------------------------
my_business_process.jpdl.xml

33
Answering the challenge –
transactional jobs
<<MDB>>
JMS <<POJO>>
-------------------
---------------
BusinessProcess
BusinessLogic
Step1 <<MDB>>
---------------
Delegate CDI Event

Step2

Step3
JMS
34
Answering the challenge –
lightweight jobs
<<MDB>>
<<POJO>>
-------------------
---------------
BusinessProcess
BusinessLogic
Step1
CDI Event

Step2

Step3

35
Answering the challenge
 A job:

public class MyBusinessLogicBean{


public void handleEvent(@Observes
@CDIEventSource("MyBusinessLogic") CDIEvent event) {
Map<String, Object> token = event.getToken();
//token = Input/Output
//do some business logic
}
}

36
Delivering promises
 Simplicity
 Job’s a POJO

 Business process is a plain old JPDL

 Scalability
 JMS and asynchronous, event based framework

 Lightweight
 CDI eventing
 Statefulness
 JBPM + Request-response pattern

37
Delivering promises
 Reliability
 Transaction all the way – even in
lightweight mode
 Java EE provided clustering/fallback
 JMS provided load-balancing

Scheduler

MyBP MyBP MyBP


38
Delivering promises
 Loose coupling
 CDI Event  JMS exchangability without
modifying the Business Logic

39
Conclusion
 Java is old and reliable and yet new and
exciting
 Don’t want to use the Java language,
stick to the platform and use :
 Scala
 Groovy
 Anything…
 Java is well, alive and kicking butts …
really hard!

40
Thanks for listening to someone
who is not yet on a midlife crisis

Azrul MADISA
azrul.madisa@my.experian.com

41

You might also like