SlideShare a Scribd company logo
1 of 32
Download to read offline
© 2015 IBM Corporation
AAI-2236
Using the New Java Concurrency Utilities
with IBM WebSphere
Kevin Sutter, STSM
WebSphere Java EE Architect
Agenda
• Introduction
• Managed services
• Additional APIs
• Additional Resources
1
Introduction
2
2003 2006 2008 2012 2013
JSR 236
released as part
of Java EE 7
JSR237 is
merged into
JSR236
JSR236 (Timers)
and JSR237 (Work
Managers) filed
CommonJ API
replaced with
extension of Java SE
concurrency API
JSR 236
restarted
JSR Timeline
Introduction
Goals
• Provide easy-to-use support to developers for both simple and
advanced concurrency patterns
• Provide a path to migrate standalone apps using Java SE
Concurrency Utilities (JSR-166) to the Java EE platform with a
consistent API
• Provide an easy-to-understand API for developers to create
applications using concurrency design principles
• Make it easy to add concurrency to existing Java EE
applications
3
Introduction
• Extension of the Java SE Concurrency Utilities API
• Addresses long standing tenant of EE app servers that well-
behaved applications should not create threads
• WebSphere (like other application servers) provided other
mechanisms for creating and managing threads, such as
Asynchronous Beans, CommonJ Timer and Work Manager.
• Asynchronous task lifecycle management, monitoring and
notification
• Flexible propagation of common Java EE contexts to tasks
4
Available 4Q2014 via Liberty Repository!
Agenda
• Introduction
• Managed services
• Additional APIs
• Summary
• Additional Resources
5
Services
Overview
• JSR 236 defines four services to be provided by an application
server
• ManagedExecutorService
• ManagedScheduledExecutorService
• ManagedThreadFactory
• ContextService
• Services are accessed by application via:
• resource injection using @Resource
• JNDI lookup
• default instances
• Configured through vendor-defined properties
6
Services
ManagedExecutorService overview
• Provides a familiar API for concurrent processing of tasks in
Java EE
• Extends java.util.concurrent.ExecutorService of
Java SE concurrency API
• Allow execution of asynchronous tasks on server managed
threads
• Tasks must implement either:
– java.lang.Runnable
– java.util.concurrent.Callable
7
Services
ManagedExecutorService API
• Supports Java EE context propagation including JNDI naming,
classloader, and security contexts
• Not transactional contexts
• Because the service is managed by the server, calling any of
the lifecycle API methods results in IllegalStateException
• Like Java SE, task(s) submission returns one or more
Future(s). These are used to:
• check for task execution status
• wait for and retrieve task result
• cancel task
8
Services
ManagedExecutorService Example
@WebServlet(asyncSupported=true)
public class MyServlet extends HttpServlet {
@Resource ManagedExecutorService managedExecutorService;
protected void doGet(HttpServletRequest request,
HttpServletResponse response {
final AsyncContext asyncContext = request.startAsync();
…
Runnable myTask = new Runnable() {
public void run() {
asyncContext.complete();
}
};
…
Future future = managedExecutorService.submit(myTask);
}
9
Services
ManagedScheduledExecutorService overview
• Provides a familiar API for scheduling asynchronous tasks in
Java EE
• Supports Java EE context propagation including JNDI naming,
classloader, and security contexts
• Not transactional contexts
• Used for scheduling tasks to run:
• periodically
• after specified delay
• at some custom schedule
10
Services
ManagedScheduledExecutorService API
• Extends both ManagedExecutorService and
java.util.concurrent.ScheduledExecutorService
interfaces
• Like ManagedExecutorService, calling any of the lifecycle
API methods results in IllegalStateException
• In addition to schedule methods inherited from Java SE API,
adds methods to support custom scheduling
• schedule with Trigger interface
11
Services
ManagedScheduledExecutorService Trigger API
• Interface implemented by application developer to support
flexible, custom scheduling
• Scheduling rules may be:
• simple: a single, absolute date/time
• complex: calendar logic
• Trigger is submitted along with a task using a schedule
method in ManagedScheduledExecutorService
12
Services
ManagedScheduledExecutorService Trigger Example
public class SimpleFixedDateTrigger implements Trigger {
private Date fireTime;
public SimpleFixedDateTrigger(Date triggerDate) {
fireTime = triggerDate;
}
public Date getNextRunTime(LastExecution lastExecutionInfo,
Date taskScheduledTime) {
if(taskScheduledTime.after(fireTime)) return null;
return fireTime;
}
public boolean skipRun(LastExecution lastExecutionInfo,
Date scheduledRunTime) {
return scheduledRunTime.after(fireTime);
}
}
13
Services
ManagedThreadFactory overview
• Provides the means for Java EE applications to obtain
container-managed threads
• Supports Java EE context propagation including JNDI naming,
classloader, and security contexts
• Not transactional contexts
14
Services
ManagedThreadFactory API
• Extends java.util.concurrent.ThreadFactory
• Same API: Thread.newThread(Runnable)
• Supports Java EE context propagation including JNDI naming,
classloader, and security contexts
• Not transactional contexts
• Threads from factory are:
• contextualized with container context
• required to implement the ManagableThread interface
15
Services
ManagedThreadFactory Example
// Create a ThreadPoolExecutor using a ManagedThreadFactory.
@Resource ManagedThreadFactory threadFactory;
public ExecutorService getManagedThreadPool() {
// All threads will be contextualized with the context
// of the creating application component.
return new ThreadPoolExecutor(5, 10, 5, TimeUnit.SECONDS,
new ArrayBlockingQueue<Runnable>(10), threadFactory);
}
16
Services
ContextService overview
• Creates dynamic proxy objects
• objects are contextualized with container context upon creation
• object methods execute with that captured context
• Used by the other services to contextualize task and threads
• May be used directly for advanced use cases:
• request contextualization of Trigger methods
• request contextualization of task listener notification methods
• propagate custom contexts
• Execution properties control how contextualization occurs
17
Services
ContextService API
• Methods to create contextual proxy objects:
• <T> T createContextualProxy(T instance,
Class<T> intf)
• Object createContextualProxy(Object instance,
Class<?>... Interfaces)
• <T> T createContextualProxy(T instance,
Map<String,String> executionProperties,
Class<T> intf)
• Object createContextualProxy(Object instance,
Map<String,String> executionProperties,
Class<?>... Interfaces)
18
Services
ContextService Example
public class MyRunnable implements Runnable {
public void run() {
System.out.println("MyRunnable.run with Java EE Context");
}
}
@Resource ThreadFactory threadFactory;
@Resource ContextService ctxService;
MyRunnable myRunnableInstance = new MyRunnable();
Runnable rProxy =ctxService.createContextualProxy(
myRunnableInstance, Runnable.class);
ExecutorService exSvc = Executors.newThreadPool(10, threadFactory);
Future future = exSvc.submit(rProxy);
19
Agenda
• Introduction
• Managed services
• Additional APIs
• Additional Resources
20
Additional APIs
Transaction Management
• Transactions are not propagated to the threads on which tasks
are run
• Application may obtain a UserTransaction from JTA
• Contextual proxy objects can run in the transaction context of
the invoking thread, controlled by the execution property
ManagedTask.TRANSACTION
• default is ManagedTask.SUSPEND
• ManagedTask.USE_TRANSACTION_OF_EXECUTION_THREAD
21
Additional APIs
ManagedTaskListener
• Tasks events are emitted to listeners via
ManagedTaskListener methods when tasks are:
• submitted
• unable to start or cancelled
• starting
• completed, either successfully or with exceptions
• Useful for:
• monitoring task progress
• resubmitting failed tasks
• ManagedTaskListener methods execute with unspecified
context by default
22
Additional APIs
ManagedTask
• Any task can optionally implement ManagedTask interface
which provides:
• ManagedTaskListener for lifecycle events notification
• task identification
• any desired execution properties
• Other standard execution ManagedTask properties
• IDENTITY_NAME – used to provide a task name
• LONGRUNNING_HINT – hint of task length
• TRANSACTION – controls transaction participation
– SUSPEND
– USE_TRANSACTION_OF_EXECUTION_THREAD
23
Additional APIs
ManagedExecutors
• Similar to Executors utility class of Java SE concurrency
package, contain methods for:
• Creating a ManagedTask capable of receiving notifications via
the specified ManagedTaskListener and with any specified
execution properties
• Testing whether current thread is a ManageableThread that has
been marked for shutdown
24
Agenda
• Introduction
• Managed services
• Additional APIs
• Additional Resources
25
Additional Resources
• JSR236 specification and API docs
• http://jcp.org/en/jsr/detail?id=236
• JSR236 forum
• http://concurrency-ee-spec.java.net
• Java EE 7 API docs
• http://docs.oracle.com/javaee/7/api
26
Sampling of Related Sessions…
• AAI-1713A: Introduction to Java EE 7
• Monday, 2-3pm, Mandalay Bay, Reef Ballroom E
• AAI-1641A: Introduction to Web Sockets
• Monday, 5-6pm, Mandalay Bay, Reef Ballroom E
• AAI-1313A: Agile Development Using Java EE 7 with WebSphere Liberty Profile
(LAB)
• Tuesday, 8-10am, Mandalay Bay, South Seas Ballroom D
• AAI-2236A: Using the New Java Concurrency Utilities with IBM WebSphere
• Tuesday, 2-3pm, Mandalay Bay, Reef Ballroom D
• AAI-2235A: OpenJPA and EclipseLink Usage Scenarios Explained
• Wednesday, 5:30-6:30pm, Mandalay Bay, Surf Ballroom A
• AAI-1610A: Configuring IBM WebSphere Application Server for Enterprise
Messaging Needs
• Wednesday, 5:30-6:30pm, Mandalay Bay, Surf Ballroom E
• AAI-3085A: Don’t Wait! Develop Responsive Applications with Java EE7 Instead
• Thursday, 10:30-11:30am, Mandalay Bay, Lagoon L
27
Questions?
28
Notices and Disclaimers
Copyright © 2015 by International Business Machines Corporation (IBM). No part of this document may be reproduced or
transmitted in any form without written permission from IBM.
U.S. Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with
IBM.
Information in these presentations (including information relating to products that have not yet been announced by IBM) has been
reviewed for accuracy as of the date of initial publication and could include unintentional technical or typographical errors. IBM
shall have no responsibility to update this information. THIS DOCUMENT IS DISTRIBUTED "AS IS" WITHOUT ANY WARRANTY,
EITHER EXPRESS OR IMPLIED. IN NO EVENT SHALL IBM BE LIABLE FOR ANY DAMAGE ARISING FROM THE USE OF
THIS INFORMATION, INCLUDING BUT NOT LIMITED TO, LOSS OF DATA, BUSINESS INTERRUPTION, LOSS OF PROFIT
OR LOSS OF OPPORTUNITY. IBM products and services are warranted according to the terms and conditions of the
agreements under which they are provided.
Any statements regarding IBM's future direction, intent or product plans are subject to change or withdrawal without
notice.
Performance data contained herein was generally obtained in a controlled, isolated environments. Customer examples are
presented as illustrations of how those customers have used IBM products and the results they may have achieved. Actual
performance, cost, savings or other results in other operating environments may vary.
References in this document to IBM products, programs, or services does not imply that IBM intends to make such products,
programs or services available in all countries in which IBM operates or does business.
Workshops, sessions and associated materials may have been prepared by independent session speakers, and do not
necessarily reflect the views of IBM. All materials and discussions are provided for informational purposes only, and are neither
intended to, nor shall constitute legal or other guidance or advice to any individual participant or their specific situation.
It is the customer’s responsibility to insure its own compliance with legal requirements and to obtain advice of competent legal
counsel as to the identification and interpretation of any relevant laws and regulatory requirements that may affect the customer’s
business and any actions the customer may need to take to comply with such laws. IBM does not provide legal advice or
represent or warrant that its services or products will ensure that the customer is in compliance with any law.
Notices and Disclaimers (con’t)
Information concerning non-IBM products was obtained from the suppliers of those products, their published
announcements or other publicly available sources. IBM has not tested those products in connection with this
publication and cannot confirm the accuracy of performance, compatibility or any other claims related to non-IBM
products. Questions on the capabilities of non-IBM products should be addressed to the suppliers of those products.
IBM does not warrant the quality of any third-party products, or the ability of any such third-party products to
interoperate with IBM’s products. IBM EXPRESSLY DISCLAIMS ALL WARRANTIES, EXPRESSED OR IMPLIED,
INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
PARTICULAR PURPOSE.
The provision of the information contained herein is not intended to, and does not, grant any right or license under any
IBM patents, copyrights, trademarks or other intellectual property right.
• IBM, the IBM logo, ibm.com, Bluemix, Blueworks Live, CICS, Clearcase, DOORS®, Enterprise Document
Management System™, Global Business Services ®, Global Technology Services ®, Information on Demand,
ILOG, Maximo®, MQIntegrator®, MQSeries®, Netcool®, OMEGAMON, OpenPower, PureAnalytics™,
PureApplication®, pureCluster™, PureCoverage®, PureData®, PureExperience®, PureFlex®, pureQuery®,
pureScale®, PureSystems®, QRadar®, Rational®, Rhapsody®, SoDA, SPSS, StoredIQ, Tivoli®, Trusteer®,
urban{code}®, Watson, WebSphere®, Worklight®, X-Force® and System z® Z/OS, are trademarks of
International Business Machines Corporation, registered in many jurisdictions worldwide. Other product and
service names might be trademarks of IBM or other companies. A current list of IBM trademarks is available on
the Web at "Copyright and trademark information" at: www.ibm.com/legal/copytrade.shtml.
Thank You
Your Feedback is
Important!
Access the InterConnect 2015
Conference CONNECT Attendee
Portal to complete your session
surveys from your smartphone,
laptop or conference kiosk.

More Related Content

What's hot

Java servlets
Java servletsJava servlets
Java servletslopjuan
 
Java Servlets
Java ServletsJava Servlets
Java ServletsEmprovise
 
Akka Actor presentation
Akka Actor presentationAkka Actor presentation
Akka Actor presentationGene Chang
 
Servletarchitecture,lifecycle,get,post
Servletarchitecture,lifecycle,get,postServletarchitecture,lifecycle,get,post
Servletarchitecture,lifecycle,get,postvamsi krishna
 
Web Tech Java Servlet Update1
Web Tech   Java Servlet Update1Web Tech   Java Servlet Update1
Web Tech Java Servlet Update1vikram singh
 
Lecture 7 Web Services JAX-WS & JAX-RS
Lecture 7   Web Services JAX-WS & JAX-RSLecture 7   Web Services JAX-WS & JAX-RS
Lecture 7 Web Services JAX-WS & JAX-RSFahad Golra
 
Spring 4 on Java 8 by Juergen Hoeller
Spring 4 on Java 8 by Juergen HoellerSpring 4 on Java 8 by Juergen Hoeller
Spring 4 on Java 8 by Juergen HoellerZeroTurnaround
 
Core web application development
Core web application developmentCore web application development
Core web application developmentBahaa Farouk
 
Javax.servlet,http packages
Javax.servlet,http packagesJavax.servlet,http packages
Javax.servlet,http packagesvamsi krishna
 
ASP.Net 5 and C# 6
ASP.Net 5 and C# 6ASP.Net 5 and C# 6
ASP.Net 5 and C# 6Andy Butland
 
Dropwizard Internals
Dropwizard InternalsDropwizard Internals
Dropwizard Internalscarlo-rtr
 
An Introduction To Java Web Technology
An Introduction To Java Web TechnologyAn Introduction To Java Web Technology
An Introduction To Java Web Technologyvikram singh
 
Knowledge Sharing : Java Servlet
Knowledge Sharing : Java ServletKnowledge Sharing : Java Servlet
Knowledge Sharing : Java ServletFahmi Jafar
 

What's hot (19)

JAVA Servlets
JAVA ServletsJAVA Servlets
JAVA Servlets
 
Java servlets
Java servletsJava servlets
Java servlets
 
Java Servlets
Java ServletsJava Servlets
Java Servlets
 
Akka Actor presentation
Akka Actor presentationAkka Actor presentation
Akka Actor presentation
 
SERVIET
SERVIETSERVIET
SERVIET
 
Servlet
Servlet Servlet
Servlet
 
Servletarchitecture,lifecycle,get,post
Servletarchitecture,lifecycle,get,postServletarchitecture,lifecycle,get,post
Servletarchitecture,lifecycle,get,post
 
Web Tech Java Servlet Update1
Web Tech   Java Servlet Update1Web Tech   Java Servlet Update1
Web Tech Java Servlet Update1
 
Lecture 7 Web Services JAX-WS & JAX-RS
Lecture 7   Web Services JAX-WS & JAX-RSLecture 7   Web Services JAX-WS & JAX-RS
Lecture 7 Web Services JAX-WS & JAX-RS
 
Spring 4 on Java 8 by Juergen Hoeller
Spring 4 on Java 8 by Juergen HoellerSpring 4 on Java 8 by Juergen Hoeller
Spring 4 on Java 8 by Juergen Hoeller
 
Java Servlets
Java ServletsJava Servlets
Java Servlets
 
Servlets
ServletsServlets
Servlets
 
Core web application development
Core web application developmentCore web application development
Core web application development
 
Javax.servlet,http packages
Javax.servlet,http packagesJavax.servlet,http packages
Javax.servlet,http packages
 
ASP.Net 5 and C# 6
ASP.Net 5 and C# 6ASP.Net 5 and C# 6
ASP.Net 5 and C# 6
 
Dropwizard Internals
Dropwizard InternalsDropwizard Internals
Dropwizard Internals
 
An Introduction To Java Web Technology
An Introduction To Java Web TechnologyAn Introduction To Java Web Technology
An Introduction To Java Web Technology
 
Knowledge Sharing : Java Servlet
Knowledge Sharing : Java ServletKnowledge Sharing : Java Servlet
Knowledge Sharing : Java Servlet
 
Connection Pooling
Connection PoolingConnection Pooling
Connection Pooling
 

Similar to AAI-2236 Using the new Java Concurrency Utilities with IBM WebSphere

Java EE 7 Recipes for Concurrency - JavaOne 2014
Java EE 7 Recipes for Concurrency - JavaOne 2014Java EE 7 Recipes for Concurrency - JavaOne 2014
Java EE 7 Recipes for Concurrency - JavaOne 2014Josh Juneau
 
Jakarta Concurrency: Present and Future
Jakarta Concurrency: Present and FutureJakarta Concurrency: Present and Future
Jakarta Concurrency: Present and FuturePayara
 
Liit tyit sem 5 enterprise java unit 1 notes 2018
Liit tyit sem 5 enterprise java  unit 1 notes 2018 Liit tyit sem 5 enterprise java  unit 1 notes 2018
Liit tyit sem 5 enterprise java unit 1 notes 2018 tanujaparihar
 
Testing Spring MVC and REST Web Applications
Testing Spring MVC and REST Web ApplicationsTesting Spring MVC and REST Web Applications
Testing Spring MVC and REST Web ApplicationsSam Brannen
 
MVC 6 - the new unified Web programming model
MVC 6 - the new unified Web programming modelMVC 6 - the new unified Web programming model
MVC 6 - the new unified Web programming modelAlex Thissen
 
Cloud compiler - Minor Project by students of CBPGEC
Cloud compiler - Minor Project by students of CBPGEC  Cloud compiler - Minor Project by students of CBPGEC
Cloud compiler - Minor Project by students of CBPGEC vipin kumar
 
9 plugin Cloudstack Developer Day
9 plugin Cloudstack Developer Day9 plugin Cloudstack Developer Day
9 plugin Cloudstack Developer DayKimihiko Kitase
 
Testing with Spring: An Introduction
Testing with Spring: An IntroductionTesting with Spring: An Introduction
Testing with Spring: An IntroductionSam Brannen
 
Haj 4328-java ee 7 overview
Haj 4328-java ee 7 overviewHaj 4328-java ee 7 overview
Haj 4328-java ee 7 overviewKevin Sutter
 
Migrating to Jakarta EE 10
Migrating to Jakarta EE 10Migrating to Jakarta EE 10
Migrating to Jakarta EE 10Josh Juneau
 
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
 
Microservices and modularity with java
Microservices and modularity with javaMicroservices and modularity with java
Microservices and modularity with javaDPC Consulting Ltd
 
How kubernetes operators can rescue dev secops in midst of a pandemic updated
How kubernetes operators can rescue dev secops in midst of a pandemic updatedHow kubernetes operators can rescue dev secops in midst of a pandemic updated
How kubernetes operators can rescue dev secops in midst of a pandemic updatedShikha Srivastava
 
Azure serverless architectures
Azure serverless architecturesAzure serverless architectures
Azure serverless architecturesBenoit Le Pichon
 
Java EE 8 Web Frameworks: A Look at JSF vs MVC
Java EE 8 Web Frameworks: A Look at JSF vs MVCJava EE 8 Web Frameworks: A Look at JSF vs MVC
Java EE 8 Web Frameworks: A Look at JSF vs MVCJosh Juneau
 

Similar to AAI-2236 Using the new Java Concurrency Utilities with IBM WebSphere (20)

Java EE 7 Recipes for Concurrency - JavaOne 2014
Java EE 7 Recipes for Concurrency - JavaOne 2014Java EE 7 Recipes for Concurrency - JavaOne 2014
Java EE 7 Recipes for Concurrency - JavaOne 2014
 
Jakarta Concurrency: Present and Future
Jakarta Concurrency: Present and FutureJakarta Concurrency: Present and Future
Jakarta Concurrency: Present and Future
 
Liit tyit sem 5 enterprise java unit 1 notes 2018
Liit tyit sem 5 enterprise java  unit 1 notes 2018 Liit tyit sem 5 enterprise java  unit 1 notes 2018
Liit tyit sem 5 enterprise java unit 1 notes 2018
 
Testing Spring MVC and REST Web Applications
Testing Spring MVC and REST Web ApplicationsTesting Spring MVC and REST Web Applications
Testing Spring MVC and REST Web Applications
 
Java concurrency
Java concurrencyJava concurrency
Java concurrency
 
MVC 6 - the new unified Web programming model
MVC 6 - the new unified Web programming modelMVC 6 - the new unified Web programming model
MVC 6 - the new unified Web programming model
 
Wt unit 3 server side technology
Wt unit 3 server side technologyWt unit 3 server side technology
Wt unit 3 server side technology
 
Wt unit 3 server side technology
Wt unit 3 server side technologyWt unit 3 server side technology
Wt unit 3 server side technology
 
Cloud compiler - Minor Project by students of CBPGEC
Cloud compiler - Minor Project by students of CBPGEC  Cloud compiler - Minor Project by students of CBPGEC
Cloud compiler - Minor Project by students of CBPGEC
 
9 plugin Cloudstack Developer Day
9 plugin Cloudstack Developer Day9 plugin Cloudstack Developer Day
9 plugin Cloudstack Developer Day
 
Testing with Spring: An Introduction
Testing with Spring: An IntroductionTesting with Spring: An Introduction
Testing with Spring: An Introduction
 
Haj 4328-java ee 7 overview
Haj 4328-java ee 7 overviewHaj 4328-java ee 7 overview
Haj 4328-java ee 7 overview
 
Migrating to Jakarta EE 10
Migrating to Jakarta EE 10Migrating to Jakarta EE 10
Migrating to Jakarta EE 10
 
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)
 
Microservices and modularity with java
Microservices and modularity with javaMicroservices and modularity with java
Microservices and modularity with java
 
Springboot Microservices
Springboot MicroservicesSpringboot Microservices
Springboot Microservices
 
Next stop: Spring 4
Next stop: Spring 4Next stop: Spring 4
Next stop: Spring 4
 
How kubernetes operators can rescue dev secops in midst of a pandemic updated
How kubernetes operators can rescue dev secops in midst of a pandemic updatedHow kubernetes operators can rescue dev secops in midst of a pandemic updated
How kubernetes operators can rescue dev secops in midst of a pandemic updated
 
Azure serverless architectures
Azure serverless architecturesAzure serverless architectures
Azure serverless architectures
 
Java EE 8 Web Frameworks: A Look at JSF vs MVC
Java EE 8 Web Frameworks: A Look at JSF vs MVCJava EE 8 Web Frameworks: A Look at JSF vs MVC
Java EE 8 Web Frameworks: A Look at JSF vs MVC
 

More from WASdev Community

Introduction to WebSockets
Introduction to WebSocketsIntroduction to WebSockets
Introduction to WebSocketsWASdev Community
 
WebSphere App Server vs JBoss vs WebLogic vs Tomcat
WebSphere App Server vs JBoss vs WebLogic vs TomcatWebSphere App Server vs JBoss vs WebLogic vs Tomcat
WebSphere App Server vs JBoss vs WebLogic vs TomcatWASdev Community
 
AAI-3281 Smarter Production with WebSphere Application Server ND Intelligent ...
AAI-3281 Smarter Production with WebSphere Application Server ND Intelligent ...AAI-3281 Smarter Production with WebSphere Application Server ND Intelligent ...
AAI-3281 Smarter Production with WebSphere Application Server ND Intelligent ...WASdev Community
 
AAI-3218 Production Deployment Best Practices for WebSphere Liberty Profile
AAI-3218 Production Deployment Best Practices for WebSphere Liberty ProfileAAI-3218 Production Deployment Best Practices for WebSphere Liberty Profile
AAI-3218 Production Deployment Best Practices for WebSphere Liberty ProfileWASdev Community
 
AAI-1445 Managing Dynamic Workloads with WebSphere ND and in the Cloud
AAI-1445 Managing Dynamic Workloads with WebSphere ND and in the CloudAAI-1445 Managing Dynamic Workloads with WebSphere ND and in the Cloud
AAI-1445 Managing Dynamic Workloads with WebSphere ND and in the CloudWASdev Community
 
ASZ-3034 Build a WebSphere Linux Cloud on System z: From Roll-Your-Own to Pre...
ASZ-3034 Build a WebSphere Linux Cloud on System z: From Roll-Your-Own to Pre...ASZ-3034 Build a WebSphere Linux Cloud on System z: From Roll-Your-Own to Pre...
ASZ-3034 Build a WebSphere Linux Cloud on System z: From Roll-Your-Own to Pre...WASdev Community
 
AAI-4847 Full Disclosure on the Performance Characteristics of WebSphere Appl...
AAI-4847 Full Disclosure on the Performance Characteristics of WebSphere Appl...AAI-4847 Full Disclosure on the Performance Characteristics of WebSphere Appl...
AAI-4847 Full Disclosure on the Performance Characteristics of WebSphere Appl...WASdev Community
 
AAI-2235 Open JPA and EclipseLink Usage Scenarios Explained
AAI-2235 Open JPA and EclipseLink Usage Scenarios ExplainedAAI-2235 Open JPA and EclipseLink Usage Scenarios Explained
AAI-2235 Open JPA and EclipseLink Usage Scenarios ExplainedWASdev Community
 
AAI-1713 Introduction to Java EE 7
AAI-1713 Introduction to Java EE 7AAI-1713 Introduction to Java EE 7
AAI-1713 Introduction to Java EE 7WASdev Community
 
Deploy, Monitor and Manage in Style with WebSphere Liberty Admin Center
Deploy, Monitor and Manage in Style with WebSphere Liberty Admin CenterDeploy, Monitor and Manage in Style with WebSphere Liberty Admin Center
Deploy, Monitor and Manage in Style with WebSphere Liberty Admin CenterWASdev Community
 
AAI-2075 Evolving an IBM WebSphere Topology to Manage a Changing Workloa
AAI-2075 Evolving an IBM WebSphere Topology to Manage a Changing WorkloaAAI-2075 Evolving an IBM WebSphere Topology to Manage a Changing Workloa
AAI-2075 Evolving an IBM WebSphere Topology to Manage a Changing WorkloaWASdev Community
 
AAI-2016 WebSphere Application Server Installation and Maintenance in the Ent...
AAI-2016 WebSphere Application Server Installation and Maintenance in the Ent...AAI-2016 WebSphere Application Server Installation and Maintenance in the Ent...
AAI-2016 WebSphere Application Server Installation and Maintenance in the Ent...WASdev Community
 
AAI-2013 Preparing to Fail: Practical WebSphere Application Server High Avail...
AAI-2013 Preparing to Fail: Practical WebSphere Application Server High Avail...AAI-2013 Preparing to Fail: Practical WebSphere Application Server High Avail...
AAI-2013 Preparing to Fail: Practical WebSphere Application Server High Avail...WASdev Community
 
AAI-1305 Choosing WebSphere Liberty for Java EE Deployments
AAI-1305 Choosing WebSphere Liberty for Java EE DeploymentsAAI-1305 Choosing WebSphere Liberty for Java EE Deployments
AAI-1305 Choosing WebSphere Liberty for Java EE DeploymentsWASdev Community
 
AAI-1304 Technical Deep-Dive into IBM WebSphere Liberty
AAI-1304 Technical Deep-Dive into IBM WebSphere LibertyAAI-1304 Technical Deep-Dive into IBM WebSphere Liberty
AAI-1304 Technical Deep-Dive into IBM WebSphere LibertyWASdev Community
 
Planning For Catastrophe with IBM WAS and IBM BPM
Planning For Catastrophe with IBM WAS and IBM BPMPlanning For Catastrophe with IBM WAS and IBM BPM
Planning For Catastrophe with IBM WAS and IBM BPMWASdev Community
 
Arduinos, application servers, and me: Adventures in and out of the cloud
Arduinos, application servers, and me: Adventures in and out of the cloudArduinos, application servers, and me: Adventures in and out of the cloud
Arduinos, application servers, and me: Adventures in and out of the cloudWASdev Community
 

More from WASdev Community (19)

Liberty Deep Dive
Liberty Deep DiveLiberty Deep Dive
Liberty Deep Dive
 
Introduction to WebSockets
Introduction to WebSocketsIntroduction to WebSockets
Introduction to WebSockets
 
Liberty management
Liberty managementLiberty management
Liberty management
 
WebSphere App Server vs JBoss vs WebLogic vs Tomcat
WebSphere App Server vs JBoss vs WebLogic vs TomcatWebSphere App Server vs JBoss vs WebLogic vs Tomcat
WebSphere App Server vs JBoss vs WebLogic vs Tomcat
 
AAI-3281 Smarter Production with WebSphere Application Server ND Intelligent ...
AAI-3281 Smarter Production with WebSphere Application Server ND Intelligent ...AAI-3281 Smarter Production with WebSphere Application Server ND Intelligent ...
AAI-3281 Smarter Production with WebSphere Application Server ND Intelligent ...
 
AAI-3218 Production Deployment Best Practices for WebSphere Liberty Profile
AAI-3218 Production Deployment Best Practices for WebSphere Liberty ProfileAAI-3218 Production Deployment Best Practices for WebSphere Liberty Profile
AAI-3218 Production Deployment Best Practices for WebSphere Liberty Profile
 
AAI-1445 Managing Dynamic Workloads with WebSphere ND and in the Cloud
AAI-1445 Managing Dynamic Workloads with WebSphere ND and in the CloudAAI-1445 Managing Dynamic Workloads with WebSphere ND and in the Cloud
AAI-1445 Managing Dynamic Workloads with WebSphere ND and in the Cloud
 
ASZ-3034 Build a WebSphere Linux Cloud on System z: From Roll-Your-Own to Pre...
ASZ-3034 Build a WebSphere Linux Cloud on System z: From Roll-Your-Own to Pre...ASZ-3034 Build a WebSphere Linux Cloud on System z: From Roll-Your-Own to Pre...
ASZ-3034 Build a WebSphere Linux Cloud on System z: From Roll-Your-Own to Pre...
 
AAI-4847 Full Disclosure on the Performance Characteristics of WebSphere Appl...
AAI-4847 Full Disclosure on the Performance Characteristics of WebSphere Appl...AAI-4847 Full Disclosure on the Performance Characteristics of WebSphere Appl...
AAI-4847 Full Disclosure on the Performance Characteristics of WebSphere Appl...
 
AAI-2235 Open JPA and EclipseLink Usage Scenarios Explained
AAI-2235 Open JPA and EclipseLink Usage Scenarios ExplainedAAI-2235 Open JPA and EclipseLink Usage Scenarios Explained
AAI-2235 Open JPA and EclipseLink Usage Scenarios Explained
 
AAI-1713 Introduction to Java EE 7
AAI-1713 Introduction to Java EE 7AAI-1713 Introduction to Java EE 7
AAI-1713 Introduction to Java EE 7
 
Deploy, Monitor and Manage in Style with WebSphere Liberty Admin Center
Deploy, Monitor and Manage in Style with WebSphere Liberty Admin CenterDeploy, Monitor and Manage in Style with WebSphere Liberty Admin Center
Deploy, Monitor and Manage in Style with WebSphere Liberty Admin Center
 
AAI-2075 Evolving an IBM WebSphere Topology to Manage a Changing Workloa
AAI-2075 Evolving an IBM WebSphere Topology to Manage a Changing WorkloaAAI-2075 Evolving an IBM WebSphere Topology to Manage a Changing Workloa
AAI-2075 Evolving an IBM WebSphere Topology to Manage a Changing Workloa
 
AAI-2016 WebSphere Application Server Installation and Maintenance in the Ent...
AAI-2016 WebSphere Application Server Installation and Maintenance in the Ent...AAI-2016 WebSphere Application Server Installation and Maintenance in the Ent...
AAI-2016 WebSphere Application Server Installation and Maintenance in the Ent...
 
AAI-2013 Preparing to Fail: Practical WebSphere Application Server High Avail...
AAI-2013 Preparing to Fail: Practical WebSphere Application Server High Avail...AAI-2013 Preparing to Fail: Practical WebSphere Application Server High Avail...
AAI-2013 Preparing to Fail: Practical WebSphere Application Server High Avail...
 
AAI-1305 Choosing WebSphere Liberty for Java EE Deployments
AAI-1305 Choosing WebSphere Liberty for Java EE DeploymentsAAI-1305 Choosing WebSphere Liberty for Java EE Deployments
AAI-1305 Choosing WebSphere Liberty for Java EE Deployments
 
AAI-1304 Technical Deep-Dive into IBM WebSphere Liberty
AAI-1304 Technical Deep-Dive into IBM WebSphere LibertyAAI-1304 Technical Deep-Dive into IBM WebSphere Liberty
AAI-1304 Technical Deep-Dive into IBM WebSphere Liberty
 
Planning For Catastrophe with IBM WAS and IBM BPM
Planning For Catastrophe with IBM WAS and IBM BPMPlanning For Catastrophe with IBM WAS and IBM BPM
Planning For Catastrophe with IBM WAS and IBM BPM
 
Arduinos, application servers, and me: Adventures in and out of the cloud
Arduinos, application servers, and me: Adventures in and out of the cloudArduinos, application servers, and me: Adventures in and out of the cloud
Arduinos, application servers, and me: Adventures in and out of the cloud
 

Recently uploaded

Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendArshad QA
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
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
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 

Recently uploaded (20)

Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and Backend
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the ProcessExploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
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 ...
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 

AAI-2236 Using the new Java Concurrency Utilities with IBM WebSphere

