Collaborate Lesson 4C / Slide 1 of 22 Collaborate Knowledge Byte In this section, you will learn about: The EJB timer service Message linking in EJB 2.1.

Slides:



Advertisements
Similar presentations
J0 1 Marco Ronchetti - Basi di Dati Web e Distribuite – Laurea Specialistica in Informatica – Università di Trento.
Advertisements

11 Copyright © 2005, Oracle. All rights reserved. Creating the Business Tier: Enterprise JavaBeans.
CCNA – Network Fundamentals
Acknowledgments Byron Bush, Scott S. Hilpert and Lee, JeongKyu
Lesson 17: Configuring Security Policies
15.1 © 2004 Pearson Education, Inc. Exam Managing and Maintaining a Microsoft® Windows® Server 2003 Environment Lesson 15: Configuring a Windows.
Approaches to EJB Replication. Overview J2EE architecture –EJB, components, services Replication –Clustering, container, application Conclusions –Advantages.
28.2 Functionality Application Software Provides Applications supply the high-level services that user access, and determine how users perceive the capabilities.
Component Patterns – Architecture and Applications with EJB copyright © 2001, MATHEMA AG Component Patterns Architecture and Applications with EJB JavaForum.
Enterprise Applications & Java/J2EE Technologies Dr. Douglas C. Schmidt Professor of EECS.
JMS Java Message Service Instructor Professor: Charles Tappert By Student: Amr Fouda.
ECSE Software Engineering 1I HO 7 © HY 2012 Lecture 7 Publish/Subscribe.
Version # Software Engineering Institute Carnegie Mellon University Pittsburgh, PA Sponsored by the U.S. Department of Defense © 1999 by Carnegie.
TRANSACTION PROCESSING TECHNIQUES BY SON NGUYEN VIJAY RAO.
Service Broker Lesson 11. Skills Matrix Service Broker Service Broker, provides a solution to common problems with message delivery and consistency that.
Emmanuel Cecchet et al.  Performance Scalability of J2EE application servers.  Test effect of: ◦ Application Implementation Methods ◦ Container Design.
High-Availability Methods Lesson 25. Skills Matrix.
1 J2EE Components. 2 Application Servers relieve the programming burden for business distributed components. They provide support for system level services.
© 2008 Cisco Systems, Inc. All rights reserved.Cisco ConfidentialPresentation_ID 1 Chapter 7: Transport Layer Introduction to Networking.
Container-Managed Persistence (CMP) Entity Beans Lesson 3A / Slide 1 of 42J2EE Server Components Objectives In this lesson, you will learn to: Identify.
By Lecturer / Aisha Dawood 1.  You can control the number of dispatcher processes in the instance. Unlike the number of shared servers, the number of.
Enterprise Java Bean Matt. 2 J2EE 3 J2EE Overview.
Enterprise JavaBeans. Lesson 1: Introduction to Server-Side Component Software.
EJB Framework.  As we know, EJB is the center of the J2EE architecture that provides a sturdy framework for building enterprise applications. The major.
Message-Driven Beans and EJB Security Lesson 4B / Slide 1 of 37 J2EE Server Components Objectives In this lesson, you will learn about: Identify features.
第十四章 J2EE 入门 Introduction What is J2EE ?
J2EE Structure & Definitions Catie Welsh CSE 432
J2EE Overview ver 1.0Page 1 © Wipro Technologies Talent Transformation J2EE Overview.
Computer Emergency Notification System (CENS)
1cs Intersection of Concurrent Accesses A fundamental property of Web sites: Concurrent accesses by multiple users Concurrent accesses intersect.
OCT 1 Master of Information System Management Organizational Communications and Distributed Object Technologies Lecture 5: JMS.
Databases JDBC (Java Database Connectivity) –Thin clients – servlet,JavaServer Pages (JSP) –Thick clients – RMI to remote databases –most recommended way.
1 Java EE Programming Enterprise JavaBeans. 2 Topics J2EE Overview Enterprise JavaBeans Overview Enterprise Entity Beans Case Study How to build them.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 JSP Application Models.
What is J2EE Platform The Java 2 Platform Enterprise Edition (J2EE) defines the standard for developing multitier enterprise applications.
CSI 3125, Preliminaries, page 1 SERVLET. CSI 3125, Preliminaries, page 2 SERVLET A servlet is a server-side software program, written in Java code, that.
Java Message Service (JMS) Web Apps and Services.
Lecture 4 Mechanisms & Kernel for NOSs. Mechanisms for Network Operating Systems  Network operating systems provide three basic mechanisms that support.
Component Patterns – Architecture and Applications with EJB copyright © 2001, MATHEMA AG Component Patterns Architecture and Applications with EJB Markus.
Introduction to EJB. What is an EJB ?  An enterprise java bean is a server-side component that encapsulates the business logic of an application. By.
Java Programming: Advanced Topics 1 Enterprise JavaBeans Chapter 14.
Enterprise Java Beans N.V.RAJASEKHAR REDDY. Definition of EJB EJBs are the components that are the set of classes and interfaces deployed within a container.
1 Configuring Sites Configuring Site Settings Configuring Inter-Site Replication Troubleshooting Replication Maintaining Server Settings.
Copyright © 2002 ProsoftTraining. All rights reserved. Enterprise JavaBeans.
©NIIT Introducing Enterprise JavaBeans (EJB) Lesson 1A / Slide 1 of 43J2EE Server Components Objectives In this lesson, you will learn about: The features.
Module 6: Administering Reporting Services. Overview Server Administration Performance and Reliability Monitoring Database Administration Security Administration.
Enterprise JavaBeans. Lesson 1: Introduction to Server-Side Component Software.
Middleware Technology (J2EE/EJB) EJB Fundamentals.
EJB Enterprise Java Beans JAVA Enterprise Edition
Securing Web Applications Lesson 4B / Slide 1 of 34 J2EE Web Components Pre-assessment Questions 1. Identify the correct return type returned by the doStartTag()
Module 5: Managing Content. Overview Publishing Content Executing Reports Creating Cached Instances Creating Snapshots and Report History Creating Subscriptions.
September 28, 2010COMS W41561 COMS W4156: Advanced Software Engineering Prof. Gail Kaiser
EJB. Introduction Enterprise Java Beans is a specification for creating server- side scalable, transactional, multi-user secure enterprise-level applications.
©NIIT Session Beans Lesson 1B/ Slide 1 of 37J2EE Server Components Objectives In this lesson, you will learn to: Describe the characteristics of session.
Enterprise Java Beans. Contents  Understanding EJBs  Practice Section.
SQL Database Management
Introduction to J2EE Architecture
Knowledge Byte In this section, you will learn about:
Harjutus 3: Aünkroonne hajussüsteemi päring
Objectives In this lesson, you will learn to:
Objectives In this lesson you will learn about: Need for servlets
Knowledge Byte In this section, you will learn about:
Component-based Applications
Understanding and Designing with EJB
J2EE Lecture 13: JMS and WebSocket
Enterprise Java Beans.
Overview Multimedia: The Role of WINS in the Network Infrastructure
Knowledge Byte In this section, you will learn about:
Objectives In this lesson, you will learn about:
Presentation transcript:

