Threading ⇢ Concurrency and multithreading
This article is a deep dive into Android Services. Learn all about started
services, bound services, and bound and started services. With source code examples
and a sample app.
Android applications run in a native Linux process, in the underlying Linux
OS. This process houses activities (screens), widgets, and services (non visual
long running application parts). When working with Android apps, it is important
to remember to keep long running code running in threads that are not tied to the
main thread or event dispatch thread, in order to get an “application not responding”
error. A common mistake that is made is long running tasks are performed in this
EDT/main thread, and this leads to lots of application failures.
I've written 3 tutorials to show you how to create a service enabled Android
application that performs all of it's network I/O in a background thread (not the
UI thread). These tutorials are split into three parts. This tutorial shows you
how to use background threads to perform long running network IO operations, so
that the main UI thread is not locked up.
Using Task API to perform HTTP POST operation in the background, while monitoring
the request and response I/O operation data streams.
More details on the Task API introduced in the first Task API tutorial. SampleApp
from the first tutorial is dissected under a microscope along with the API itself.
Also contains information on which external libraries are optional and which are
Introducing the Task API. Easy to use background task API for Swing. Android
and JavaME implementation coming soon. Easily create tasks and monitor their progress
and cancel them at any time. Easily manage multiple tasks. Create network aware
tasks and recurring tasks, and much much more! The API is open source (Apache 2.0
This tutorial outlines some of the interesting behaviors exhibitied by SwingWorker
when running background tasks are cancelled in flight.
If you've ever want to incorporate web services into your graphical
applications/applets/widgets written in Java, then there are some
threading issues that you have to be mindful of, and design around. This tutorial will guide
you though some of the important threading issues you have to keep in mind when building
such applications. The strategies outlined in this tutorial apply to accessing more than
just web services from Swing apps; it also applies to loading information from databases,
and performing any other kind of time consuming process that has to happen in the desktop
app and interact with it, but can't make the user interface unresponsive.
Introduction to the Java5 Concurrency API. Java 50 introduces the
java.util.concurrency API, which leverages hardware level constructs
to allow Java programs to use lock-free, and wait-free thread-safety
mechanisms, without having to use native code.
This tutorial is devoted to showing you advanced techniques of using threads to
perform event driven tasks, without using polling, and usually with the use of
queues. Along with techniques of managing life cycles of server objects (that are
multithreaded) and runtime activation and deactivation of these objects.
Introduction to multithreading in Java.