Architecture

  • November 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Architecture as PDF for free.

More details

  • Words: 1,685
  • Pages: 15
Professional Open Source™

Architecture Overview JBoss Microkernel for Java Middleware

© JBoss, Inc. 2003-2005.

8/2/2005

1

Topics Professional Open Source™

– – – – – –

JBoss Microkernel Services in Microkernel Deployer Architecture Classloaders Architecture JBoss Invokers Smart Proxies and Client Interceptors

© JBoss, Inc. 2003-2005.

2

1

JMX Architecture: Microkernel Professional Open Source™

What is a Java microkernel? – A stripped down core capable of • Loading services dynamically (classes included) • Manage services lifecycle • Provide naming and lookup • Provide an invocation bus • Decouples the services

That role in JBoss is taken by JMX MBean server – JBossMX at the core – JMX architecture provides the decoupling

3

© JBoss, Inc. 2003-2005.

JMX Architecture: MBean Server Professional Open Source™

MBean Server acts as a mediator – Services are referenced via object names – MBean Server contains a registry of services

JBoss:name=ServiceA

JBoss:name=ServiceB

Service Service B B

© JBoss, Inc. 2003-2005.

MBean Server Server MBean

Service Service A A

JBoss:name=ServiceC

Service Service C C

4

2

JMX Architecture: Invocation Professional Open Source™

Invocation has no direct reference, services are loosely coupled – Kernel manages the service references in case of updates, etc. setAttribute(ObjectName, Attribute)

JBoss:name=ServiceA

lookup

MBean Registry

MBean Server Server MBean

Service Service A A

JBoss:name=ServiceC

Service Service C C Version Version 1.0 1.0 JBoss:name=ServiceC

JBoss:name=ServiceC

Java Reference

JBoss:name=ServiceA

...

...

Service Service C C Version Version 1.1 1.1

...

5

© JBoss, Inc. 2003-2005.

JMX Architecture: Metadata Professional Open Source™

Service exposes its interface as metadata – No compile-time typed Java interfaces – Metadata can be extended to clarify the interface contract – Interfaces can evolve at run-time without recompilation

Operations Notifications JBoss:name=ServiceA

MBean Server Server MBean

Attributes

JBoss:name=ServiceC

Service Service C C getMBeanInfo

Service Service A A

© JBoss, Inc. 2003-2005.

6

3

JMX Architecture: Type System Professional Open Source™

Invocations are not typed at compile time, compiler won’t catch errors – Same problem as with using Java reflection

invoke(object name, “shutdown”)

MBean Server Server MBean

Service Service A A

Service Service C C shutdown()

You win: flexibility in the framework which gives you 24x7 uptime You lose: safety net provided by Java compilers – You still have type safety at run-time (JVM)

7

© JBoss, Inc. 2003-2005.

JMX Microkernel Architecture Professional Open Source™

All services in JBoss are JMX MBeans. – Services are registered to the MBean Server.

MBean Server acts as an invocation bus between the services – Decouples the services enabling hot- and redeployment of all server parts – All invocations to MBeans should go through the MBean server – GOF: Mediator pattern

Service interfaces are defined via run-time object structure – Services don’t expose Java interfaces

MBean should not expose a Java reference to itself – Instead the kernel internally handles references and uses logical object names

© JBoss, Inc. 2003-2005.

8

4

Professional Open Source™

JBoss Deployers Loading Services and Applications to JBoss

© JBoss, Inc. 2003-2005.

8/2/2005

9

JBoss Deployers Professional Open Source™

Deployers enable you to load any class/service/application to JBoss – Support for remote loading – Support for arbitrary “Russian Doll” packaging – Creates a classloader per top-level deployment

Deployers are services registered to the microkernel

Service Service Archive Archive

Enterprise Enterprise Archive Archive

Resource Resource Adapter Adapter

Web Web Archive Archive

© JBoss, Inc. 2003-2005.

Java Java Archive Archive

EJB EJB Archive Archive

10

5

JBoss Deployers Professional Open Source™

