Question: I'm trying to get a jQuery accordion/tab Shortcode to look like this

```
[accordions]
[accordion title="Accordion 1"]Accordion 1 Content[/accordion]
[accordion title="Accordion 2"]Accordion 2 Content[/accordion]
[accordion title="Accordion 3"]Accordion 3 Content[/accordion]
[/accordions]

```

I've tried many ways but I just cant seem to get it to work

How can this be done?

Answer: 
It seems to me that your problem is not with multi-threading, but with inputting something in a GUI from the application fetching the URLs from the database.

Why don't you simply reuse the class (or some of the code, if it's impossible to reuse the classes as is) of your GUI application (i.e. the URL indexing method) inside the application which fetches the URLs from the database.

My guess is that you could very well index these 15 URLs one after the other, in a single thread. I would try doing that before trying to use threads.

The program would look like this:

1. Fetch the 15 URLs from the database and put them into a List
2. Iterate through the list and index each URL
3. Sleep for some time,
4. Go to 1

EDIT:

Since it seems the URLs must be indexed again and again until the list of URLs changes, I would use this algorithm:

1. Create a thread pool using `Executors.newCachedThreadPool()`
2. Get the URLs from the database
3. For each URL, create a task which will index the URL again and again, until interrupted (check that `Thread.interrupted()` returns false at each iteration)
4. submit each task to the executorService created at step 1, and keep the returned `Future` inside a list
5. Sleep/wait until the list of URLs to index changes
6. Cancel each `Future` (`cancel(true)`) of the list of `Future` instances
7. Go to step 2.
[`SwingWorker`](http://download.oracle.com/javase/6/docs/api/javax/swing/SwingWorker.html), shown [here](https://stackoverflow.com/questions/4637215/can-a-progress-bar-be-used-in-a-class-outside-main/4637725#4637725), is a good choice.