0% found this document useful (0 votes)
192 views5 pages

Session Facade Pattern in Java

The document discusses the session facade design pattern. It describes the problem of a remote client needing to make multiple network calls to interact with different business components. The session facade pattern provides a solution where a session bean acts as a facade, receiving a single call from the client and then calling the various business components locally. This reduces network traffic and increases performance compared to the client directly calling each business component over the network. The session facade itself contains no business logic but coordinates communication between the client and other components.

Uploaded by

Ashok Kumar
Copyright
© © All Rights Reserved
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)
192 views5 pages

Session Facade Pattern in Java

The document discusses the session facade design pattern. It describes the problem of a remote client needing to make multiple network calls to interact with different business components. The session facade pattern provides a solution where a session bean acts as a facade, receiving a single call from the client and then calling the various business components locally. This reduces network traffic and increases performance compared to the client directly calling each business component over the network. The session facade itself contains no business logic but coordinates communication between the client and other components.

Uploaded by

Ashok Kumar
Copyright
© © All Rights Reserved
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/ 5

JAVA Means DURGA SOFT

DURGA SOFTWARE SOLUTIONS ,202 HUDA Maitrivanam, Ameerpet , Hyd. Ph: 040-64512786 Page 1
JAVA Means DURGA SOFT

Session Facade

Problem:
If remote client wants communicate with multiple business components then it has to
use multiple network and remote calls to interact with these multiple business components
that means more network calls will be there between client & business component.

Ex.EJB clients (swing, servlets, JSPs etc) can access entity beans directly. If EJB clients
access entity beans directly over the network, it takes more network calls and imposes network
overhead. The following figure illustrates this process:

DURGA SOFTWARE SOLUTIONS ,202 HUDA Maitrivanam, Ameerpet , Hyd. Ph: 040-64512786 Page 2
JAVA Means DURGA SOFT

Here in the above figure, the servlet calls multiple entity beans directly to accomplish a
business process, thereby increasing the number of network calls.

Solution: Work with Session Façade design pattern. Session façade is a dummy business
component that resides at server side, receives remote call from client and passes that call to
multiple business components of server side locally.

The solution for avoiding number of network calls due to directly accessing multiple
entity beans is to wrap entity beans with session bean (Facade). The EJB client accesses session
bean (Facade) instead of entity beans through coarse grained method call to accomplish a
business process.

The following figure illustrates how the session facade (session bean) acts as an
interceptor between client and entity beans:

DURGA SOFTWARE SOLUTIONS ,202 HUDA Maitrivanam, Ameerpet , Hyd. Ph: 040-64512786 Page 3
JAVA Means DURGA SOFT

Here the client makes only one coarse grained method call to session bean (facade) to process
a business method instead of placing fine grained calls to entity beans. The session bean in turn
calls entity beans to process client request. Entity beans can be made local by implementing
EJB2.0 local interfaces to reduce remote overhead between session facade and entity beans.
Therefore the session facade reduces the network traffic and increases performance.

Note: Here the stateless bean component i.e. acting as session façade does not contain any
business logic but contains logic to communicate with other business components by receiving
calls from the remote client.

Note:

 Synchronous Communication: If client is waiting or sitting idle to perform next


operation until the given request related response comes to client from the server
application then it is called as Synchronous Communication ex: Phone Call
 Asynchronous Communication: If client is free to generate next request or to perform
client side operations without waiting for given request related response from the
server application then it is called as Asynchronous Communication ex: SMS or Chatting
Features

DURGA SOFTWARE SOLUTIONS ,202 HUDA Maitrivanam, Ameerpet , Hyd. Ph: 040-64512786 Page 4
JAVA Means DURGA SOFT

DURGA SOFTWARE SOLUTIONS ,202 HUDA Maitrivanam, Ameerpet , Hyd. Ph: 040-64512786 Page 5

You might also like