SlideShare a Scribd company logo
Jakarta Concurrency:
Present and Future
Steve Millidge
Agenda
• Why do we need Jakarta Concurrency?
• What are the main components?
• What’s new in Jakarta EE 10?
• Futures
• Get Involved.
3
Why do we need
Jakarta Concurrency?
6
What is Jakarta Concurrency
New name for JSR236: Concurrency Utilities for Java EE
• Introduced in Java EE 7
• No change in Java EE 8
• No change in Jakarta EE 8
• Namespace change in Jakarta EE 9
• New Features Jakarta EE 10
New Maven coordinates in Jakarta EE 8/9/10
<dependency>
<groupId>jakarta.enterprise.concurrent</groupId>
<artifactId>jakarta.enterprise.concurrent-api</artifactId>
<version>1.1.2 (8) 2.0 (9.x) 3.0.2 (10.0)</version>
</dependency>
Steve Millidge
7
Goal
• Utilize existing applicable Java EE platform services. Provide a simple yet
flexible API for application component providers to design applications
using concurrency design principles.
• Allow Java SE developers a simple migration path to the Java EE
platform by providing consistency between the Java SE and Java EE
platforms.
• Allow application component providers to easily add concurrency to
existing Java EE applications.
• Support simple (common) and advanced concurrency patterns without
sacrificing usability
What is an
Application
Server?
9
What is the Use Case?
Adding an Asynch Break in your application
(Before JSR 236)
Many older Java EE Applications
use JMS just for this!
10
What is the Use Case?
Adding an Asynch Break in your application
(Jakarta Concurrency)
Much more lightweight than a
JMS Broker!!!
Show me the Code
(Simple Asynch Break – pre JakartaEE 10)
What is the Use Case?
Running Tasks in Parallel
(Jakarta Concurrency)
Show me the Code
Parallel Tasks
Running Periodic Tasks
(Jakarta Concurrency)
What is the Use Case?
Before Java EE Concurrency this
could only be achieved using EJB
Timers
Tasks can also be started at Application Deploy
Trigger enables programmatic scheduling
15
What are the Main Components?
Managed Executor Services
Managed
Executor
Service
Jakarta EE
Executor
Service
Java SE
Managed
Scheduled
Executor
Service
Scheduled
Executor
Service
Jakarta EE specifies
a default instance of
each.
Additional instances
can be configured for
specific needs.
Managed Task
Listener can track
Task execution
Trigger interface can
provide business logic
on when to schedule
a task
Managed Thread Factory
Managed
Thread
Factory
Jakarta EE
Thread
Factory
Java SE
Used where you need a non-
Jakarta EE component to
create threads that can be
utilised with Jakarta EE.
or
You need a managed thread
to do something asynch.
Used when you need an object to run on a non managed thread using a Jakarta EE
Context.
Key for maintaining Security Context that can be propagated to other threads
One example is a JMX Notification Listener
Context Service
19
What’s new in Jakarta EE 10?
Jakarta EE 10 provides annotations for application scoped objects.
@ManagedExecutorDefinition (
name="java:comp/env/concurrent/MyExecutor",
context = "java:comp/env/concurrent/ContextService",
maxAsync = 20,
hungTaskThreshold = 5000
)
@ManagedScheduledExecutorDefinition (
name="java:comp/env/concurrent/MyExecutor",
context = "java:comp/env/concurrent/ContextService",
maxAsync = 20,
hungTaskThreshold = 5000
)
Deployable Managed Objects
● ContextServiceDefinition
● ManagedExecutorDefinition
● ManagedScheduledExecutorDefintion
● ManagedThreadFactoryDefinition
Deployable Managed Objects
Like the EJB Asnchronous annotation but can be used with CDI beans.
Methods must return CompletableFuture, CompletionStage or void
@ApplicationScoped
public class AsynchBean {
@Asynchronous(executor=" java:comp/env/concurrent/MyExecutor")
public CompletableFuture<Double> asynchMethod() {
Double total;
…
return Asynchronous.Result.complete(total);
}
}
Specifying the Executor service will enable fine grained concurrency management when combined
with deployable executor services.
New @Asynchronous annotation
Support ForkJoinPool in a standard way and allow creation of Managed Fork Join Pools
public interface ManagedThreadFactory extends ThreadFactory,
ForkJionPool.ForkJoinWorkerThreadFactory
Support CompletableFuture on Executor
CompletableFuture<Void> runAsync(Runnable runnable);
<U> CompletableFuture<U> supplyAsync(Supplier<U> supplier);
Date Time Support on Triggers
public interface ZonedTrigger extends Trigger {
public ZonedDateTime getNextRunTime(LastExecution lastExecutionInfo,
ZonedDateTime taskScheduledTime);
…
Catch up with Java
Fork Join Pool
Example
Easier creation of Contextual aware components
public <R> Supplier<R> contextualSupplier(Supplier<R> supplier);
public <T, R> Function<T, R> contextualFunction(Function<T, R>
function);
public <T, U> BiConsumer<T, U> contextualConsumer(BiConsumer<T, U>
consumer);
public <R> Callable<R> contextualCallable(Callable<R> callable);
public Runnable contextualRunnable(Runnable runnable);
public <T> CompletionStage<T> withContextCapture(CompletionStage<T>
stage);
public <T> CompletableFuture<T>
withContextCapture(CompletableFuture<T> stage);
Context Service Upgrade to Java SE 8+
CronTrigger class - Implementation
● Concrete Trigger Implementation for Convenience
public CronTrigger(final String cron, final ZoneId zone)
Use Expressions
trigger = new CronTrigger("0 7 * SEP-MAY MON-FRI",
ZoneId.of("America/New_York"));
Use Fluent API
trigger = new CronTrigger(ZoneId.of("America/Los_Angeles"))
.months(Month.DECEMBER)
.daysOfMonth(24)
.hours(16, 18);
27
Futures
COPYRIGHT (C) 2019, ECLIPSE FOUNDATION, INC. | MADE AVAILABLE UNDER THE ECLIPSE PUBLIC LICENSE 2.0 (EPL-2.0) 27
Like the EJB Timer annotation but for other components e.g. CDI Beans (non-persistent)
@ApplicationScoped
public class ScheduledBean {
@Schedule(executor="MyExecutor", minute="*/5")
public void fiveMinuteRule() {
}
}
Supports cron like commands (c.f. EJB).
Some comments are that this can be done in plain Java utilising CronTrigger and would
need to change the schedule
@Schedule Annotation · Issue #98 · jakartaee/concurrency (github.com)
New @Schedule Annotation
Currently Objects are tied to JNDI therefore need @Resource
@ApplicationScoped
public class CDIBean {
@Inject ManagedExecutorService service;
}
@Inject Support for Managed Objects
Provides locking semantics for CDI Beans – especially useful for ApplicationScoped
@ApplicationScoped
public class CDIBean {
@Lock(LockType.READ) doReadMany(){};
@Lock(LockType.WRITE) doOneWriter();
}
Semantics would be similar to EJB Locks
@Lock Annotation
Lock Annotation · Issue #135 · jakartaee/concurrency (github.com)
@Lock(LockType.READ)
Limits through Semaphore the number of threads that can execute a method or all
methods concurrently.
@ApplicationScoped
public class CDIBean {
@MaxConcurrency(2) maxTwoThreadsMethod(){};
@MaxConcurrency(10) maxUseofAPI();
}
Thread Isolation can be currently handled through Asynchronous with a
ManagedExecutor with maxConcurrency specified.
@MaxConcurrency Annotation
MaxConcurrency annotation · Issue #136 · jakartaee/concurrency (github.com)
@Lock(LockType.READ)
Possible Future Platform Alignment
● Specify more how Concurrency interacts with Jakarta Context and Dependency
Injection Contexts
● Enable propagation of Transactions across threads
● Reimplement Jakarta Enterprise Beans Asynchronous on Concurrency
○ Use new Concurrency Asynchronous annotation
○ Alternate allow MES to be specified
● Reimplement Jakarta Enterprise Beans Timers on Concurrency
○ Use new Schedule annotation
○ Alternate allow MES to be specified
● Align Asynch Servlets and JAX-RS onto Concurrency
○ Provide logical executor name
● Support Flow API
○ https://github.com/jakartaee/concurrency/issues/257
○ No work done as yet
● Make usable in Core Profile
○ Remove requirements for JNDI and EJBs in TCK
Others
34
Getting Involved
COPYRIGHT (C) 2019, ECLIPSE FOUNDATION, INC. | MADE AVAILABLE UNDER THE ECLIPSE PUBLIC LICENSE 2.0 (EPL-2.0) 34
Get Involved!
• Eclipse Project
• https://projects.eclipse.org/
projects/ee4j.cu
• Mailing List
• https://accounts.eclipse.org
/mailing-list/cu-dev
• Code
• https://github.com/jakartaee/concurrency
• Raise Issues for New Features.
• Review what is their for EE10
• Eclipse Compatible Implementation
(used in GlassFish and Payara)
• https://github.com/eclipse-ee4j/concurrency-ri
v
THIS IS CODE FIRST, OPEN SOURCE DEVELOPMENT...
Please visit us at:
payara.fish/join-us
Payara is always on the hunt for the
best people to work with - Someone
that makes a difference, cares for
quality, and is really good at their job
Learn more:
https://payara.fish/careers
We’re Hiring
• Payara is a proud 2021 Queen's Award for
Enterprise recipient for International Trade.
• Overseas sales grew by 107% in the last
three years and the percentage exported
grew from 33% to 75%
Winner of The
Queens Award for
Enterprise
Join our Global Meetup Group to find out more about our
future events and get involved with our community
Learn more:
https://www.meetup.com/payara-global-meetup/
Payara Global Meetup
Ad

More Related Content

Similar to Jakarta Concurrency: Present and Future (20)

Implementing Microservices with Jakarta EE and MicroProfile
Implementing Microservices with Jakarta EE and MicroProfileImplementing Microservices with Jakarta EE and MicroProfile
Implementing Microservices with Jakarta EE and MicroProfile
Kevin Sutter
 
JSR 236 Concurrency Utils for EE presentation for JavaOne 2013 (CON7948)
JSR 236 Concurrency Utils for EE presentation for JavaOne 2013 (CON7948)JSR 236 Concurrency Utils for EE presentation for JavaOne 2013 (CON7948)
JSR 236 Concurrency Utils for EE presentation for JavaOne 2013 (CON7948)
Fred Rowe
 
Jakarta EE and MicroProfile - EclipseCon 2020
Jakarta EE and MicroProfile - EclipseCon 2020Jakarta EE and MicroProfile - EclipseCon 2020
Jakarta EE and MicroProfile - EclipseCon 2020
Josh Juneau
 
Bots on guard of sdlc
Bots on guard of sdlcBots on guard of sdlc
Bots on guard of sdlc
Alexey Tokar
 
Completable future
Completable futureCompletable future
Completable future
Srinivasan Raghvan
 
Java one2013
Java one2013Java one2013
Java one2013
Aleksei Kornev
 
Migrating to Jakarta EE 10
Migrating to Jakarta EE 10Migrating to Jakarta EE 10
Migrating to Jakarta EE 10
Josh Juneau
 
Ultimate Guide to Microservice Architecture on Kubernetes
Ultimate Guide to Microservice Architecture on KubernetesUltimate Guide to Microservice Architecture on Kubernetes
Ultimate Guide to Microservice Architecture on Kubernetes
kloia
 
Springboot Microservices
Springboot MicroservicesSpringboot Microservices
Springboot Microservices
NexThoughts Technologies
 
Java concurrency
Java concurrencyJava concurrency
Java concurrency
Abhijit Gaikwad
 
Whats Next for JCA?
Whats Next for JCA?Whats Next for JCA?
Whats Next for JCA?
Fred Rowe
 
Spring Boot 3 And Beyond
Spring Boot 3 And BeyondSpring Boot 3 And Beyond
Spring Boot 3 And Beyond
VMware Tanzu
 
ReactCodemod: An automated approach for refactoring class based components to...
ReactCodemod: An automated approach for refactoring class based components to...ReactCodemod: An automated approach for refactoring class based components to...
ReactCodemod: An automated approach for refactoring class based components to...
IRJET Journal
 
Migrate to the Latest WSO2 Micro Integrator to Unlock All-new Features
Migrate to the Latest WSO2 Micro Integrator to Unlock All-new FeaturesMigrate to the Latest WSO2 Micro Integrator to Unlock All-new Features
Migrate to the Latest WSO2 Micro Integrator to Unlock All-new Features
WSO2
 
Microservices Part 4: Functional Reactive Programming
Microservices Part 4: Functional Reactive ProgrammingMicroservices Part 4: Functional Reactive Programming
Microservices Part 4: Functional Reactive Programming
Araf Karsh Hamid
 
Scale and Load Testing of Micro-Service
Scale and Load Testing of Micro-ServiceScale and Load Testing of Micro-Service
Scale and Load Testing of Micro-Service
IRJET Journal
 
MicroProfile for MicroServices
MicroProfile for MicroServicesMicroProfile for MicroServices
MicroProfile for MicroServices
Mert Çalışkan
 
Getting started with Azure Functions in Isolated Mode
Getting started with Azure Functions in Isolated ModeGetting started with Azure Functions in Isolated Mode
Getting started with Azure Functions in Isolated Mode
Callon Campbell
 
Кирилл Толкачев. Микросервисы: огонь, вода и девопс
Кирилл Толкачев. Микросервисы: огонь, вода и девопсКирилл Толкачев. Микросервисы: огонь, вода и девопс
Кирилл Толкачев. Микросервисы: огонь, вода и девопс
ScrumTrek
 
AKS: k8s e azure
AKS: k8s e azureAKS: k8s e azure
AKS: k8s e azure
Alessandro Melchiori
 
Implementing Microservices with Jakarta EE and MicroProfile
Implementing Microservices with Jakarta EE and MicroProfileImplementing Microservices with Jakarta EE and MicroProfile
Implementing Microservices with Jakarta EE and MicroProfile
Kevin Sutter
 
JSR 236 Concurrency Utils for EE presentation for JavaOne 2013 (CON7948)
JSR 236 Concurrency Utils for EE presentation for JavaOne 2013 (CON7948)JSR 236 Concurrency Utils for EE presentation for JavaOne 2013 (CON7948)
JSR 236 Concurrency Utils for EE presentation for JavaOne 2013 (CON7948)
Fred Rowe
 
Jakarta EE and MicroProfile - EclipseCon 2020
Jakarta EE and MicroProfile - EclipseCon 2020Jakarta EE and MicroProfile - EclipseCon 2020
Jakarta EE and MicroProfile - EclipseCon 2020
Josh Juneau
 
Bots on guard of sdlc
Bots on guard of sdlcBots on guard of sdlc
Bots on guard of sdlc
Alexey Tokar
 
Migrating to Jakarta EE 10
Migrating to Jakarta EE 10Migrating to Jakarta EE 10
Migrating to Jakarta EE 10
Josh Juneau
 
Ultimate Guide to Microservice Architecture on Kubernetes
Ultimate Guide to Microservice Architecture on KubernetesUltimate Guide to Microservice Architecture on Kubernetes
Ultimate Guide to Microservice Architecture on Kubernetes
kloia
 
Whats Next for JCA?
Whats Next for JCA?Whats Next for JCA?
Whats Next for JCA?
Fred Rowe
 
Spring Boot 3 And Beyond
Spring Boot 3 And BeyondSpring Boot 3 And Beyond
Spring Boot 3 And Beyond
VMware Tanzu
 
ReactCodemod: An automated approach for refactoring class based components to...
ReactCodemod: An automated approach for refactoring class based components to...ReactCodemod: An automated approach for refactoring class based components to...
ReactCodemod: An automated approach for refactoring class based components to...
IRJET Journal
 
Migrate to the Latest WSO2 Micro Integrator to Unlock All-new Features
Migrate to the Latest WSO2 Micro Integrator to Unlock All-new FeaturesMigrate to the Latest WSO2 Micro Integrator to Unlock All-new Features
Migrate to the Latest WSO2 Micro Integrator to Unlock All-new Features
WSO2
 
Microservices Part 4: Functional Reactive Programming
Microservices Part 4: Functional Reactive ProgrammingMicroservices Part 4: Functional Reactive Programming
Microservices Part 4: Functional Reactive Programming
Araf Karsh Hamid
 
Scale and Load Testing of Micro-Service
Scale and Load Testing of Micro-ServiceScale and Load Testing of Micro-Service
Scale and Load Testing of Micro-Service
IRJET Journal
 
MicroProfile for MicroServices
MicroProfile for MicroServicesMicroProfile for MicroServices
MicroProfile for MicroServices
Mert Çalışkan
 
Getting started with Azure Functions in Isolated Mode
Getting started with Azure Functions in Isolated ModeGetting started with Azure Functions in Isolated Mode
Getting started with Azure Functions in Isolated Mode
Callon Campbell
 
Кирилл Толкачев. Микросервисы: огонь, вода и девопс
Кирилл Толкачев. Микросервисы: огонь, вода и девопсКирилл Толкачев. Микросервисы: огонь, вода и девопс
Кирилл Толкачев. Микросервисы: огонь, вода и девопс
ScrumTrek
 

More from Payara (20)

Easy Java Integration Testing with Testcontainers​
Easy Java Integration Testing with Testcontainers​Easy Java Integration Testing with Testcontainers​
Easy Java Integration Testing with Testcontainers​
Payara
 
Payara Cloud - Cloud Native Jakarta EE.pptx
Payara Cloud - Cloud Native Jakarta EE.pptxPayara Cloud - Cloud Native Jakarta EE.pptx
Payara Cloud - Cloud Native Jakarta EE.pptx
Payara
 
GlassFish Migration Webinar 2022 Current version.pptx
GlassFish Migration Webinar 2022 Current version.pptxGlassFish Migration Webinar 2022 Current version.pptx
GlassFish Migration Webinar 2022 Current version.pptx
Payara
 
10 Strategies for Developing Reliable Jakarta EE & MicroProfile Applications ...
10 Strategies for Developing Reliable Jakarta EE & MicroProfile Applications ...10 Strategies for Developing Reliable Jakarta EE & MicroProfile Applications ...
10 Strategies for Developing Reliable Jakarta EE & MicroProfile Applications ...
Payara
 
Securing Microservices with MicroProfile and Auth0v2
Securing Microservices with MicroProfile and Auth0v2Securing Microservices with MicroProfile and Auth0v2
Securing Microservices with MicroProfile and Auth0v2
Payara
 
Reactive features of MicroProfile you need to learn
Reactive features of MicroProfile you need to learnReactive features of MicroProfile you need to learn
Reactive features of MicroProfile you need to learn
Payara
 
Effective cloud-ready apps with MicroProfile
Effective cloud-ready apps with MicroProfileEffective cloud-ready apps with MicroProfile
Effective cloud-ready apps with MicroProfile
Payara
 
A step-by-step guide from traditional Java EE to reactive microservice design
A step-by-step guide from traditional Java EE to reactive microservice designA step-by-step guide from traditional Java EE to reactive microservice design
A step-by-step guide from traditional Java EE to reactive microservice design
Payara
 
Transactions in Microservices
Transactions in MicroservicesTransactions in Microservices
Transactions in Microservices
Payara
 
Fun with Kubernetes and Payara Micro 5
Fun with Kubernetes and Payara Micro 5Fun with Kubernetes and Payara Micro 5
Fun with Kubernetes and Payara Micro 5
Payara
 
What's new in Jakarta EE and Eclipse GlassFish (May 2019)
What's new in Jakarta EE and Eclipse GlassFish (May 2019)What's new in Jakarta EE and Eclipse GlassFish (May 2019)
What's new in Jakarta EE and Eclipse GlassFish (May 2019)
Payara
 
Previewing Payara Platform 5.192
Previewing Payara Platform 5.192Previewing Payara Platform 5.192
Previewing Payara Platform 5.192
Payara
 
Secure JAX-RS
Secure JAX-RSSecure JAX-RS
Secure JAX-RS
Payara
 
Gradual Migration to MicroProfile
Gradual Migration to MicroProfileGradual Migration to MicroProfile
Gradual Migration to MicroProfile
Payara
 
Monitor Microservices with MicroProfile Metrics
Monitor Microservices with MicroProfile MetricsMonitor Microservices with MicroProfile Metrics
Monitor Microservices with MicroProfile Metrics
Payara
 
Java2 days -_be_reactive_and_micro_with_a_microprofile_stack
Java2 days -_be_reactive_and_micro_with_a_microprofile_stackJava2 days -_be_reactive_and_micro_with_a_microprofile_stack
Java2 days -_be_reactive_and_micro_with_a_microprofile_stack
Payara
 
Java2 days 5_agile_steps_to_cloud-ready_apps
Java2 days 5_agile_steps_to_cloud-ready_appsJava2 days 5_agile_steps_to_cloud-ready_apps
Java2 days 5_agile_steps_to_cloud-ready_apps
Payara
 
Rapid development tools for java ee 8 and micro profile [GIDS]
Rapid development tools for java ee 8 and micro profile [GIDS] Rapid development tools for java ee 8 and micro profile [GIDS]
Rapid development tools for java ee 8 and micro profile [GIDS]
Payara
 
Ondrej mihalyi be reactive and micro with a micro profile stack
Ondrej mihalyi   be reactive and micro with a micro profile stackOndrej mihalyi   be reactive and micro with a micro profile stack
Ondrej mihalyi be reactive and micro with a micro profile stack
Payara
 
Bed con Quest for JavaEE
Bed con Quest for JavaEEBed con Quest for JavaEE
Bed con Quest for JavaEE
Payara
 
Easy Java Integration Testing with Testcontainers​
Easy Java Integration Testing with Testcontainers​Easy Java Integration Testing with Testcontainers​
Easy Java Integration Testing with Testcontainers​
Payara
 
Payara Cloud - Cloud Native Jakarta EE.pptx
Payara Cloud - Cloud Native Jakarta EE.pptxPayara Cloud - Cloud Native Jakarta EE.pptx
Payara Cloud - Cloud Native Jakarta EE.pptx
Payara
 
GlassFish Migration Webinar 2022 Current version.pptx
GlassFish Migration Webinar 2022 Current version.pptxGlassFish Migration Webinar 2022 Current version.pptx
GlassFish Migration Webinar 2022 Current version.pptx
Payara
 
10 Strategies for Developing Reliable Jakarta EE & MicroProfile Applications ...
10 Strategies for Developing Reliable Jakarta EE & MicroProfile Applications ...10 Strategies for Developing Reliable Jakarta EE & MicroProfile Applications ...
10 Strategies for Developing Reliable Jakarta EE & MicroProfile Applications ...
Payara
 
Securing Microservices with MicroProfile and Auth0v2
Securing Microservices with MicroProfile and Auth0v2Securing Microservices with MicroProfile and Auth0v2
Securing Microservices with MicroProfile and Auth0v2
Payara
 
Reactive features of MicroProfile you need to learn
Reactive features of MicroProfile you need to learnReactive features of MicroProfile you need to learn
Reactive features of MicroProfile you need to learn
Payara
 
Effective cloud-ready apps with MicroProfile
Effective cloud-ready apps with MicroProfileEffective cloud-ready apps with MicroProfile
Effective cloud-ready apps with MicroProfile
Payara
 
A step-by-step guide from traditional Java EE to reactive microservice design
A step-by-step guide from traditional Java EE to reactive microservice designA step-by-step guide from traditional Java EE to reactive microservice design
A step-by-step guide from traditional Java EE to reactive microservice design
Payara
 
Transactions in Microservices
Transactions in MicroservicesTransactions in Microservices
Transactions in Microservices
Payara
 
Fun with Kubernetes and Payara Micro 5
Fun with Kubernetes and Payara Micro 5Fun with Kubernetes and Payara Micro 5
Fun with Kubernetes and Payara Micro 5
Payara
 
What's new in Jakarta EE and Eclipse GlassFish (May 2019)
What's new in Jakarta EE and Eclipse GlassFish (May 2019)What's new in Jakarta EE and Eclipse GlassFish (May 2019)
What's new in Jakarta EE and Eclipse GlassFish (May 2019)
Payara
 
Previewing Payara Platform 5.192
Previewing Payara Platform 5.192Previewing Payara Platform 5.192
Previewing Payara Platform 5.192
Payara
 
Secure JAX-RS
Secure JAX-RSSecure JAX-RS
Secure JAX-RS
Payara
 
Gradual Migration to MicroProfile
Gradual Migration to MicroProfileGradual Migration to MicroProfile
Gradual Migration to MicroProfile
Payara
 
Monitor Microservices with MicroProfile Metrics
Monitor Microservices with MicroProfile MetricsMonitor Microservices with MicroProfile Metrics
Monitor Microservices with MicroProfile Metrics
Payara
 
Java2 days -_be_reactive_and_micro_with_a_microprofile_stack
Java2 days -_be_reactive_and_micro_with_a_microprofile_stackJava2 days -_be_reactive_and_micro_with_a_microprofile_stack
Java2 days -_be_reactive_and_micro_with_a_microprofile_stack
Payara
 
Java2 days 5_agile_steps_to_cloud-ready_apps
Java2 days 5_agile_steps_to_cloud-ready_appsJava2 days 5_agile_steps_to_cloud-ready_apps
Java2 days 5_agile_steps_to_cloud-ready_apps
Payara
 
Rapid development tools for java ee 8 and micro profile [GIDS]
Rapid development tools for java ee 8 and micro profile [GIDS] Rapid development tools for java ee 8 and micro profile [GIDS]
Rapid development tools for java ee 8 and micro profile [GIDS]
Payara
 
Ondrej mihalyi be reactive and micro with a micro profile stack
Ondrej mihalyi   be reactive and micro with a micro profile stackOndrej mihalyi   be reactive and micro with a micro profile stack
Ondrej mihalyi be reactive and micro with a micro profile stack
Payara
 
Bed con Quest for JavaEE
Bed con Quest for JavaEEBed con Quest for JavaEE
Bed con Quest for JavaEE
Payara
 
Ad

Recently uploaded (20)

Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]
saniaaftab72555
 
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
F-Secure Freedome VPN 2025 Crack Plus Activation  New VersionF-Secure Freedome VPN 2025 Crack Plus Activation  New Version
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
saimabibi60507
 
Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025
mu394968
 
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage DashboardsAdobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
BradBedford3
 
Douwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License codeDouwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License code
aneelaramzan63
 
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AIScaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
danshalev
 
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
AxisTechnolabs
 
EASEUS Partition Master Crack + License Code
EASEUS Partition Master Crack + License CodeEASEUS Partition Master Crack + License Code
EASEUS Partition Master Crack + License Code
aneelaramzan63
 
Expand your AI adoption with AgentExchange
Expand your AI adoption with AgentExchangeExpand your AI adoption with AgentExchange
Expand your AI adoption with AgentExchange
Fexle Services Pvt. Ltd.
 
Automation Techniques in RPA - UiPath Certificate
Automation Techniques in RPA - UiPath CertificateAutomation Techniques in RPA - UiPath Certificate
Automation Techniques in RPA - UiPath Certificate
VICTOR MAESTRE RAMIREZ
 
Solidworks Crack 2025 latest new + license code
Solidworks Crack 2025 latest new + license codeSolidworks Crack 2025 latest new + license code
Solidworks Crack 2025 latest new + license code
aneelaramzan63
 
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
Andre Hora
 
Designing AI-Powered APIs on Azure: Best Practices& Considerations
Designing AI-Powered APIs on Azure: Best Practices& ConsiderationsDesigning AI-Powered APIs on Azure: Best Practices& Considerations
Designing AI-Powered APIs on Azure: Best Practices& Considerations
Dinusha Kumarasiri
 
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Eric D. Schabell
 
