SlideShare a Scribd company logo
1 of 37
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

More Related Content

Similar to Jakarta Concurrency: Present and Future

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 MicroProfileKevin 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 2020Josh Juneau
 
Bots on guard of sdlc
Bots on guard of sdlcBots on guard of sdlc
Bots on guard of sdlcAlexey Tokar
 
Migrating to Jakarta EE 10
Migrating to Jakarta EE 10Migrating to Jakarta EE 10
Migrating to Jakarta EE 10Josh 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 Kuberneteskloia
 
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 BeyondVMware 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 FeaturesWSO2
 
Microservices Part 4: Functional Reactive Programming
Microservices Part 4: Functional Reactive ProgrammingMicroservices Part 4: Functional Reactive Programming
Microservices Part 4: Functional Reactive ProgrammingAraf 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-ServiceIRJET Journal
 
MicroProfile for MicroServices
MicroProfile for MicroServicesMicroProfile for MicroServices
MicroProfile for MicroServicesMert Ç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 ModeCallon Campbell
 
Кирилл Толкачев. Микросервисы: огонь, вода и девопс
Кирилл Толкачев. Микросервисы: огонь, вода и девопсКирилл Толкачев. Микросервисы: огонь, вода и девопс
Кирилл Толкачев. Микросервисы: огонь, вода и девопсScrumTrek
 

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
 
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)
 
Jakarta EE and MicroProfile - EclipseCon 2020
Jakarta EE and MicroProfile - EclipseCon 2020Jakarta EE and MicroProfile - EclipseCon 2020
Jakarta EE and MicroProfile - EclipseCon 2020
 
Bots on guard of sdlc
Bots on guard of sdlcBots on guard of sdlc
Bots on guard of sdlc
 
Completable future
Completable futureCompletable future
Completable future
 
Java one2013
Java one2013Java one2013
Java one2013
 
Migrating to Jakarta EE 10
Migrating to Jakarta EE 10Migrating to Jakarta EE 10
Migrating to Jakarta EE 10
 
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
 
Springboot Microservices
Springboot MicroservicesSpringboot Microservices
Springboot Microservices
 
Java concurrency
Java concurrencyJava concurrency
Java concurrency
 
Whats Next for JCA?
Whats Next for JCA?Whats Next for JCA?
Whats Next for JCA?
 
Spring Boot 3 And Beyond
Spring Boot 3 And BeyondSpring Boot 3 And Beyond
Spring Boot 3 And Beyond
 
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...
 
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
 
Microservices Part 4: Functional Reactive Programming
Microservices Part 4: Functional Reactive ProgrammingMicroservices Part 4: Functional Reactive Programming
Microservices Part 4: Functional Reactive Programming
 
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
 
MicroProfile for MicroServices
MicroProfile for MicroServicesMicroProfile for MicroServices
MicroProfile for MicroServices
 
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
 
Кирилл Толкачев. Микросервисы: огонь, вода и девопс
Кирилл Толкачев. Микросервисы: огонь, вода и девопсКирилл Толкачев. Микросервисы: огонь, вода и девопс
Кирилл Толкачев. Микросервисы: огонь, вода и девопс
 
AKS: k8s e azure
AKS: k8s e azureAKS: k8s e azure
AKS: k8s e azure
 

More from 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.pptxPayara
 
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.pptxPayara
 
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 Auth0v2Payara
 
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 learnPayara
 
Effective cloud-ready apps with MicroProfile
Effective cloud-ready apps with MicroProfileEffective cloud-ready apps with MicroProfile
Effective cloud-ready apps with MicroProfilePayara
 
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 designPayara
 
Transactions in Microservices
Transactions in MicroservicesTransactions in Microservices
Transactions in MicroservicesPayara
 
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 5Payara
 
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.192Payara
 
Secure JAX-RS
Secure JAX-RSSecure JAX-RS
Secure JAX-RSPayara
 
Gradual Migration to MicroProfile
Gradual Migration to MicroProfileGradual Migration to MicroProfile
Gradual Migration to MicroProfilePayara
 
Monitor Microservices with MicroProfile Metrics
Monitor Microservices with MicroProfile MetricsMonitor Microservices with MicroProfile Metrics
Monitor Microservices with MicroProfile MetricsPayara
 
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_stackPayara
 
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_appsPayara
 
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 stackPayara
 
Bed con Quest for JavaEE
Bed con Quest for JavaEEBed con Quest for JavaEE
Bed con Quest for JavaEEPayara
 

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 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
 
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
 
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 ...
 
Securing Microservices with MicroProfile and Auth0v2
Securing Microservices with MicroProfile and Auth0v2Securing Microservices with MicroProfile and Auth0v2
Securing Microservices with MicroProfile and Auth0v2
 
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
 
Effective cloud-ready apps with MicroProfile
Effective cloud-ready apps with MicroProfileEffective cloud-ready apps with MicroProfile
Effective cloud-ready apps with MicroProfile
 
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
 
Transactions in Microservices
Transactions in MicroservicesTransactions in Microservices
Transactions in Microservices
 
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
 
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)
 
Previewing Payara Platform 5.192
Previewing Payara Platform 5.192Previewing Payara Platform 5.192
Previewing Payara Platform 5.192
 
Secure JAX-RS
Secure JAX-RSSecure JAX-RS
Secure JAX-RS
 
Gradual Migration to MicroProfile
Gradual Migration to MicroProfileGradual Migration to MicroProfile
Gradual Migration to MicroProfile
 
Monitor Microservices with MicroProfile Metrics
Monitor Microservices with MicroProfile MetricsMonitor Microservices with MicroProfile Metrics
Monitor Microservices with MicroProfile Metrics
 
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
 
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
 
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]
 
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
 
Bed con Quest for JavaEE
Bed con Quest for JavaEEBed con Quest for JavaEE
Bed con Quest for JavaEE
 

Recently uploaded

%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...masabamasaba
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfonteinmasabamasaba
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesVictorSzoltysek
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareJim McKeeth
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrandmasabamasaba
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...SelfMade bd
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
Generic or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisionsGeneric or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisionsBert Jan Schrijver
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...Shane Coughlan
 
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburgmasabamasaba
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...masabamasaba
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfkalichargn70th171
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is insideshinachiaurasa2
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionOnePlan Solutions
 
%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durbanmasabamasaba
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnAmarnathKambale
 

Recently uploaded (20)

%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
%in kaalfontein+277-882-255-28 abortion pills for sale in kaalfontein
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Generic or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisionsGeneric or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisions
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
%in Lydenburg+277-882-255-28 abortion pills for sale in Lydenburg
 
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
%+27788225528 love spells in new york Psychic Readings, Attraction spells,Bri...
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
The title is not connected to what is inside
The title is not connected to what is insideThe title is not connected to what is inside
The title is not connected to what is inside
 
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) SolutionIntroducing Microsoft’s new Enterprise Work Management (EWM) Solution
Introducing Microsoft’s new Enterprise Work Management (EWM) Solution
 
%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban%in Durban+277-882-255-28 abortion pills for sale in Durban
%in Durban+277-882-255-28 abortion pills for sale in Durban
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 

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