// thread 1
new Thread(new Runnable() {
public void run() {
try {
// do something in sync
CoordinatorManager.getCoordinator().getSyncer().doInSync(ores, new SyncerExecutor(){
public void execute() {
System.out.println("Thread-1: execute doInSync 1");
}
});//end syncerCallback
// sleep
sleep(10000);
// do again do something in sync
CoordinatorManager.getCoordinator().getSyncer().doInSync(ores, new SyncerExecutor(){
public void execute() {
System.out.println("Thread-1: execute doInSync 2");
}
});//end syncerCallback
System.out.println("Thread-1: finished");
statusList.add(Boolean.TRUE);
} catch (Exception e) {
exceptionHolder.add(e);
} finally {
try {
DBFactory.getInstance().closeSession();
} catch (Exception e) {
// ignore
};
}
}}).start();
// thread 2
new Thread(new Runnable() {
public void run() {
try {
// sleep
sleep(5000);
// do something in sync
CoordinatorManager.getCoordinator().getSyncer().doInSync(ores, new SyncerExecutor(){
public void execute() {
System.out.println("Thread-2: execute doInSync 1");
}
});//end syncerCallback
// sleep
sleep(10000);
// do again do something in sync
CoordinatorManager.getCoordinator().getSyncer().doInSync(ores, new SyncerExecutor(){
public void execute() {
System.out.println("Thread-2: execute doInSync 2");
}
});//end syncerCallback
System.out.println("Thread-2: finished");