Posts tagged asynchronous
ADF Faces: Handle task in background process and show real time progress indicator for asynchronous job using Server Push in ADF6
Recently I received an email from Peru. An ADF developer from Peru was facing a challenge with ADF. In short: ‘the upload of a (large) file should be followed by a potentially long running job. Ideally, the browser would not freeze while the uploaded file is processed and on top of that it would be great to report the progress of the job to the user’.
I like this kind of challenge, especially since I consider both asynchronous processing and server push two of my areas of interest. So I took on the challenge and tried a quickly put together an application that demonstrates this behavior.
This article discusses how I used standard Java concurrency functionality to take the job off line (in a scheduled, background job) and how I leveraged Active Data Service in ADF Faces to have the background job report its progress through an active bean and server push to the browser.
After the user kicks off the job by pushing a button:
the user will be in control again (synchronous but background parrtial request completes) and and will also be informed on the job’s progress through the server push:
In this example, the job progress in steps of 10% that take between 2 and 4 seconds. As soon More >
In this article, we will continue a discussion on asynchronous processing started in a previous article that introduced asynchronous and parallel processing Java using Executors, Futures, Callable Objects and the underlying thread model in Java 5 and 6.
While a stand alone Java application – without UI – is a rare thing in my world, a Java Web application certainly is not. And performance, especially perceived performance, is pretty important in that world. The first page load is the most important measure I suppose for what the user feels is the performance of the web application. The fact that after the initial load, additional elements can be loaded into the page – asynchronously – is fine. The intial page load and the browser’s indication that the load is done (and the hourglass disappears) is what is most important for the happiness of the user.
We will see three stages in this article, of a very simple web page. It is a JSF (JavaServer Faces) page, that contains some very simple elements of which one displays an ‘expensive’ value – a value that takes some time to get hold of. Maybe because a database query is involved or web service is called. Whatever the cause, this one More >
Processors are not going to get much faster. No higher clockspeeds are foreseen. The speed of processing will be further increasing through parallellization, engaging multiple CPU cores for handling all tasks rather than a single faster core.
This is but one reason for taking a closer look at the threading model in Java and the way we can do asynchronous and parallel processing as of Java 5. Another reason for my interest in asynchronous processing has to do with (perceived) performance. If an application performs a task on behalf of a user, it may block until the task is completed. The user cannot do anything until the task completes – watching the hourglass or whatever busy cursor is used. With asynchronous processing, a task which the user does not immediately require the results from can be processed in a separate thread. The perception of the user therefore is that the task is performed (or at least processed) much faster than in the synchronous case. And even though it is only perception – perception is usually all that counts!
Furthermore, if the task can be broken in smaller pieces that can be executed in parallel, we really can speed up the task – provided More >
JSF 2.0 and Servlet 3.0 Specifications – (almost) ready for take-off – What is new and exciting in Servlet 3.0?
2009 will be the year of JEE 6. Important specifications in the JEE 6 platform are Servlet and JavaServer Faces. JEE 6 will contain the Servlet 3.0 specification as well as the JSF 2.0 specification. Both are developed in the JCP. JSF 2.0 as JSR-314 (see: jcp.org/en/jsr/detail) led by Ed Burns (Sun) and Roger Kitain (Sun) with participation from almost every vendor in the Java Web Application space. Servlet 3.0 is JSR-315 headed by Rajiv Mordani (Sun); more detail on the JCP Site for Servlet 3.0.
During his presentation at Devoxx 2008, Martin Marinschek shed a lot of light on the most important features currently being specified in JSR-314 and JSF-315 for Servlet 3.0 and JSF 2.0. A few of the highlights in the Servlet 3.0 spec are discussed in this article; another article will go into JSF 2.0 details.