Collaborate Lesson 4C / Slide 1 of 22 Collaborate Knowledge Byte In this section, you will learn about: The EJB timer service Message linking in EJB 2.1

Collaborate Lesson 4C / Slide 2 of 22 Collaborate The EJB Timer Service The EJB Timer Service: Was introduced in EJB 2.1 specification. Enables you to inform an enterprise bean when a specified time interval has passed. The javax.ejb package contains the following interfaces to use the various timer services: TimedObject : Declares the ejbTimeout() method that notifies an enterprise bean when a scheduled timer event related to the an enterprise bean occurs. Timer : Contains the various methods that enable you to retrieve information about a timer. TimerHandle : Declares the getTimer() method that enables you to retrieve a reference to the timer attached to the current handle. TimerService : Declares various methods that provide access to the EJB container’s timer services.

Collaborate Lesson 4C / Slide 3 of 22 Collaborate The EJB Timer Service (Contd.) Operations performed on a Timer object instance during its life cycle are: Creating: A Timer object is created by using the createTimer() method of the TimerService interface. Saving: A Timer object is saved when the EJB container either shuts down or crashes. Restoring: A Timer object is reactivated when either the EJB container restarts or when the getTimer() method is invoked. Destroying: A Timer object is cancelled when the specified time interval of the Timer object ends. Timer objects can also be cancelled when either EJB container cancels the timer or the Timer object itself calls the cancel() method.

Collaborate Lesson 4C / Slide 4 of 22 Collaborate Message Linking in EJB 2.1 Message linking: Is a new feature introduced in EJB 2.1 specification. Allows the forwarding of messages sent by an enterprise bean to a message-driven bean. Enables you to define the flow of messages between various enterprise beans and message-driven beans of an EJB application. Between an enterprise bean and a message-driven bean is performed using the deployment descriptor tag.

