Top Banner
The Next Generation Prabhat Jha Principal Engineer
60

The Next Generation - Austin Java Users Group

Feb 03, 2022

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: The Next Generation - Austin Java Users Group

The Next Generation

Prabhat JhaPrincipal Engineer

Page 2: The Next Generation - Austin Java Users Group

What do you wish you had in an Open Source JEE Application Server?

Page 3: The Next Generation - Austin Java Users Group

Faster Startup Time?

Page 4: The Next Generation - Austin Java Users Group

Lighter Memory Footprint?

Page 5: The Next Generation - Austin Java Users Group

Easier Administration?

Page 6: The Next Generation - Austin Java Users Group
Page 7: The Next Generation - Austin Java Users Group

7 Reasons To Love AS7...

Page 8: The Next Generation - Austin Java Users Group

7 Reasons To Love AS7...

• Blazing fast startup time

Page 9: The Next Generation - Austin Java Users Group

7 Reasons To Love AS7...

• Blazing fast startup time

• Lightweight

Page 10: The Next Generation - Austin Java Users Group

7 Reasons To Love AS7...

• Blazing fast startup time

• Lightweight

• Modular core

Page 11: The Next Generation - Austin Java Users Group

7 Reasons To Love AS7...

• Blazing fast startup time

• Lightweight

• Modular core• Hot, parallel deployment

Page 12: The Next Generation - Austin Java Users Group

7 Reasons To Love AS7...

• Blazing fast startup time

• Lightweight

• Modular core• Hot, parallel deployment

• Elegant administration

Page 13: The Next Generation - Austin Java Users Group

7 Reasons To Love AS7...

• Blazing fast startup time

• Lightweight

• Modular core• Hot, parallel deployment

• Elegant administration• Domain management

Page 14: The Next Generation - Austin Java Users Group

7 Reasons To Love AS7...

• Blazing fast startup time

• Lightweight

• Modular core• Hot, parallel deployment

• Elegant administration• Domain management

• First class components

Page 15: The Next Generation - Austin Java Users Group

Bonus for Austin JUG

• Testable by design :-)

Page 16: The Next Generation - Austin Java Users Group

Details

Page 17: The Next Generation - Austin Java Users Group

Blazing Fast Startup Time

Page 18: The Next Generation - Austin Java Users Group

Lightweight Footprint

Page 19: The Next Generation - Austin Java Users Group

New Possibilities

• Execute an entire Java EE container in a unit test !

• Use an appserver VM per application

• Run in constrained environments (light cloud, plug computers, mobile devices)

• Develop faster than you ever have before.

• Run multiple staging servers on your laptop.

Page 20: The Next Generation - Austin Java Users Group

JBoss AS7 Architecture

Page 21: The Next Generation - Austin Java Users Group

Modular Core

Isolated Classes vs.One Size Fits All!

Page 22: The Next Generation - Austin Java Users Group

JBoss Modules• Provides extremely fast modular class loading

– O(1) Dependency resolution

– Concurrent CL (lockless in most VMs)

• “Pure” modular class loading– Modules only see what they import (includes JDK classes!)

• External module definitions– Don’t have to break open the JAR

• Dynamic– Modules can be redefined

• Extensible– JBoss OSGi implemented on modules

Page 23: The Next Generation - Austin Java Users Group

OLD: HierarchicalClassloading

NEW:Modular

Classloading

Page 24: The Next Generation - Austin Java Users Group

User Deployments

• User deployments are modules too

• Sets up dependencies on some modules automatically (e.g. JPA, Hibernate, WebServices)

• The user can also set up their own dependencies on app server modules

Page 25: The Next Generation - Austin Java Users Group

Hot, Parallel Deployment

Services Load Concurrently!

Page 26: The Next Generation - Austin Java Users Group

Services

• In AS7 almost everything is a service

• Services are objects that can be started and stopped

• Services can have dependencies on other services

• When all a services dependencies are satisfied it will attempt to start

• If a dependency going to be stopped, then MSC will stop all dependent services first

• Services can inject dependent services

Page 27: The Next Generation - Austin Java Users Group

Elegant Administration

Page 28: The Next Generation - Austin Java Users Group

First Class Components

• Infinispan

• CDI/Weld

• HornetQ• Hibernate

• JSF

• OSGI

• PicketBox

Page 29: The Next Generation - Austin Java Users Group

EAP 6 – Test Drive Now!

Page 30: The Next Generation - Austin Java Users Group

• Fast and Lightweight

• Supports domain (multi-node) management

• Multiple consistent management interfaces

• CLI, Java API, HTTP API, Console

• Unified, user-focused configuration

• Modular

• Only APIs, no AS implementation exposure

