Download

Post on 04-Nov-2014

535 views 0 download

Tags:

description

 

Transcript of Download

1

Java 2 Enterprise Edition(J2EE)

Presented By: Mohamed Mansour

mansour@cc

2

Notes

• WebSphere lab– Friday (4/21) 1:05-1:55 PM– Room 153 CCB– www.cc.gatech.edu/~mansour/6210.html

3

Outline

• Introduction & Motivation

• Enterprise Applications

• J2EE Architecture

• Server Side Components

• Q&A

4

Enterprise Applications

• Inter-company integration

• Intra-company integration

• Legacy applications

5

Enterprise ApplicationsEnd-User View

eBay.com

hotmail.com

my.SAP.com

6

Enterprise ApplicationsIntra-Enterprise

7

Enterprise ApplicationsInter-Enterprise

8

Challenges

• Interoperability

• Interface Complexity

• System Evolution

• Scalability

• Reliability

• Cost

9

Current Solutions

• Hide complexity in standard application server architectures– .NET, J2EE, other…

• Technology independent interfaces– XML and Web Services

10

J2EE Architecture

11

Web Container

Servlet Object

HTTP Request

HTTP Response

J2EE Web Container

12

Web Container

• Process HTTP requests (POST/GET)• Route to appropriate servlet object• Route HTML reply back to browser• Servlets

– Java classes– Server side

• JSP– Embedded script inside HTML files– Service Side

13

Web Container Services

• Session Management

• Thread Pools

• Object Life Cycle

14

Three-Tier Arch.

Business LayerPresentation

Layer

15

EJB Container Services

• Persistence

• Transactions

• Caching

• Clustering

• Security

16

EJB Types

• Entity Beans– Persistent objects with primary keys– Container Managed Persistence (CMP)– Bean Managed Persistence (BMP)

• Session Beans– Stateless– Stateful

• Message Driven Beans (MDB)

17

Priceline.com

Message queue

Worldspan - Airline Reservations

Expedia.com

Delta.com

clearinghouse

Airlines

18

Request Dispatcher

Large Scale Deployment

19

EJBObject

Interface

RMI-IIOP

JVM 1 JVM 2

Calling Methods on EJBs

ClientServer

20

EJB

JVM 1 JVM 2

Calling Methods on EJBs

ClientServer

JNDI

Home“ejbs/ejb/MyEjbHome”

1. Lookup the home interface

21

EJB

JVM 1 JVM 2

Calling Methods on EJBs contd

ClientServer

JNDI

2. Use Home interface to obtain object interfacefrom server

Home

Home“ejbs/ejb/MyEjbHome”

22

EJB

JVM 1 JVM 2

Calling Methods on EJBs contd

ClientServer

JNDI

3. Use object interface to invoke server methods

Home

Home“ejbs/ejb/MyEjbHome”

Object Interface

23

Code SampleInitialContext ic = new InitialContext();

MyBeanHome home = (MyBeanHome) ic.lookup("java:comp/env/ejb/MyBeanHome")

MyBean b = (MyBean) home.create();

b.foobar();

24

EJB

Home

Object Interface

Local View

HomeObject

Interface

Remote View

Direct calls

RMI-IIOP

JVM 1

JVM 2Local Interfaces in J2EE 2.0

Server

Client

25

EJB ref name: “myEjbRef”JNDI name: “ejbs/ejb/MyEjbHome”EJB

JVM 1 JVM 2

EJB References

ClientServer

JNDI

Home“ejbs/ejb/MyEjbHome”

ic.lookup(“myEjbRef”)

XML configuration file

26

Using Remote Interfaces

Entity Bean

Entity Bean

Entity Bean

Entity BeanClient

RMI-IIOP

EJB Container

27

Using Remote Interfaces

• Network overhead for each call

• Separate transaction for each call– Entity beans have inconsistent state– Recovery must be performed at client side– Extra database statements (even for simple

set methods)

28

Using Local Interfaces

SessionBean

Entity Bean

Entity Bean

Entity Bean

Entity BeanClientRMI-IIOP

EJB Container

29

Q&A

30

References

• http://java.sun.com/products/ejb/

• http://java.sun.com/products/jdk/rmi/

• http://wwws.sun.com/software/jini/

• http://java.sun.com/j2ee/1.4/docs/tutorial/doc/index.html

• http://www.w3.org/2002/ws/

• http://www.onjava.com/pub/a/onjava/2004/11/03/localremote.html

31

Multi-Application Hosting

J2EE Server

App B

App C

App D

App A

App A

• Multiple applications on same server

• Statistical multiplexing over different request types

• Can we provide performance isolation guarantees between different applications?

32

J2EE ServerJ2EE Server

App B

App C

App D

App A

App AApp C

App B

Request Dispatcher

Multi-Application Hosting