org.omnidial.harvest.ThreadedDialCandidateHarvester Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of omnidial-core Show documentation
Show all versions of omnidial-core Show documentation
Classes for finding routes to dial somebody
The newest version!
package org.omnidial.harvest;
import java.util.ArrayList;
public abstract class ThreadedDialCandidateHarvester extends DialCandidateHarvester implements Runnable {
ArrayList threads = new ArrayList();
@Override
public void getCandidatesForNumber(String dialedNumber,
String e164Number) {
createThreads(dialedNumber, e164Number);
new Thread(this).start();
}
@Override
public void run() {
for(Thread t : threads) {
while(t.isAlive()) {
try {
t.join();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
onHarvestCompletion();
}
protected void addThread(Thread t) {
threads.add(t);
}
protected abstract void createThreads(String dialedNumber,
String e164Number);
}