MainDeployer coordinates package specific deployers – Service archive (SAR) and Java class library (JAR) deployers are part of the microkernel

Pluggable deployers – – – – –

EAR Deployer WAR Deployer EJB Deployer RAR Deployer BeanShell Deployer

Microkernel 1 addDeployer(this)

MainDeployer MainDeployer

SubDeployer SubDeployer

– Custom Deployers (extend SubDeployerSupport)

11

© JBoss, Inc. 2003-2005.

Deployers: Bringing in the Services Professional Open Source™

Deployers take packaged types and deploy the corresponding applications and services – They are all MBeans at the end of the day

Microkernel 2 Deploy(URL) DeploymentScanner DeploymentScanner

MainDeployer MainDeployer

SARDeployer SARDeployer EJBDeployer EJBDeployer

1 Scan URL 3 accepts(DeploymentInfo)

WARDeployer WARDeployer

*.WAR

© JBoss, Inc. 2003-2005.

12

6

Deployers: Bringing in the Services Professional Open Source™

Microkernel

DeploymentScanner DeploymentScanner

Transaction Transaction Service Service

SARDeployer SARDeployer EARDeployer EARDeployer

MainDeployer MainDeployer

Message MessageService Service

EJBDeployer EJBDeployer

Security SecurityService Service

WARDeployer WARDeployer

Naming NamingService Service EJB EJBContainers Containers Data DataSources Sources

*.xAR

13

© JBoss, Inc. 2003-2005.

Deployers: Working from the Network Professional Open Source™

Machine 1

Machine 2

Microkernel

Microkernel

DeploymentScanner DeploymentScanner

Load Services

DeploymentScanner DeploymentScanner

MainDeployer MainDeployer

MainDeployer MainDeployer HTTP Scan

Web Server Administrator

© JBoss, Inc. 2003-2005.

HTTP Scan

Deployment Packages

14

7

Professional Open Source™

JBoss Classloader Architecture Shared Class Repositories and Java Runtime Type System

© JBoss, Inc. 2003-2005.

8/2/2005

15

JBoss 4.x Classloader Architecture Professional Open Source™

JBoss deployers create a new classloader per top level deployment Each deploy or redeploy operation creates a new classloader – It is not possible to “unload” an existing class definition – In future may be possible to redefine a class (also dynamically relink references of an existing instance of a class)

CL CL

Top Level Deployment

The JBoss classloading architecture manages the classloaders to avoid type conflicts (where possible) – These classloaders potentially have duplicate class definitions – Classloaders are added to repositories

Nested Deployments © JBoss, Inc. 2003-2005.

16

8

JBoss 4.x Classloader Repository Professional Open Source™

JBoss defines classloading domains Within a classloading domain a class is identified by its fully qualified class name – Any given class can have only one defining classloader within the domain – We return to the intuitive Java notion that class is identified by its name

Within a classloading domain we can safely use references – We know that a given class name can only have one defining loader – Essential for performance!

Loader Loader Repository Repository Class is identified Java Java Class Class by its name in the classloading domain

17

© JBoss, Inc. 2003-2005.

Scoped Repositories Professional Open Source™

Parent Repository Shared JARs

Scoped Repository

Scoped Repository

EAR

© JBoss, Inc. 2003-2005.

EJB-JAR

SAR

18

9

Professional Open Source™

Server Interceptors and Invokers Adding Behavior and Remoteness to Services

© JBoss, Inc. 2003-2005.

8/2/2005

19

Server Side Interceptors Professional Open Source™

A detyped flow allows for arbitrary interposition – In JBoss you can have interceptors either for MBean services or per EJB container (a container is an MBean with interceptors) – Perfect for system level issues Cache

Transaction

Direct Call

Security Lock

© JBoss, Inc. 2003-2005.

Call Call

Relation Relation

Connection Connection

Cache Cache

Lock Lock

Synchronization Synchronization

Interposition

Transaction Transaction

Invocation

Security Security

Synchronization

Bean Implementation 20

10

JBoss Invokers Professional Open Source™

Services in JBoss exist independently of connectors – To access services from an external process, a special invoker service must be added to the microkernel Server JVM Invocation