Collaborate Lesson 4C / Slide 5 of 22 Collaborate Message Linking in EJB 2.1 (Contd.) The steps to perform the message linking in EJB are: 1.Specify the JMS destination name in the deployment descriptor of the enterprise bean that will send the messages. The destination name is specified in the tag of the deployment descriptor. 2.Specify the destination name in the. Destination name is specified inside the in the of the message sending enterprise bean. 3.Specify the destination name in the tag of the deployment descriptor of message-driven bean.

Collaborate Lesson 4C / Slide 6 of 22 Collaborate From the Expert’s Desk In this section, you will learn: Best Practice on: Improving EJB Transaction Performance by Setting Optimal Transaction Time Limit Tips and Tricks on: Specifying Optimum Size of Pool in Message-Driven Beans JMS Tuning Techniques Isolation Levels in Transactions FAQs on message-driven beans and and EJB security

Collaborate Lesson 4C / Slide 7 of 22 Collaborate Best Practices Improving EJB Transaction Performance by Setting Optimal Transaction Time Limit You can improve a transaction’s performance in EJB by setting an optimum time limit for the transaction to complete. This technique improves the speed and performance of an EJB application by closing the transactions that exceed the specified time limit. You specify the time limit of a transaction in the timeout-in-seconds property of the domain.xml file. The default time out value of a transaction is 0, which specifies that the transaction will never time out. To achieve optimum transaction performance, you need to set the appropriate time out value according to the maximum expected time of the completion of your transaction.

Collaborate Lesson 4C / Slide 8 of 22 Collaborate Tips and Tricks Specifying Optimum Size of Pool in Message-driven Beans The processes of creating and destroying a message-driven bean are resource-intensive and slow. As a result, EJB container maintains a pool of bean instances and uses one of these instances when a message is received. You can specify the number of instances that should exist in a message- driven bean pool. EJB container maintains this number by adding and deleting instances according to the number of incoming messages. You should specify the optimum pool size so that the incoming messages do not have to wait in the middle layer. The pool size should not be too large because it uses server resources and slows it down. You can ensure optimum server performance by specifying the pool size as equal to the maximum expected number of concurrently arriving messages.

Collaborate Lesson 4C / Slide 9 of 22 Collaborate Tips and Tricks JMS Tuning Techniques You can optimize the performance of JMS messaging by using the following techniques: Optimize the connection between the JMS producer and consumer Optimize the session Select an appropriate type of destination Optimize the JMS producer and consumer Optimize the message Select the appropriate JMS server

Collaborate Lesson 4C / Slide 10 of 22 Collaborate Tips and Tricks JMS Tuning Techniques (Contd.) Optimizing the Connection A Connection object represents an active connection between the JMS producer and JMS consumer. A Connection object implements the Connection interface and is created using the ConnectionFactory object. You can use the following techniques to optimize the performance of a JMS connection: Start the connection when required. Execute several messages concurrently. Release resources when finished.

Collaborate Lesson 4C / Slide 11 of 22 Collaborate Tips and Tricks JMS Tuning Techniques (Contd.) Optimizing the Session The JMS producers, consumers, and messages, are created in a Session object. Sessions implement the Session interface. Optimization techniques while creating and using Session objects: Choose appropriate acknowledgement mode: The Session objects have three types of acknowledgement modes: AUTO_ACKNOWLEDGE : In this mode, the server automatically acknowledges the messages when they are received. CLIENT_ACKNOWLEDGE : In this mode, the sender waits for the acknowledgement before sending next message. DUPS_OK_ACKNOWLEDGE : In this mode, the sender sends a message several times to the server in order to ensure the delivery of the message.

Collaborate Lesson 4C / Slide 12 of 22 Collaborate Tips and Tricks JMS Tuning Techniques (Contd.) Create separate Session objects for transactional and non transactional message types. Close the session when finished: You need to close a session when messaging is complete, to free the server and network resources associated with the session. Selecting Appropriate Type of Destination To optimize the performance of messaging, you can configure various features of the destination, such as maximum storage space, maximum number of messages, and priority of messages.

Collaborate Lesson 4C / Slide 13 of 22 Collaborate Tips and Tricks JMS Tuning Techniques (Contd.) Optimizing the JMS Producer and Consumer Select the appropriate delivery mode: You can select the delivery mode of the messages as durable or non durable. Select asynchronous messages: JMS supports messaging in two modes, synchronous and asynchronous. To improve the performance of JMS messaging, you need to use asynchronous messaging whenever possible.

