System.exit(0);
}
// Create task for adding services to the matchmaker and run queries
AddServicesToMatchmakerTask addServicesTask = new AddServicesToMatchmakerTask();
RunQueriesTask runQueriesTask = new RunQueriesTask();
System.out.println(runQueriesTask.getLengthOfTask() + " queries and " + addServicesTask.getLengthOfTask() + " services loaded");
// Start the first task that runs in a SwingThread
System.out.print("The AddServicesToMatchmakerTask is starting ..");
addServicesTask.go();
System.out.println(addServicesTask.getMessage());
// Wait till the task is done
boolean wait = true;
while(wait){
try{
Thread.sleep(500);
} catch(InterruptedException e){
System.err.println(e.getMessage());
e.printStackTrace();
}
System.out.println(addServicesTask.getMessage());
if(addServicesTask.isDone()){
// Stop the thread
addServicesTask.stop();
System.out.println(". done :)");
wait = false;
}
}
// Now the queries can be started
System.out.print("The RunQueriesTask is starting ..");
runQueriesTask.go();
System.out.println(runQueriesTask.getMessage());
// Wait till the task is done
wait=true;
while(wait){
try{
Thread.sleep(500);
} catch(InterruptedException e){
System.err.println(e.getMessage());
e.printStackTrace();
}
System.out.println(runQueriesTask.getMessage());
if(runQueriesTask.isDone()){
// Stop the thread
runQueriesTask.stop();
System.out.println(". done :)");
wait = false;
}
}
}