Search code examples
asynchronousjava1.4

Async call using java 1.4


i'm trying to find an easy way to execute an async call using the 1.4 java framework.

It's a very easy example... Run the async method, continue executing actions on main thread an when the async method ends raise an event to get the results.

I'll appreciate any example, thanks!


Solution

  • If you were using Java 5+, you'd use the Executor framework. You're using Java 1.4, though, so you can't....

    ..... but, the Java5 executor framework is actually based upon a pre-existing concurrency library, and since then the Java5 version has been back-ported to Java 1.4 (backport-util-concurrent).

    Check out the java.util.concurrent package in Java5 to see how this works (specifically, the Executors class).