Collaborate Lesson 4C / Slide 14 of 22 Collaborate Tips and Tricks JMS Tuning Techniques (Contd.) Optimizing the Message A message contains the information that you need to communicate between two Java components and is implemented using the Message object. JMS defines five types of Message objects: Text, Object, Byte, Stream, and Map. Each message type has certain characteristics that make it suitable for a particular type of communication. You need to select the suitable message type that fulfills the communication requirements of your application.

Collaborate Lesson 4C / Slide 15 of 22 Collaborate Tips and Tricks JMS Tuning Techniques (Contd.) Selecting the JMS server type There are various types of JMS servers. You need to select the JMS server that best suits your messaging requirements. Features to determine the suitability of the JMS server for your messaging needs Whether the server supports the clustering or not. Maximum number of open connections required concurrently. Frequency of incoming messages. Type and size of incoming messages. Whether to use the durable or non-durable delivery mode.

Collaborate Lesson 4C / Slide 16 of 22 Collaborate Tips and Tricks JMS Tuning Techniques (Contd.) Isolation Levels in Transactions Transactions isolate the data that is being modified by the statements inside it. The data is isolated so that other transactions do not read the wrong values that might result from an unsuccessful transaction. EJB specification enables you to define the isolation levels that control the degree to which the data being used in a transaction is visible to other transactions. You need to choose the appropriate isolation level based on the data consistency and the performance requirements of your application.

Collaborate Lesson 4C / Slide 17 of 22 Collaborate Tips and Tricks JMS Tuning Techniques (Contd.) EJB defines four transaction isolation levels: READ UNCOMMITTED : This level imposes no restrictions on concurrent transactions. READ COMMITTED : This isolation level allows reading of data that is written by a committed transaction. In this mode, a transaction cannot read the data that is still being used by another transaction. REPEATABLE READ : This isolation level ensures that the data does not change between two consecutive reads from the same transaction. SERIALIZABLE READ : In this mode, the transactions run in a serialized form, that is one after another. The processes also do not share any data with one another.

Collaborate Lesson 4C / Slide 18 of 22 Collaborate FAQs Why are the message-driven beans used to transfer messages between the components of a J2EE application? Remote Method Invocation (RMI) has the disadvantage that it can only support one message sender and one message receiver and the delivery of message to the receiver is not guaranteed. The message-driven beans solve this problem by using JMS API, which supports asynchronous messaging between multiple senders and multiple receivers. Using message-driven beans, messaging process is faster as compared to RMI because the message-driven beans use fewer server resources and the senders do not wait for the acknowledgement from the receiver. What are the two interfaces implemented by a message-driven bean class? The message-driven bean class implements two interfaces, javax.ejb.MessageDrivenBean and javax.jms.MessageListener.

Collaborate Lesson 4C / Slide 19 of 22 Collaborate FAQs (Contd.) What are the transaction attributes of container-managed transactions? Transaction attributes are used to declare how the transactions are handled in CMP enterprise beans. Various transaction attributes are: Required, RequiresNew, Supports, Mandatory, NotSupported, and Never What are the two types of security techniques in EJB? EJB security consists of two techniques, authentication and authorization. Authentication involves checking the identity of the client that logs on to the application server to access an application. Authorization involves checking that the clients perform only those operations that they are allowed to perform.

Collaborate Lesson 4C / Slide 20 of 22 Collaborate FAQs (Contd.) Which API is used to implement security in EJB? Security in EJB is implemented using the java.security interface. How can you declare method permissions for EJB-tier resources? The method permission for EJB-tier resource is declared using the tag in the deployment descriptor.

Collaborate Lesson 4C / Slide 21 of 22 Collaborate Challenge 1.Message-driven beans are configured to select messages using the ___________ deployment descriptor tag. 2.The transaction attribute to ensure that a new transaction is started is ____________. 3.To participate in a transaction, a session bean must implement the ____________ interface. 4.The __________ method verifies the security role of an EJB client. 5.The ______________ exception is thrown if an enterprise bean fails in the authentication and authorization process. 6.Which tag of the deployment descriptor is used to set the transaction type of EJB transactions? 7.Which enterprise beans can manage their own transactions?

Collaborate Lesson 4C / Slide 22 of 22 Collaborate Solutions to Challenge 1. 2.RequiresNew 3.javax.ejb.SessionSynchronization interface 4.isCallerInRole(String role) 5.java.lang.SecurityException 6. 7.Bean managed transaction