Societal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainabilitySocietal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainability
Jordi Cabot
 
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
Andre Hora
 
Kubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptxKubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptx
CloudScouts
 
Adobe Illustrator Crack FREE Download 2025 Latest Version
Adobe Illustrator Crack FREE Download 2025 Latest VersionAdobe Illustrator Crack FREE Download 2025 Latest Version
Adobe Illustrator Crack FREE Download 2025 Latest Version
kashifyounis067
 
Adobe After Effects Crack FREE FRESH version 2025
Adobe After Effects Crack FREE FRESH version 2025Adobe After Effects Crack FREE FRESH version 2025
Adobe After Effects Crack FREE FRESH version 2025
kashifyounis067
 
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
Egor Kaleynik
 
Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]Get & Download Wondershare Filmora Crack Latest [2025]
Get & Download Wondershare Filmora Crack Latest [2025]
saniaaftab72555
 
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
F-Secure Freedome VPN 2025 Crack Plus Activation  New VersionF-Secure Freedome VPN 2025 Crack Plus Activation  New Version
F-Secure Freedome VPN 2025 Crack Plus Activation New Version
saimabibi60507
 
Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025Avast Premium Security Crack FREE Latest Version 2025
Avast Premium Security Crack FREE Latest Version 2025
mu394968
 
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage DashboardsAdobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
Adobe Marketo Engage Champion Deep Dive - SFDC CRM Synch V2 & Usage Dashboards
BradBedford3
 
Douwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License codeDouwan Crack 2025 new verson+ License code
Douwan Crack 2025 new verson+ License code
aneelaramzan63
 
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AIScaling GraphRAG:  Efficient Knowledge Retrieval for Enterprise AI
Scaling GraphRAG: Efficient Knowledge Retrieval for Enterprise AI
danshalev
 
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
Interactive odoo dashboards for sales, CRM , Inventory, Invoice, Purchase, Pr...
AxisTechnolabs
 
EASEUS Partition Master Crack + License Code
EASEUS Partition Master Crack + License CodeEASEUS Partition Master Crack + License Code
EASEUS Partition Master Crack + License Code
aneelaramzan63
 
Expand your AI adoption with AgentExchange
Expand your AI adoption with AgentExchangeExpand your AI adoption with AgentExchange
Expand your AI adoption with AgentExchange
Fexle Services Pvt. Ltd.
 
Automation Techniques in RPA - UiPath Certificate
Automation Techniques in RPA - UiPath CertificateAutomation Techniques in RPA - UiPath Certificate
Automation Techniques in RPA - UiPath Certificate
VICTOR MAESTRE RAMIREZ
 
Solidworks Crack 2025 latest new + license code
Solidworks Crack 2025 latest new + license codeSolidworks Crack 2025 latest new + license code
Solidworks Crack 2025 latest new + license code
aneelaramzan63
 
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
What Do Contribution Guidelines Say About Software Testing? (MSR 2025)
Andre Hora
 
