08-05-2009 11:27 AM
NodeRef nodeOnDisk = nodeService.getChildByName(parentDirectoy,
ContentModel.ASSOC_CONTAINS, nameDirectory);
if (nodeOnDisk != null) {
…
} else {
FileInfo fileInfo = fileFolderService.create(parentDirectoy,
nameDirectory, ContentModel.TYPE_FOLDER);
All work good if I start action with one file. But if I try to use this action in parallel (send two 2 files to start, which will created the same directory). The nodeService say (for the 2 actions) that the directory (nameDirectory) doesn't exist, but after the fileFolderService generate a error because the directory exist. When a action is running, all of the other wait (I use the synchronisation with lock) :
boolean resultCreateDirectory = transactionService
.getRetryingTransactionHelper()
.doInTransaction(
new RetryingTransactionHelper.RetryingTransactionCallback<Boolean>() {
public Boolean execute()
throws Throwable {
CREATE OF DIRECTORY
}
});
}
08-05-2009 11:52 AM
08-06-2009 02:43 AM
08-06-2009 04:00 AM
08-06-2009 05:34 AM
Boolean result = transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback<Boolean>(){
public Boolean execute() throws Throwable {
boolean success= methodAddFiles(var);
if (!success){
// Retry and rollback if always problem
throw new IllegalStateException("Problem during adding files");
}
return true;
}
});
And after one modification :
Boolean result = transactionService.getRetryingTransactionHelper().doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback<Boolean>(){
public Boolean execute() throws Throwable {
boolean success= methodAddFiles(var);
if (!success){
// Retry and rollback if always problem
throw new IllegalStateException("Problem during adding files");
}
return true;
}
//LOOK HERE
}, false, true);
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.