MBean

MBean

JMX Microkernel Microkernel JMX

MBean

21

© JBoss, Inc. 2003-2005.

JBoss Invokers Professional Open Source™

New invokers can be added dynamically – Invokers themselves are MBeans Server JVM

Invoker extracts the target name and lets the kernel route the invocation

Service MBean

Port 1234

RemoteInvoker RemoteInvoker

Invocation

Port 4321

– They may support different protocols (JRMP, IIOP, HTTP, SOAP, Custom Socket, etc.) – You can create your own for your specific needs – Each invoker binds itself to a physical port on the node

© JBoss, Inc. 2003-2005.

RemoteInvoker RemoteInvoker

JMX Microkernel Microkernel JMX

You can add as many invokers to the system as you need

Service MBean

Service MBean

22

11

JBoss Invokers Professional Open Source™

– All services are MBeans (including EJB containers) – Remote access is available via invoker MBeans – Internally invocation objects are routed within the kernel

Server JVM EJB Container MBean

Port 1234

Typed Interface

Invocation

011101010101

Client Client

RemoteInvoker RemoteInvoker Port 4321

JMX Microkernel Microkernel JMX

RemoteInvoker RemoteInvoker

Client JVM

EJB Container MBean

Service MBean Client Proxy

23

© JBoss, Inc. 2003-2005.

The Structure of the Invocation Professional Open Source™

Invocation is an abstraction of the actual method invocation (GoF Command pattern) – A map with entries and values – Marshall map, as-is map, transient map • Each map has different serialization semantics – In the map by default we put • Target service (JMX ObjectName) • Method name and arguments • Transactions context (client transaction interceptor) • Security context (client security interceptor) • Anything that you want (your client interceptors) – Additional service context, extended security context, intelligent client side invocation logic such as caching, batch invocations, load balancing, retry logic

© JBoss, Inc. 2003-2005.

24

12

Professional Open Source™

Client Proxies “Downloading Smart Behavior to the Client”

© JBoss, Inc. 2003-2005.

8/2/2005

25

The Structure of the Client Proxy Professional Open Source™

The proxy contains – – – –

Component interface Dynamic proxy invocation handler (java.lang.reflect.InvocationHandler) Stack of client interceptors Invoker stub to communicate to the server side invoker implementation Client JVM

Transport Transport

Transaction Transaction

Security Security

Invocation Invocation Handler Handler

Typed Component Component Interface Interface Typed

Client Client

Reference to InvocationHandler implementation

01110101

Stub to server side invoker

Runtime generated interface implementation that multiplexes to invocation handler © JBoss, Inc. 2003-2005.

26

13

Client Side Interceptors Professional Open Source™

Invocation handler instantiates a new invocation object – Each interceptor adds relevant context to the invocation – The invocation is serialized to the server by invoker stub

Method Args

Method Args Principal Credential

Transport Transport

Transaction Transaction

Security Security

Component Interface Interface Component

Invocation Invocation Handler Handler

Client JVM

011101010101

Method Args Principal Credential Tx Context

27

© JBoss, Inc. 2003-2005.

Clustering Intelligence on Java Clients Professional Open Source™

Drop your service in JBoss, stateless Configure a client side proxy with a cluster client interceptor Voila! Insta-cluster™

© JBoss, Inc. 2003-2005.

28

14

Architectural Overview: Conclusion Professional Open Source™

Microkernel design – Independent cycling and loading

Unified ClassLoaders – Class visibility with any 3rd party and stack integration

Unified Deployers – Hot deploy all types – Responsible for UCL creation

Detached invokers – Independent of MBeans present – multiple protocol support

Client Proxy – Dynamic proxies and client interceptor stack

The SUPER-SERVER theory for MBeans (EJB is an example)

© JBoss, Inc. 2003-2005.

29

15

Related Documents

Architecture
November 2019 42
Architecture
November 2019 64
Architecture
July 2020 18
Architecture
November 2019 50
Architecture
June 2020 22
Zivah Architecture
July 2020 0