Designing AI-Powered APIs on Azure: Best Practices& Considerations
Designing AI-Powered APIs on Azure: Best Practices& ConsiderationsDesigning AI-Powered APIs on Azure: Best Practices& Considerations
Designing AI-Powered APIs on Azure: Best Practices& Considerations
Dinusha Kumarasiri
 
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Mastering Fluent Bit: Ultimate Guide to Integrating Telemetry Pipelines with ...
Eric D. Schabell
 
Societal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainabilitySocietal challenges of AI: biases, multilinguism and sustainability
Societal challenges of AI: biases, multilinguism and sustainability
Jordi Cabot
 
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
TestMigrationsInPy: A Dataset of Test Migrations from Unittest to Pytest (MSR...
Andre Hora
 
Kubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptxKubernetes_101_Zero_to_Platform_Engineer.pptx
Kubernetes_101_Zero_to_Platform_Engineer.pptx
CloudScouts
 
Adobe Illustrator Crack FREE Download 2025 Latest Version
Adobe Illustrator Crack FREE Download 2025 Latest VersionAdobe Illustrator Crack FREE Download 2025 Latest Version
Adobe Illustrator Crack FREE Download 2025 Latest Version
kashifyounis067
 
Adobe After Effects Crack FREE FRESH version 2025
Adobe After Effects Crack FREE FRESH version 2025Adobe After Effects Crack FREE FRESH version 2025
Adobe After Effects Crack FREE FRESH version 2025
kashifyounis067
 
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
How Valletta helped healthcare SaaS to transform QA and compliance to grow wi...
Egor Kaleynik
 
Ad

Jakarta Concurrency: Present and Future

  • 1. Jakarta Concurrency: Present and Future Steve Millidge
  • 2. Agenda • Why do we need Jakarta Concurrency? • What are the main components? • What’s new in Jakarta EE 10? • Futures • Get Involved.
  • 3. 3 Why do we need Jakarta Concurrency?
  • 4. 6 What is Jakarta Concurrency New name for JSR236: Concurrency Utilities for Java EE • Introduced in Java EE 7 • No change in Java EE 8 • No change in Jakarta EE 8 • Namespace change in Jakarta EE 9 • New Features Jakarta EE 10 New Maven coordinates in Jakarta EE 8/9/10 <dependency> <groupId>jakarta.enterprise.concurrent</groupId> <artifactId>jakarta.enterprise.concurrent-api</artifactId> <version>1.1.2 (8) 2.0 (9.x) 3.0.2 (10.0)</version> </dependency> Steve Millidge
  • 5. 7 Goal • Utilize existing applicable Java EE platform services. Provide a simple yet flexible API for application component providers to design applications using concurrency design principles. • Allow Java SE developers a simple migration path to the Java EE platform by providing consistency between the Java SE and Java EE platforms. • Allow application component providers to easily add concurrency to existing Java EE applications. • Support simple (common) and advanced concurrency patterns without sacrificing usability
  • 7. 9 What is the Use Case? Adding an Asynch Break in your application (Before JSR 236) Many older Java EE Applications use JMS just for this!
  • 8. 10 What is the Use Case? Adding an Asynch Break in your application (Jakarta Concurrency) Much more lightweight than a JMS Broker!!!
  • 9. Show me the Code (Simple Asynch Break – pre JakartaEE 10)
  • 10. What is the Use Case? Running Tasks in Parallel (Jakarta Concurrency)
  • 11. Show me the Code Parallel Tasks
  • 12. Running Periodic Tasks (Jakarta Concurrency) What is the Use Case? Before Java EE Concurrency this could only be achieved using EJB Timers Tasks can also be started at Application Deploy Trigger enables programmatic scheduling
  • 13. 15 What are the Main Components?
  • 14. Managed Executor Services Managed Executor Service Jakarta EE Executor Service Java SE Managed Scheduled Executor Service Scheduled Executor Service Jakarta EE specifies a default instance of each. Additional instances can be configured for specific needs. Managed Task Listener can track Task execution Trigger interface can provide business logic on when to schedule a task
  • 15. Managed Thread Factory Managed Thread Factory Jakarta EE Thread Factory Java SE Used where you need a non- Jakarta EE component to create threads that can be utilised with Jakarta EE. or You need a managed thread to do something asynch.
  • 16. Used when you need an object to run on a non managed thread using a Jakarta EE Context. Key for maintaining Security Context that can be propagated to other threads One example is a JMX Notification Listener Context Service
  • 17. 19 What’s new in Jakarta EE 10?
  • 18. Jakarta EE 10 provides annotations for application scoped objects. @ManagedExecutorDefinition ( name="java:comp/env/concurrent/MyExecutor", context = "java:comp/env/concurrent/ContextService", maxAsync = 20, hungTaskThreshold = 5000 ) @ManagedScheduledExecutorDefinition ( name="java:comp/env/concurrent/MyExecutor", context = "java:comp/env/concurrent/ContextService", maxAsync = 20, hungTaskThreshold = 5000 ) Deployable Managed Objects
  • 19. ● ContextServiceDefinition ● ManagedExecutorDefinition ● ManagedScheduledExecutorDefintion ● ManagedThreadFactoryDefinition Deployable Managed Objects
  • 20. Like the EJB Asnchronous annotation but can be used with CDI beans. Methods must return CompletableFuture, CompletionStage or void @ApplicationScoped public class AsynchBean { @Asynchronous(executor=" java:comp/env/concurrent/MyExecutor") public CompletableFuture<Double> asynchMethod() { Double total; … return Asynchronous.Result.complete(total); } } Specifying the Executor service will enable fine grained concurrency management when combined with deployable executor services. New @Asynchronous annotation
  • 21. Support ForkJoinPool in a standard way and allow creation of Managed Fork Join Pools public interface ManagedThreadFactory extends ThreadFactory, ForkJionPool.ForkJoinWorkerThreadFactory Support CompletableFuture on Executor CompletableFuture<Void> runAsync(Runnable runnable); <U> CompletableFuture<U> supplyAsync(Supplier<U> supplier); Date Time Support on Triggers public interface ZonedTrigger extends Trigger { public ZonedDateTime getNextRunTime(LastExecution lastExecutionInfo, ZonedDateTime taskScheduledTime); … Catch up with Java
  • 23. Easier creation of Contextual aware components public <R> Supplier<R> contextualSupplier(Supplier<R> supplier); public <T, R> Function<T, R> contextualFunction(Function<T, R> function); public <T, U> BiConsumer<T, U> contextualConsumer(BiConsumer<T, U> consumer); public <R> Callable<R> contextualCallable(Callable<R> callable); public Runnable contextualRunnable(Runnable runnable); public <T> CompletionStage<T> withContextCapture(CompletionStage<T> stage); public <T> CompletableFuture<T> withContextCapture(CompletableFuture<T> stage); Context Service Upgrade to Java SE 8+
  • 24. CronTrigger class - Implementation ● Concrete Trigger Implementation for Convenience public CronTrigger(final String cron, final ZoneId zone) Use Expressions trigger = new CronTrigger("0 7 * SEP-MAY MON-FRI", ZoneId.of("America/New_York")); Use Fluent API trigger = new CronTrigger(ZoneId.of("America/Los_Angeles")) .months(Month.DECEMBER) .daysOfMonth(24) .hours(16, 18);
  • 25. 27 Futures COPYRIGHT (C) 2019, ECLIPSE FOUNDATION, INC. | MADE AVAILABLE UNDER THE ECLIPSE PUBLIC LICENSE 2.0 (EPL-2.0) 27
  • 26. Like the EJB Timer annotation but for other components e.g. CDI Beans (non-persistent) @ApplicationScoped public class ScheduledBean { @Schedule(executor="MyExecutor", minute="*/5") public void fiveMinuteRule() { } } Supports cron like commands (c.f. EJB). Some comments are that this can be done in plain Java utilising CronTrigger and would need to change the schedule @Schedule Annotation · Issue #98 · jakartaee/concurrency (github.com) New @Schedule Annotation
  • 27. Currently Objects are tied to JNDI therefore need @Resource @ApplicationScoped public class CDIBean { @Inject ManagedExecutorService service; } @Inject Support for Managed Objects
  • 28. Provides locking semantics for CDI Beans – especially useful for ApplicationScoped @ApplicationScoped public class CDIBean { @Lock(LockType.READ) doReadMany(){}; @Lock(LockType.WRITE) doOneWriter(); } Semantics would be similar to EJB Locks @Lock Annotation Lock Annotation · Issue #135 · jakartaee/concurrency (github.com) @Lock(LockType.READ)
  • 29. Limits through Semaphore the number of threads that can execute a method or all methods concurrently. @ApplicationScoped public class CDIBean { @MaxConcurrency(2) maxTwoThreadsMethod(){}; @MaxConcurrency(10) maxUseofAPI(); } Thread Isolation can be currently handled through Asynchronous with a ManagedExecutor with maxConcurrency specified. @MaxConcurrency Annotation MaxConcurrency annotation · Issue #136 · jakartaee/concurrency (github.com) @Lock(LockType.READ)
  • 30. Possible Future Platform Alignment ● Specify more how Concurrency interacts with Jakarta Context and Dependency Injection Contexts ● Enable propagation of Transactions across threads ● Reimplement Jakarta Enterprise Beans Asynchronous on Concurrency ○ Use new Concurrency Asynchronous annotation ○ Alternate allow MES to be specified ● Reimplement Jakarta Enterprise Beans Timers on Concurrency ○ Use new Schedule annotation ○ Alternate allow MES to be specified ● Align Asynch Servlets and JAX-RS onto Concurrency ○ Provide logical executor name
  • 31. ● Support Flow API ○ https://github.com/jakartaee/concurrency/issues/257 ○ No work done as yet ● Make usable in Core Profile ○ Remove requirements for JNDI and EJBs in TCK Others
  • 32. 34 Getting Involved COPYRIGHT (C) 2019, ECLIPSE FOUNDATION, INC. | MADE AVAILABLE UNDER THE ECLIPSE PUBLIC LICENSE 2.0 (EPL-2.0) 34
  • 33. Get Involved! • Eclipse Project • https://projects.eclipse.org/ projects/ee4j.cu • Mailing List • https://accounts.eclipse.org /mailing-list/cu-dev • Code • https://github.com/jakartaee/concurrency • Raise Issues for New Features. • Review what is their for EE10 • Eclipse Compatible Implementation (used in GlassFish and Payara) • https://github.com/eclipse-ee4j/concurrency-ri v THIS IS CODE FIRST, OPEN SOURCE DEVELOPMENT...
  • 34. Please visit us at: payara.fish/join-us
  • 35. Payara is always on the hunt for the best people to work with - Someone that makes a difference, cares for quality, and is really good at their job Learn more: https://payara.fish/careers We’re Hiring
  • 36. • Payara is a proud 2021 Queen's Award for Enterprise recipient for International Trade. • Overseas sales grew by 107% in the last three years and the percentage exported grew from 33% to 75% Winner of The Queens Award for Enterprise
  • 37. Join our Global Meetup Group to find out more about our future events and get involved with our community Learn more: https://www.meetup.com/payara-global-meetup/ Payara Global Meetup