• True isolation

Key Features

Page 31: The Next Generation - Austin Java Users Group

Two Operational Models

Standalone• Traditional JBoss single JVM server

• Management facilities IN-VM

Domain• Multi-JVM, multi-server model

• Management coordinated by Domain Controller Process

• Multiple server instances (JVMs) per Host

• Full lifecycle managed by Process Controller

Page 32: The Next Generation - Austin Java Users Group

Standalone Mode

• Standalone is a single AS process for use in development, where the additional management functionality is not required

• Provides a similar development experience to previous versions of the AS, allowing for a deployment to be dropped in the deployments folder and automatically deployed

• Can still be managed by the same tools and API's as domain mode

Page 33: The Next Generation - Austin Java Users Group

Standalone Mode

Demo

Page 34: The Next Generation - Austin Java Users Group

Domain Mode

• Easy management of multiple AS instances

• Managed from a single point, all have access to the same domain configuration

• Allows for management and configuration updates to be pushed out to all servers

• Domain Mode has three separate processes:– Process Controller

– Host Controller

– Server Instance

Page 35: The Next Generation - Austin Java Users Group

Domain Mode Architecture

Page 36: The Next Generation - Austin Java Users Group

Domain Mode ..

• Multi-server management as a core part of AS 7 /EAP 6 itself– Start/quiesce/stop servers– Rolling deployment to a set of servers– Roll a config change out of a set of servers– Roll back changes

Page 37: The Next Generation - Austin Java Users Group

Domain Model Concepts

• Subsystem : a particular set of capabilities that extend the app server core

– WebServer, Transaction Manager, EJB3

• Profile: the set of subsystem a server or a group of server runs

– Change your profile to expand or narrow the capabilities of your servers

Page 38: The Next Generation - Austin Java Users Group

Management

• ONE configuration file – standalone.xml / domain.xml

• Management API that allows for persistent changes to the configuration

• Management API can manage all servers in the domain

• Management console to provide user friendly management in a web browser

• Command line tool for use in scripts

Page 39: The Next Generation - Austin Java Users Group

Management via Configuration

Page 40: The Next Generation - Austin Java Users Group

Management via API

Page 41: The Next Generation - Austin Java Users Group

Management via CLI

• Scriptable command line management tool

• Uses the management API internally

• Allows access to high level user friendly commands:

create-jms-queue –-name testQueue

• Also allows direct access to the domain model, giving access to the full functionality of the management API

Page 42: The Next Generation - Austin Java Users Group

Testing with Arquillian

• AS7 supports easy testing with ArquillIan

• Arquillian is used both in the internal test suite and by end users to test their applications

• Combined with the fast startup speed of AS7 testing in the container is just as easy as running normal JUnit tests.

Page 43: The Next Generation - Austin Java Users Group

High Octane Development | Automated Testing for Java EE6 | Andrew Lee Rubinger

A simple API for constructing archives as Java objects:

WebArchive archive = ShrinkWrap.create(WebArchive.class,”archive.war”) .addClasses(MyClass.class,MyOtherClass.class, WecomeServlet.class) .addAsResource("mystuff.properties");myServer.deploy(archive); // And done.

Page 44: The Next Generation - Austin Java Users Group

Java EE 6 Intro

• Extensibility

• Profiles

– Subsets of “full” EE platform

– Web Profile

• Pruning

– CMP, JAX-RPC, JAXR, JSR-88 are “pruned” in EE6

• New Technology & Improvements to Existing

– Dependency Injection, CDI, Servlet 3, JPA 2, JSF 2, JAX-RS, Bean Validation

Page 45: The Next Generation - Austin Java Users Group

Servlet 3

• Ease of Development

– Annotations

– Zero configuration in XML for the most part.

• Web framework pluggability

– Programmatic access to web.xml

– Dynamic changes to configuration of webapp

• Async and Commet support

– Non blocking input and output

– Delay request handing

– Delay response close

Page 46: The Next Generation - Austin Java Users Group

Servlet 3

@WebServlet@WebServlet

@WebServlet("/report")

public class ReportServlet extends HttpServlet

@WebFilter@WebFilter

@WebFilter(filterName = "TimeOfDayFilter",

urlPatterns = {"/*"},

initParams = {

@WebInitParam(name = "report", value = "dev")})