  • 1. © 2015 IBM Corporation AAI-2236 Using the New Java Concurrency Utilities with IBM WebSphere Kevin Sutter, STSM WebSphere Java EE Architect
  • 2. Agenda • Introduction • Managed services • Additional APIs • Additional Resources 1
  • 3. Introduction 2 2003 2006 2008 2012 2013 JSR 236 released as part of Java EE 7 JSR237 is merged into JSR236 JSR236 (Timers) and JSR237 (Work Managers) filed CommonJ API replaced with extension of Java SE concurrency API JSR 236 restarted JSR Timeline
  • 4. Introduction Goals • Provide easy-to-use support to developers for both simple and advanced concurrency patterns • Provide a path to migrate standalone apps using Java SE Concurrency Utilities (JSR-166) to the Java EE platform with a consistent API • Provide an easy-to-understand API for developers to create applications using concurrency design principles • Make it easy to add concurrency to existing Java EE applications 3
  • 5. Introduction • Extension of the Java SE Concurrency Utilities API • Addresses long standing tenant of EE app servers that well- behaved applications should not create threads • WebSphere (like other application servers) provided other mechanisms for creating and managing threads, such as Asynchronous Beans, CommonJ Timer and Work Manager. • Asynchronous task lifecycle management, monitoring and notification • Flexible propagation of common Java EE contexts to tasks 4 Available 4Q2014 via Liberty Repository!
  • 6. Agenda • Introduction • Managed services • Additional APIs • Summary • Additional Resources 5
  • 7. Services Overview • JSR 236 defines four services to be provided by an application server • ManagedExecutorService • ManagedScheduledExecutorService • ManagedThreadFactory • ContextService • Services are accessed by application via: • resource injection using @Resource • JNDI lookup • default instances • Configured through vendor-defined properties 6
  • 8. Services ManagedExecutorService overview • Provides a familiar API for concurrent processing of tasks in Java EE • Extends java.util.concurrent.ExecutorService of Java SE concurrency API • Allow execution of asynchronous tasks on server managed threads • Tasks must implement either: – java.lang.Runnable – java.util.concurrent.Callable 7
  • 9. Services ManagedExecutorService API • Supports Java EE context propagation including JNDI naming, classloader, and security contexts • Not transactional contexts • Because the service is managed by the server, calling any of the lifecycle API methods results in IllegalStateException • Like Java SE, task(s) submission returns one or more Future(s). These are used to: • check for task execution status • wait for and retrieve task result • cancel task 8
  • 10. Services ManagedExecutorService Example @WebServlet(asyncSupported=true) public class MyServlet extends HttpServlet { @Resource ManagedExecutorService managedExecutorService; protected void doGet(HttpServletRequest request, HttpServletResponse response { final AsyncContext asyncContext = request.startAsync(); … Runnable myTask = new Runnable() { public void run() { asyncContext.complete(); } }; … Future future = managedExecutorService.submit(myTask); } 9
  • 11. Services ManagedScheduledExecutorService overview • Provides a familiar API for scheduling asynchronous tasks in Java EE • Supports Java EE context propagation including JNDI naming, classloader, and security contexts • Not transactional contexts • Used for scheduling tasks to run: • periodically • after specified delay • at some custom schedule 10
  • 12. Services ManagedScheduledExecutorService API • Extends both ManagedExecutorService and java.util.concurrent.ScheduledExecutorService interfaces • Like ManagedExecutorService, calling any of the lifecycle API methods results in IllegalStateException • In addition to schedule methods inherited from Java SE API, adds methods to support custom scheduling • schedule with Trigger interface 11
  • 13. Services ManagedScheduledExecutorService Trigger API • Interface implemented by application developer to support flexible, custom scheduling • Scheduling rules may be: • simple: a single, absolute date/time • complex: calendar logic • Trigger is submitted along with a task using a schedule method in ManagedScheduledExecutorService 12
  • 14. Services ManagedScheduledExecutorService Trigger Example public class SimpleFixedDateTrigger implements Trigger { private Date fireTime; public SimpleFixedDateTrigger(Date triggerDate) { fireTime = triggerDate; } public Date getNextRunTime(LastExecution lastExecutionInfo, Date taskScheduledTime) { if(taskScheduledTime.after(fireTime)) return null; return fireTime; } public boolean skipRun(LastExecution lastExecutionInfo, Date scheduledRunTime) { return scheduledRunTime.after(fireTime); } } 13
  • 15. Services ManagedThreadFactory overview • Provides the means for Java EE applications to obtain container-managed threads • Supports Java EE context propagation including JNDI naming, classloader, and security contexts • Not transactional contexts 14
  • 16. Services ManagedThreadFactory API • Extends java.util.concurrent.ThreadFactory • Same API: Thread.newThread(Runnable) • Supports Java EE context propagation including JNDI naming, classloader, and security contexts • Not transactional contexts • Threads from factory are: • contextualized with container context • required to implement the ManagableThread interface 15
  • 17. Services ManagedThreadFactory Example // Create a ThreadPoolExecutor using a ManagedThreadFactory. @Resource ManagedThreadFactory threadFactory; public ExecutorService getManagedThreadPool() { // All threads will be contextualized with the context // of the creating application component. return new ThreadPoolExecutor(5, 10, 5, TimeUnit.SECONDS, new ArrayBlockingQueue<Runnable>(10), threadFactory); } 16
  • 18. Services ContextService overview • Creates dynamic proxy objects • objects are contextualized with container context upon creation • object methods execute with that captured context • Used by the other services to contextualize task and threads • May be used directly for advanced use cases: • request contextualization of Trigger methods • request contextualization of task listener notification methods • propagate custom contexts • Execution properties control how contextualization occurs 17
  • 19. Services ContextService API • Methods to create contextual proxy objects: • <T> T createContextualProxy(T instance, Class<T> intf) • Object createContextualProxy(Object instance, Class<?>... Interfaces) • <T> T createContextualProxy(T instance, Map<String,String> executionProperties, Class<T> intf) • Object createContextualProxy(Object instance, Map<String,String> executionProperties, Class<?>... Interfaces) 18
  • 20. Services ContextService Example public class MyRunnable implements Runnable { public void run() { System.out.println("MyRunnable.run with Java EE Context"); } } @Resource ThreadFactory threadFactory; @Resource ContextService ctxService; MyRunnable myRunnableInstance = new MyRunnable(); Runnable rProxy =ctxService.createContextualProxy( myRunnableInstance, Runnable.class); ExecutorService exSvc = Executors.newThreadPool(10, threadFactory); Future future = exSvc.submit(rProxy); 19
  • 21. Agenda • Introduction • Managed services • Additional APIs • Additional Resources 20
  • 22. Additional APIs Transaction Management • Transactions are not propagated to the threads on which tasks are run • Application may obtain a UserTransaction from JTA • Contextual proxy objects can run in the transaction context of the invoking thread, controlled by the execution property ManagedTask.TRANSACTION • default is ManagedTask.SUSPEND • ManagedTask.USE_TRANSACTION_OF_EXECUTION_THREAD 21
  • 23. Additional APIs ManagedTaskListener • Tasks events are emitted to listeners via ManagedTaskListener methods when tasks are: • submitted • unable to start or cancelled • starting • completed, either successfully or with exceptions • Useful for: • monitoring task progress • resubmitting failed tasks • ManagedTaskListener methods execute with unspecified context by default 22
  • 24. Additional APIs ManagedTask • Any task can optionally implement ManagedTask interface which provides: • ManagedTaskListener for lifecycle events notification • task identification • any desired execution properties • Other standard execution ManagedTask properties • IDENTITY_NAME – used to provide a task name • LONGRUNNING_HINT – hint of task length • TRANSACTION – controls transaction participation – SUSPEND – USE_TRANSACTION_OF_EXECUTION_THREAD 23
  • 25. Additional APIs ManagedExecutors • Similar to Executors utility class of Java SE concurrency package, contain methods for: • Creating a ManagedTask capable of receiving notifications via the specified ManagedTaskListener and with any specified execution properties • Testing whether current thread is a ManageableThread that has been marked for shutdown 24
  • 26. Agenda • Introduction • Managed services • Additional APIs • Additional Resources 25
  • 27. Additional Resources • JSR236 specification and API docs • http://jcp.org/en/jsr/detail?id=236 • JSR236 forum • http://concurrency-ee-spec.java.net • Java EE 7 API docs • http://docs.oracle.com/javaee/7/api 26
  • 28. Sampling of Related Sessions… • AAI-1713A: Introduction to Java EE 7 • Monday, 2-3pm, Mandalay Bay, Reef Ballroom E • AAI-1641A: Introduction to Web Sockets • Monday, 5-6pm, Mandalay Bay, Reef Ballroom E • AAI-1313A: Agile Development Using Java EE 7 with WebSphere Liberty Profile (LAB) • Tuesday, 8-10am, Mandalay Bay, South Seas Ballroom D • AAI-2236A: Using the New Java Concurrency Utilities with IBM WebSphere • Tuesday, 2-3pm, Mandalay Bay, Reef Ballroom D • AAI-2235A: OpenJPA and EclipseLink Usage Scenarios Explained • Wednesday, 5:30-6:30pm, Mandalay Bay, Surf Ballroom A • AAI-1610A: Configuring IBM WebSphere Application Server for Enterprise Messaging Needs • Wednesday, 5:30-6:30pm, Mandalay Bay, Surf Ballroom E • AAI-3085A: Don’t Wait! Develop Responsive Applications with Java EE7 Instead • Thursday, 10:30-11:30am, Mandalay Bay, Lagoon L 27
  • 30. Notices and Disclaimers Copyright © 2015 by International Business Machines Corporation (IBM). No part of this document may be reproduced or transmitted in any form without written permission from IBM. U.S. Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM. Information in these presentations (including information relating to products that have not yet been announced by IBM) has been reviewed for accuracy as of the date of initial publication and could include unintentional technical or typographical errors. IBM shall have no responsibility to update this information. THIS DOCUMENT IS DISTRIBUTED "AS IS" WITHOUT ANY WARRANTY, EITHER EXPRESS OR IMPLIED. IN NO EVENT SHALL IBM BE LIABLE FOR ANY DAMAGE ARISING FROM THE USE OF THIS INFORMATION, INCLUDING BUT NOT LIMITED TO, LOSS OF DATA, BUSINESS INTERRUPTION, LOSS OF PROFIT OR LOSS OF OPPORTUNITY. IBM products and services are warranted according to the terms and conditions of the agreements under which they are provided. Any statements regarding IBM's future direction, intent or product plans are subject to change or withdrawal without notice. Performance data contained herein was generally obtained in a controlled, isolated environments. Customer examples are presented as illustrations of how those customers have used IBM products and the results they may have achieved. Actual performance, cost, savings or other results in other operating environments may vary. References in this document to IBM products, programs, or services does not imply that IBM intends to make such products, programs or services available in all countries in which IBM operates or does business. Workshops, sessions and associated materials may have been prepared by independent session speakers, and do not necessarily reflect the views of IBM. All materials and discussions are provided for informational purposes only, and are neither intended to, nor shall constitute legal or other guidance or advice to any individual participant or their specific situation. It is the customer’s responsibility to insure its own compliance with legal requirements and to obtain advice of competent legal counsel as to the identification and interpretation of any relevant laws and regulatory requirements that may affect the customer’s business and any actions the customer may need to take to comply with such laws. IBM does not provide legal advice or represent or warrant that its services or products will ensure that the customer is in compliance with any law.
  • 31. Notices and Disclaimers (con’t) Information concerning non-IBM products was obtained from the suppliers of those products, their published announcements or other publicly available sources. IBM has not tested those products in connection with this publication and cannot confirm the accuracy of performance, compatibility or any other claims related to non-IBM products. Questions on the capabilities of non-IBM products should be addressed to the suppliers of those products. IBM does not warrant the quality of any third-party products, or the ability of any such third-party products to interoperate with IBM’s products. IBM EXPRESSLY DISCLAIMS ALL WARRANTIES, EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. The provision of the information contained herein is not intended to, and does not, grant any right or license under any IBM patents, copyrights, trademarks or other intellectual property right. • IBM, the IBM logo, ibm.com, Bluemix, Blueworks Live, CICS, Clearcase, DOORS®, Enterprise Document Management System™, Global Business Services ®, Global Technology Services ®, Information on Demand, ILOG, Maximo®, MQIntegrator®, MQSeries®, Netcool®, OMEGAMON, OpenPower, PureAnalytics™, PureApplication®, pureCluster™, PureCoverage®, PureData®, PureExperience®, PureFlex®, pureQuery®, pureScale®, PureSystems®, QRadar®, Rational®, Rhapsody®, SoDA, SPSS, StoredIQ, Tivoli®, Trusteer®, urban{code}®, Watson, WebSphere®, Worklight®, X-Force® and System z® Z/OS, are trademarks of International Business Machines Corporation, registered in many jurisdictions worldwide. Other product and service names might be trademarks of IBM or other companies. A current list of IBM trademarks is available on the Web at "Copyright and trademark information" at: www.ibm.com/legal/copytrade.shtml.
  • 32. Thank You Your Feedback is Important! Access the InterConnect 2015 Conference CONNECT Attendee Portal to complete your session surveys from your smartphone, laptop or conference kiosk.