If you have a short run job then you can submit it as a job to be executed in the thread pool. All you need to do is create a class that implements Runnable and put your code in the run() method:
Code:
public class MyJob implements Runnable
{
public void run()
{
//put your code here
}
}
If it is a task that is going to last long than a few milliseconds then it is better to create your own thread. This you can read about on google. There should be good examples. You end of creating a class that looks like this:
Code:
class MyThread extends Thread
{
public void run()
{
// put code in here
}
}
to start the thread:
Code:
MyThread myThread = new MyThread();
myThread.setDaemon(true);
myThread.setName("myJob");
myThread.start();
The thread will stop when you exit the run method.
Charlie