SlideShare ist ein Scribd-Unternehmen logo
1 von 28
Downloaden Sie, um offline zu lesen
<Insert Picture Here>




What's New in Enterprise JavaBean Technology ?
Sanjeeb Sahoo
Sr. Staff Engineer, Sun, an Oracle Company
The following/preceding is intended to outline our
general product direction. It is intended for
information purposes only, and may not be
incorporated into any contract. It is not a
commitment to deliver any material, code, or
functionality, and should not be relied upon in
making purchasing decisions.
The development, release, and timing of any
features or functionality described for Oracle’s
products remains at the sole discretion of Oracle.



                                                     2
Agenda


• Introduction               <Insert Picture Here>


• Ease of Use Improvements
• New Functionality




                                               3
EJB 3.0 Specification

• Goal
  • Ease of use
  • Developer productivity

• JSR (Java Specification Request) 220
   • Final Specification – 2006




                                         4
EJB 3.0 Specification

• Metadata via Java annotations
  • Only annotations
  • Only XML DD
  • Both
• Sensible defaults
• POJO friendly
• Simplification of bean types
• No home interface
• Interceptors
• Entity Beans replaced by JPA


                                  5
EJB 3.1 Specification

• Goals
   • Continued focus on ease-of-use
   • New features
• JSR (Java Specification Request) 318
   • Final Specification – December 2009




                                           6
Ease of Use Improvements

• Optional Local Business Interfaces
• Simplified Packaging
• EJB 3.1 “Lite” API
• Portable Global JNDI Names
• Simple Component Testing




                                       7
Session Bean
With “No-interface” View




@Stateless
public class GreetingBean {

    public String greet(String msg) {
        return “Hello “ + msg;
    }
}




                                        8
No-interface View Client


@EJB GreetingBean h;

...

h.greet(“bob”);




                           9
Session Bean
“Interface” View

@Stateless
public class HelloBean implements GreetingBean {
    public String greet(String msg) {
        return “Hello “ + msg;
    }
}


@Stateless
public class HowdyBean implements GreetingBean {
    public String greet(String msg) {
        return “Howdy “ + msg;
    }
}

                                               10
Interface View Client


@EJB(beanName=”HelloBean”) GreetingBean h;
h.greet(“bob”);



@EJB(beanName=”HowdyBean”) GreetingBean h2;
h2.greet(“sam”);




                                              11
JavaTM EE Platform 5 Packaging

        foo.ear                         foo.ear

foo_web.war                      lib/foo_common.jar
                                 com/acme/Foo.class
WEB-INF/web.xml
WEB-INF/classes/
 com/acme/FooServlet.class       foo_web.war
 com/acme/Foo.class
                             O   WEB-INF/web.xml
                                 WEB-INF/classes/
foo_ejb.jar                  R   com/acme/FooServlet.class

com/acme/FooBean.class           foo_ejb.jar
com/acme/Foo.class
                                 com/acme/FooBean.class




                                                             12
Simplified Packaging



               foo.war
        WEB-INF/classes/com/acme/
         FooServlet.class
         FooBean.class




                                    13
EJB 3.1 “Lite”




                 14
Portable EJB JNDI Names

Each session bean gets the following entries :

• Globally unique name
java:global[/<app-name>]/<module-name>/<ejb-
name>

• Unique name within same application
java:app/<module-name>/<ejb-name>

• Unique name within defining module
java:module/<ejb-name>



                                                 15
Session Bean

@Stateless
public class HelloBean implements Hello {
      public String sayHello(String msg) {
        return “Hello “ + msg;
  }
}

If deployed as hello.jar, JNDI entries are:

java:global/hello/HelloBean
java:app/hello/HelloBean
java:module/HelloBean




                                              16
Simple Testing : Session Bean

@Stateless
@Local(Bank.class)
public class BankBean implements Bank {

 @PersistenceContext EntityManager accountDB;

 public String createAccount(AcctDetails d)
     { … }

 public void removeAccount(String acctID)

     { … }