public class TimeOfDayFilter implements Filter {

@HttpConstraint @HttpMethodConstraint @MultipartConfig@HttpConstraint @HttpMethodConstraint @MultipartConfig

@ServletSecurity @WebInitParam @WebListener@ServletSecurity @WebInitParam @WebListener

Page 47: The Next Generation - Austin Java Users Group

JSF 2

• Ajax

• Easy component creation

• Bookmarkable URLs

• Templating (think Facelets)

Page 48: The Next Generation - Austin Java Users Group

JPA 2

• O/R mapping enhancements

– Embedded objects, collections, ordered lists

• Query and Entity Manager Enhancements

– First result, max results, typed results

• Criteria API

• 2nd Level Caching

• Pessimistic Locking

Page 49: The Next Generation - Austin Java Users Group

JPA 2 ...

Page 50: The Next Generation - Austin Java Users Group

JAX-RS

• Web services through REST instead of SOAP

• REST counterpart of JAX-WS

• Annotations from ground up

• Integration with CDI and EJB@Path("users/{username: [a-zA-Z][a-zA-Z_0-9]}")

public class HelloWorldResource {

@GET

@Produces("text/xml")

public String getMessage(@PathParam("username") String userName) {

return "Hi” + userName + “!! Howz JBoss AS 7 ??";

}

Page 51: The Next Generation - Austin Java Users Group

EJB 3.1 ( Lite)

• Removal of the requirement for a separate local business interface.

• Support for direct use of EJBs in the servlet container, including simplified packaging options.

• Singleton beans with different locking options.

• Support for asynchronous session bean invocation.

• Application-level callback notifications, including for container initialization and shutdown.

• EJB Timer Service enhancements to support cron-like scheduling, deployment-time timer creation, and stateful session bean timed objects.

• Lite:

– Local Session Bean, Annotation, Security, Interceptors.

– MDB, Timer, Web Services End Point, RMI-IIOP

Page 52: The Next Generation - Austin Java Users Group

EJB 3.1 ( Lite) ...

@javax.ejb.Stateless

public class CarHotelAndAirLineBookingServiceBean {

@javax.ejb.Asynchronous

public Future<BookingConfirmation> bookCarHotelAndAirLine( Car rental, Hotel hotel, AirLine airLine) { ...}

}//end async service

//-------------------------In your JSF bean, you can then do------------------------------

public String makeRequest() {

confirmation = bookingService.bookCarHotelAndAirLine(...);

return "showConfirmationPending";

}

public Future<BookingConfirmation> getConfirmation(){ /* ... */ }

Page 53: The Next Generation - Austin Java Users Group

EJB 3.1 ( Lite)

• Removal of the requirement for a separate local business interface.

• Support for direct use of EJBs in the servlet container, including simplified packaging options.

• Singleton beans with different locking options.

• Support for asynchronous session bean invocation.

• Application-level callback notifications, including for container initialization and shutdown.

• EJB Timer Service enhancements to support cron-like scheduling, deployment-time timer creation, and stateful session bean timed objects.

• Lite:

– Local Session Bean, Annotation, Security, Interceptors.

– MDB, Timer, Web Services End Point, RMI-IIOP

Page 54: The Next Generation - Austin Java Users Group

Bean Validation

• Specify constraints only once across application layers @NotNull

@Size(min = 1, max = 25)

@Pattern(regexp = "[A-Za-z ]*", message = "must contain only letters and spaces")

private String name;

@NotNull

@Size(min = 10, max = 12)

@Digits(fraction = 0, integer = 12)

private String phoneNumber;

Page 55: The Next Generation - Austin Java Users Group

CDI

• Makes Java EE development more productive. !!

• Provides a declarative way to manage the scope, state and life-cycle of components bound to contexts.

• Provides a standardised, annotation-driven, type-safe dependency injection framework for the platform .

• Provides a Service Provider Interface (SPI) for developing portable extensions for the Java EE platform

• What is CDI aka JSR-299's relationship with respect to JSR-330, Dependency Injection?

Page 56: The Next Generation - Austin Java Users Group
Page 57: The Next Generation - Austin Java Users Group

Community or Enterprise?

Page 58: The Next Generation - Austin Java Users Group

Community or Enterprise?

Page 59: The Next Generation - Austin Java Users Group

Demo

• Administration Console

• Domain Model

• Quickstart with maven archetype• Deployments

• OpenShift mvn archetype:generate \-DarchetypeArtifactId=jboss-javaee6-webapp \-DarchetypeGroupId=org.jboss.spec.archetypes \-DarchetypeVersion=7.0.0.CR1 \-DarchetypeRepository=repository.jboss.org/ nexus/content/groups/public

mvn archetype:generate \-DarchetypeArtifactId=jboss-javaee6-webapp \-DarchetypeGroupId=org.jboss.spec.archetypes \-DarchetypeVersion=7.0.0.CR1 \-DarchetypeRepository=repository.jboss.org/ nexus/content/groups/public

Page 60: The Next Generation - Austin Java Users Group

OpenShift – EE6 In the Cloud!