public boolean isSuccess() {
return !canceled && success;
}
public void start() {
WaitLock waitLock = waitService.startWait();
try {
Future<ServerFileFolder[]> downloader = executor.submit(new XsdDownloader());
currentJob = downloader;
ServerFileFolder[] serverFolders = downloader.get();
currentJob = null;
if (serverFolders != null && !canceled) {
boolean fileIsAlreadyOnServer = doesFileAlreadyExistOnServer(serverFolders);
if (!fileIsAlreadyOnServer) {
checkNameConflict(serverFolders);
}
if (!canceled) {
File file = writeToFileStore();
if (fileIsAlreadyOnServer) {
success = true;
} else {
Future<Boolean> uploader = executor.submit(new XsdUploader(serverFolders[0], file));
success = uploader.get();
currentJob = null;
}
}
}
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
} catch (ExecutionException e) {
// TODO: Report me.
e.printStackTrace();
} catch (IOException e) {
// TODO: Report me.
e.printStackTrace();
} catch (FileStoreException e) {
// TODO: Report me.
e.printStackTrace();
} finally {
waitLock.release();
latch.countDown();
}
}