                                                17
Embeddable API


public class BankTester {
  public static void main(String[] args) {

   EJBContainer container =
      EJBContainer.createEJBContainer();

   // Acquire Local EJB reference
   Bank bank = (Bank) container.getContext().
     lookup(“java:global/bank/BankBean”);

   testAccountCreation(bank);
       container.close();




                                                18
Test Client Execution


% java -classpath bankClient.jar :
                  bank.jar :
                  javaee.jar :
                  <vendor_rt>.jar

                  com.acme.BankTester




                                        19
New Features

• Singletons
• Startup / Shutdown callbacks
• Automatic timer creation
  • Cron-like syntax
• Asynchronous session bean invocations




                                          20
Singleton

@Singleton
public class SharedBean {

 private SharedData shared;

 @PostConstruct
 private void init() {
   shared = ...;
 }

 public int getXYZ() {
   return shared.xyz;
 }




                              21
Singleton Concurrency Options

• Single threaded (default)
   • For consistency with all existing bean types
• Container Managed Concurrency
   • Control access via method-level locking metadata
• Bean Managed Concurrency
   • All concurrent invocations have access to bean instance




                                                               22
Startup / Shutdown Callbacks

@Singleton
@Startup
public class StartupBean {

    @PostConstruct
    private void onStartup() { … }

    @PreDestroy
    private void onShutdown() { … }

}




                                      23
Timers

• Automatically created EJB Timers
• Calendar-based Timers – cron like semantics
 • Every Mon & Wed midnight
   @Schedule(dayOfWeek=”Mon,Wed”)
 • 2pm on Last Thur of Nov of every year
   (hour=”14”, dayOfMonth=”Last Thu”,
   month=”Nov”)
 • Every 5 minutes of every hour
   (minute=”*/5”, hour=”*”)
 • Every 10 seconds starting at 30
   (second=”30/10”)
 • Every 14th minute within the hour, for the hours 1 and 2 am
   (minute=”*/14”, hour=”1,2”)
                                                            24
Automatic Timer Creation

@Stateless
public class BankBean {

    @PersistenceContext EntityManager accountDB;
    @Resource javax.mail.Session mailSession;

    // Callback the last day of each month at 8 a.m.

    @Schedule(hour=”8”, dayOfMonth=”Last”)
    void sendMonthlyBankStatements() {
      ...
    }
}




                                                       25
Asynchronous Session Beans
• Control returns to the client before the container
      dispatches invocation to a bean instance
•   @Asynchronous – method or class
•   Return type – void or Future<V>
•   “Fire and and Forget” or async results via
      Future<V>
•   Best effort delivery – persistent delivery
      guarantees are not required by spec
•   Transaction context does not propagate
    • REQUIRED → REQUIRED_NEW
• Security principal propagates
                                                       26
Asynchronous Session Beans
Code Sample
@Stateless
@Asynchronous
public class SimpleAsyncEJB {
    public Future<Integer> addNumbers(int n1, int n2) {
        Integer result;

            result = n1 + n2;
            try {
                // simulate JPA queries + reading file system
                Thread.currentThread().sleep(2000);
            } catch (InterruptedException ex) {
                ex.printStackTrace();
            }

            return new AsyncResult(result);
      }
}



http://blogs.sun.com/arungupta/entry/totd_137_asynchronous_ejb_a


                                                                   27
References


• oracle.com/javaee
• glassfish.org
• oracle.com/goto/glassfish
• blogs.sun.com/theaquarium
• youtube.com/GlassFishVideos
• Follow @glassfish




                                28

Weitere ähnliche Inhalte

Was ist angesagt?

Using Java from Ruby with JRuby IRB
Using Java from Ruby with JRuby IRBUsing Java from Ruby with JRuby IRB
Using Java from Ruby with JRuby IRBHiro Asari
 
Groovy Ecosystem - JFokus 2011 - Guillaume Laforge
Groovy Ecosystem - JFokus 2011 - Guillaume LaforgeGroovy Ecosystem - JFokus 2011 - Guillaume Laforge
Groovy Ecosystem - JFokus 2011 - Guillaume LaforgeGuillaume Laforge
 
Lecture 5 JSTL, custom tags, maven
Lecture 5   JSTL, custom tags, mavenLecture 5   JSTL, custom tags, maven
Lecture 5 JSTL, custom tags, mavenFahad Golra
 
50 New Features of Java EE 7 in 50 minutes @ Devoxx France 2014
50 New Features of Java EE 7 in 50 minutes @ Devoxx France 201450 New Features of Java EE 7 in 50 minutes @ Devoxx France 2014
50 New Features of Java EE 7 in 50 minutes @ Devoxx France 2014Arun Gupta
 
Lecture 2: Servlets
Lecture 2:  ServletsLecture 2:  Servlets
Lecture 2: ServletsFahad Golra
 
50 features of Java EE 7 in 50 minutes at Geecon 2014
50 features of Java EE 7 in 50 minutes at Geecon 201450 features of Java EE 7 in 50 minutes at Geecon 2014
50 features of Java EE 7 in 50 minutes at Geecon 2014Arun Gupta
 
Intsllation & 1st program nodejs
Intsllation & 1st program nodejsIntsllation & 1st program nodejs
Intsllation & 1st program nodejsmonikadeshmane
 
Introduction to OSGi (Tokyo JUG)
Introduction to OSGi (Tokyo JUG)Introduction to OSGi (Tokyo JUG)
Introduction to OSGi (Tokyo JUG)njbartlett
 
50 features of Java EE 7 in 50 minutes at JavaZone 2014
50 features of Java EE 7 in 50 minutes at JavaZone 201450 features of Java EE 7 in 50 minutes at JavaZone 2014
50 features of Java EE 7 in 50 minutes at JavaZone 2014Arun Gupta
 
Nodejs functions & modules
Nodejs functions & modulesNodejs functions & modules
Nodejs functions & modulesmonikadeshmane
 
Web application development using Play Framework (with Java)
Web application development using Play Framework (with Java)Web application development using Play Framework (with Java)
Web application development using Play Framework (with Java)Saeed Zarinfam
 
Gilt Groupe's Selenium 2 Conversion Challenges
Gilt Groupe's Selenium 2 Conversion ChallengesGilt Groupe's Selenium 2 Conversion Challenges
Gilt Groupe's Selenium 2 Conversion ChallengesSauce Labs
 
Puppet Camp London 2014: MCollective as an Integration Layer
Puppet Camp London 2014: MCollective as an Integration LayerPuppet Camp London 2014: MCollective as an Integration Layer
Puppet Camp London 2014: MCollective as an Integration LayerPuppet
 
Spring 3.1 in a Nutshell
Spring 3.1 in a NutshellSpring 3.1 in a Nutshell
Spring 3.1 in a NutshellSam Brannen
 
Introduction to Protractor
Introduction to ProtractorIntroduction to Protractor
Introduction to ProtractorJie-Wei Wu
 
Java EE 7 - Into the Cloud
Java EE 7 - Into the CloudJava EE 7 - Into the Cloud
Java EE 7 - Into the CloudMarkus Eisele
 
Java Unit Testing with Unitils
Java Unit Testing with UnitilsJava Unit Testing with Unitils
Java Unit Testing with UnitilsMikalai Alimenkou
 
Connecting the Worlds of Java and Ruby with JRuby
Connecting the Worlds of Java and Ruby with JRubyConnecting the Worlds of Java and Ruby with JRuby
Connecting the Worlds of Java and Ruby with JRubyNick Sieger
 

Was ist angesagt? (20)

EJB 3.1 and GlassFish v3 Prelude
EJB 3.1 and GlassFish v3 PreludeEJB 3.1 and GlassFish v3 Prelude
EJB 3.1 and GlassFish v3 Prelude
 
Using Java from Ruby with JRuby IRB
Using Java from Ruby with JRuby IRBUsing Java from Ruby with JRuby IRB
Using Java from Ruby with JRuby IRB
 
Groovy Ecosystem - JFokus 2011 - Guillaume Laforge
Groovy Ecosystem - JFokus 2011 - Guillaume LaforgeGroovy Ecosystem - JFokus 2011 - Guillaume Laforge
Groovy Ecosystem - JFokus 2011 - Guillaume Laforge
 
Lecture 5 JSTL, custom tags, maven
Lecture 5   JSTL, custom tags, mavenLecture 5   JSTL, custom tags, maven
Lecture 5 JSTL, custom tags, maven
 
50 New Features of Java EE 7 in 50 minutes @ Devoxx France 2014
50 New Features of Java EE 7 in 50 minutes @ Devoxx France 201450 New Features of Java EE 7 in 50 minutes @ Devoxx France 2014
50 New Features of Java EE 7 in 50 minutes @ Devoxx France 2014
 
Lecture 2: Servlets
Lecture 2:  ServletsLecture 2:  Servlets
Lecture 2: Servlets
 
50 features of Java EE 7 in 50 minutes at Geecon 2014
50 features of Java EE 7 in 50 minutes at Geecon 201450 features of Java EE 7 in 50 minutes at Geecon 2014
50 features of Java EE 7 in 50 minutes at Geecon 2014
 
Java Servlet
Java Servlet Java Servlet
Java Servlet
 
Intsllation & 1st program nodejs
Intsllation & 1st program nodejsIntsllation & 1st program nodejs
Intsllation & 1st program nodejs
 
Introduction to OSGi (Tokyo JUG)
Introduction to OSGi (Tokyo JUG)Introduction to OSGi (Tokyo JUG)
Introduction to OSGi (Tokyo JUG)
 
50 features of Java EE 7 in 50 minutes at JavaZone 2014
50 features of Java EE 7 in 50 minutes at JavaZone 201450 features of Java EE 7 in 50 minutes at JavaZone 2014
50 features of Java EE 7 in 50 minutes at JavaZone 2014
 
Nodejs functions & modules
Nodejs functions & modulesNodejs functions & modules
Nodejs functions & modules
 
Web application development using Play Framework (with Java)
Web application development using Play Framework (with Java)Web application development using Play Framework (with Java)
Web application development using Play Framework (with Java)
 
Gilt Groupe's Selenium 2 Conversion Challenges
Gilt Groupe's Selenium 2 Conversion ChallengesGilt Groupe's Selenium 2 Conversion Challenges
Gilt Groupe's Selenium 2 Conversion Challenges
 
Puppet Camp London 2014: MCollective as an Integration Layer
Puppet Camp London 2014: MCollective as an Integration LayerPuppet Camp London 2014: MCollective as an Integration Layer
Puppet Camp London 2014: MCollective as an Integration Layer
 
Spring 3.1 in a Nutshell
Spring 3.1 in a NutshellSpring 3.1 in a Nutshell
Spring 3.1 in a Nutshell
 
Introduction to Protractor
Introduction to ProtractorIntroduction to Protractor
Introduction to Protractor
 
Java EE 7 - Into the Cloud
Java EE 7 - Into the CloudJava EE 7 - Into the Cloud
Java EE 7 - Into the Cloud
 
Java Unit Testing with Unitils
Java Unit Testing with UnitilsJava Unit Testing with Unitils
Java Unit Testing with Unitils
 
Connecting the Worlds of Java and Ruby with JRuby
Connecting the Worlds of Java and Ruby with JRubyConnecting the Worlds of Java and Ruby with JRuby
Connecting the Worlds of Java and Ruby with JRuby
 

Ähnlich wie What's New in Enterprise JavaBean Technology ?

Ejb3 1 Overview Glassfish Webinar 100208
Ejb3 1 Overview Glassfish Webinar 100208Ejb3 1 Overview Glassfish Webinar 100208
Ejb3 1 Overview Glassfish Webinar 100208Eduardo Pelegri-Llopart
 
What to expect from Java 9
What to expect from Java 9What to expect from Java 9
What to expect from Java 9Ivan Krylov
 
Lecture 8 Enterprise Java Beans (EJB)
Lecture 8  Enterprise Java Beans (EJB)Lecture 8  Enterprise Java Beans (EJB)
Lecture 8 Enterprise Java Beans (EJB)Fahad Golra
 
Java 7 Whats New(), Whats Next() from Oredev
Java 7 Whats New(), Whats Next() from OredevJava 7 Whats New(), Whats Next() from Oredev
Java 7 Whats New(), Whats Next() from OredevMattias Karlsson
 
Micronaut Deep Dive - Devnexus 2019
Micronaut Deep Dive - Devnexus 2019Micronaut Deep Dive - Devnexus 2019
Micronaut Deep Dive - Devnexus 2019graemerocher
 
New Features Of JDK 7
New Features Of JDK 7New Features Of JDK 7
New Features Of JDK 7Deniz Oguz
 
Skillwise EJB3.0 training
Skillwise EJB3.0 trainingSkillwise EJB3.0 training
Skillwise EJB3.0 trainingSkillwise Group
 
Java Future S Ritter
Java Future S RitterJava Future S Ritter
Java Future S Rittercatherinewall
 
Java EE web project introduction
Java EE web project introductionJava EE web project introduction
Java EE web project introductionOndrej Mihályi
 
J2EE - Practical Overview
J2EE - Practical OverviewJ2EE - Practical Overview
J2EE - Practical OverviewSvetlin Nakov
 
The Java EE 6 platform
The Java EE 6 platformThe Java EE 6 platform
The Java EE 6 platformLorraine JUG
 
EJB 3.0 Java Persistence with Oracle TopLink
EJB 3.0 Java Persistence with Oracle TopLinkEJB 3.0 Java Persistence with Oracle TopLink
EJB 3.0 Java Persistence with Oracle TopLinkBill Lyons
 
Back to the future with Java 7 (Geekout June/2011)
Back to the future with Java 7 (Geekout June/2011)Back to the future with Java 7 (Geekout June/2011)
Back to the future with Java 7 (Geekout June/2011)Martijn Verburg
 
Overview of Java EE 6 by Roberto Chinnici at SFJUG
Overview of Java EE 6 by Roberto Chinnici at SFJUGOverview of Java EE 6 by Roberto Chinnici at SFJUG
Overview of Java EE 6 by Roberto Chinnici at SFJUGMarakana Inc.
 
Construire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradleConstruire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradleThierry Wasylczenko
 

Ähnlich wie What's New in Enterprise JavaBean Technology ? (20)

Introduction to EJB
Introduction to EJBIntroduction to EJB
Introduction to EJB
 
Ejb3 1 Overview Glassfish Webinar 100208
Ejb3 1 Overview Glassfish Webinar 100208Ejb3 1 Overview Glassfish Webinar 100208
Ejb3 1 Overview Glassfish Webinar 100208
 
What to expect from Java 9
What to expect from Java 9What to expect from Java 9
What to expect from Java 9
 
Lecture 8 Enterprise Java Beans (EJB)
Lecture 8  Enterprise Java Beans (EJB)Lecture 8  Enterprise Java Beans (EJB)
Lecture 8 Enterprise Java Beans (EJB)
 
Java 7 Whats New(), Whats Next() from Oredev
Java 7 Whats New(), Whats Next() from OredevJava 7 Whats New(), Whats Next() from Oredev
Java 7 Whats New(), Whats Next() from Oredev
 
Micronaut Deep Dive - Devnexus 2019
Micronaut Deep Dive - Devnexus 2019Micronaut Deep Dive - Devnexus 2019
Micronaut Deep Dive - Devnexus 2019
 
New Features Of JDK 7
New Features Of JDK 7New Features Of JDK 7
New Features Of JDK 7
 
Skillwise EJB3.0 training
Skillwise EJB3.0 trainingSkillwise EJB3.0 training
Skillwise EJB3.0 training
 
Java Future S Ritter
Java Future S RitterJava Future S Ritter
Java Future S Ritter
 
J2 Ee Overview
J2 Ee OverviewJ2 Ee Overview
J2 Ee Overview
 
Java EE web project introduction
Java EE web project introductionJava EE web project introduction
Java EE web project introduction
 
J2EE - Practical Overview
J2EE - Practical OverviewJ2EE - Practical Overview
J2EE - Practical Overview
 
The Java EE 6 platform
The Java EE 6 platformThe Java EE 6 platform
The Java EE 6 platform
 
EJB 3.0 Java Persistence with Oracle TopLink
EJB 3.0 Java Persistence with Oracle TopLinkEJB 3.0 Java Persistence with Oracle TopLink
EJB 3.0 Java Persistence with Oracle TopLink
 
Back to the future with Java 7 (Geekout June/2011)
Back to the future with Java 7 (Geekout June/2011)Back to the future with Java 7 (Geekout June/2011)
Back to the future with Java 7 (Geekout June/2011)
 
What's new in Java EE 6
What's new in Java EE 6What's new in Java EE 6
What's new in Java EE 6
 
Ejb examples
Ejb examplesEjb examples
Ejb examples
 
Best Of Jdk 7
Best Of Jdk 7Best Of Jdk 7
Best Of Jdk 7
 
Overview of Java EE 6 by Roberto Chinnici at SFJUG
Overview of Java EE 6 by Roberto Chinnici at SFJUGOverview of Java EE 6 by Roberto Chinnici at SFJUG
Overview of Java EE 6 by Roberto Chinnici at SFJUG
 
Construire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradleConstruire une application JavaFX 8 avec gradle
Construire une application JavaFX 8 avec gradle
 

Kürzlich hochgeladen

Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024The Digital Insurer
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024SynarionITSolutions
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 

Kürzlich hochgeladen (20)

Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 

What's New in Enterprise JavaBean Technology ?

  • 1. <Insert Picture Here> What's New in Enterprise JavaBean Technology ? Sanjeeb Sahoo Sr. Staff Engineer, Sun, an Oracle Company
  • 2. The following/preceding is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions. The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle. 2
  • 3. Agenda • Introduction <Insert Picture Here> • Ease of Use Improvements • New Functionality 3
  • 4. EJB 3.0 Specification • Goal • Ease of use • Developer productivity • JSR (Java Specification Request) 220 • Final Specification – 2006 4
  • 5. EJB 3.0 Specification • Metadata via Java annotations • Only annotations • Only XML DD • Both • Sensible defaults • POJO friendly • Simplification of bean types • No home interface • Interceptors • Entity Beans replaced by JPA 5
  • 6. EJB 3.1 Specification • Goals • Continued focus on ease-of-use • New features • JSR (Java Specification Request) 318 • Final Specification – December 2009 6
  • 7. Ease of Use Improvements • Optional Local Business Interfaces • Simplified Packaging • EJB 3.1 “Lite” API • Portable Global JNDI Names • Simple Component Testing 7
  • 8. Session Bean With “No-interface” View @Stateless public class GreetingBean { public String greet(String msg) { return “Hello “ + msg; } } 8
  • 9. No-interface View Client @EJB GreetingBean h; ... h.greet(“bob”); 9
  • 10. Session Bean “Interface” View @Stateless public class HelloBean implements GreetingBean { public String greet(String msg) { return “Hello “ + msg; } } @Stateless public class HowdyBean implements GreetingBean { public String greet(String msg) { return “Howdy “ + msg; } } 10
  • 11. Interface View Client @EJB(beanName=”HelloBean”) GreetingBean h; h.greet(“bob”); @EJB(beanName=”HowdyBean”) GreetingBean h2; h2.greet(“sam”); 11
  • 12. JavaTM EE Platform 5 Packaging foo.ear foo.ear foo_web.war lib/foo_common.jar com/acme/Foo.class WEB-INF/web.xml WEB-INF/classes/ com/acme/FooServlet.class foo_web.war com/acme/Foo.class O WEB-INF/web.xml WEB-INF/classes/ foo_ejb.jar R com/acme/FooServlet.class com/acme/FooBean.class foo_ejb.jar com/acme/Foo.class com/acme/FooBean.class 12
  • 13. Simplified Packaging foo.war WEB-INF/classes/com/acme/ FooServlet.class FooBean.class 13
  • 15. Portable EJB JNDI Names Each session bean gets the following entries : • Globally unique name java:global[/<app-name>]/<module-name>/<ejb- name> • Unique name within same application java:app/<module-name>/<ejb-name> • Unique name within defining module java:module/<ejb-name> 15
  • 16. Session Bean @Stateless public class HelloBean implements Hello { public String sayHello(String msg) { return “Hello “ + msg; } } If deployed as hello.jar, JNDI entries are: java:global/hello/HelloBean java:app/hello/HelloBean java:module/HelloBean 16
  • 17. Simple Testing : Session Bean @Stateless @Local(Bank.class) public class BankBean implements Bank { @PersistenceContext EntityManager accountDB; public String createAccount(AcctDetails d) { … } public void removeAccount(String acctID) { … } 17
  • 18. Embeddable API public class BankTester { public static void main(String[] args) { EJBContainer container = EJBContainer.createEJBContainer(); // Acquire Local EJB reference Bank bank = (Bank) container.getContext(). lookup(“java:global/bank/BankBean”); testAccountCreation(bank); container.close(); 18
  • 19. Test Client Execution % java -classpath bankClient.jar : bank.jar : javaee.jar : <vendor_rt>.jar com.acme.BankTester 19
  • 20. New Features • Singletons • Startup / Shutdown callbacks • Automatic timer creation • Cron-like syntax • Asynchronous session bean invocations 20
  • 21. Singleton @Singleton public class SharedBean { private SharedData shared; @PostConstruct private void init() { shared = ...; } public int getXYZ() { return shared.xyz; } 21
  • 22. Singleton Concurrency Options • Single threaded (default) • For consistency with all existing bean types • Container Managed Concurrency • Control access via method-level locking metadata • Bean Managed Concurrency • All concurrent invocations have access to bean instance 22
  • 23. Startup / Shutdown Callbacks @Singleton @Startup public class StartupBean { @PostConstruct private void onStartup() { … } @PreDestroy private void onShutdown() { … } } 23
  • 24. Timers • Automatically created EJB Timers • Calendar-based Timers – cron like semantics • Every Mon & Wed midnight @Schedule(dayOfWeek=”Mon,Wed”) • 2pm on Last Thur of Nov of every year (hour=”14”, dayOfMonth=”Last Thu”, month=”Nov”) • Every 5 minutes of every hour (minute=”*/5”, hour=”*”) • Every 10 seconds starting at 30 (second=”30/10”) • Every 14th minute within the hour, for the hours 1 and 2 am (minute=”*/14”, hour=”1,2”) 24
  • 25. Automatic Timer Creation @Stateless public class BankBean { @PersistenceContext EntityManager accountDB; @Resource javax.mail.Session mailSession; // Callback the last day of each month at 8 a.m. @Schedule(hour=”8”, dayOfMonth=”Last”) void sendMonthlyBankStatements() { ... } } 25
  • 26. Asynchronous Session Beans • Control returns to the client before the container dispatches invocation to a bean instance • @Asynchronous – method or class • Return type – void or Future<V> • “Fire and and Forget” or async results via Future<V> • Best effort delivery – persistent delivery guarantees are not required by spec • Transaction context does not propagate • REQUIRED → REQUIRED_NEW • Security principal propagates 26
  • 27. Asynchronous Session Beans Code Sample @Stateless @Asynchronous public class SimpleAsyncEJB { public Future<Integer> addNumbers(int n1, int n2) { Integer result; result = n1 + n2; try { // simulate JPA queries + reading file system Thread.currentThread().sleep(2000); } catch (InterruptedException ex) { ex.printStackTrace(); } return new AsyncResult(result); } } http://blogs.sun.com/arungupta/entry/totd_137_asynchronous_ejb_a 27
  • 28. References • oracle.com/javaee • glassfish.org • oracle.com/goto/glassfish • blogs.sun.com/theaquarium • youtube.com/GlassFishVideos • Follow @glassfish 28