Hi Vaadiners,
I am developing a portlet to manage the s3 files. When i try to copy or move large folders(1GB to 5GB) in the s3 cloud,I am getting Out of sync error.
Runnig a background thread to update the UI but it is not updating the UI after each file copied.
How to get possible reasons for this error
How to get rid of from this error.
My code:
ListObjectsRequest listObjectsRequest = new ListObjectsRequest()
.withBucketName(bucketName)
.withPrefix(folder);
ObjectListing objectListing = s3.listObjects(listObjectsRequest);
for (S3ObjectSummary objectSummary : objectListing.getObjectSummaries()) {
String fileName = objectSummary.getKey().substring(reqFolder.length());
TransferManager transfer = new TransferManager(s3);
CopyObjectRequest copyRequest = new CopyObjectRequest(bucketName, objectSummery.getKey(), bucketName, parentDir + fileName);
final Copy copy = transfer.copy(copyRequest);
final Application application = this.getMainWindow().getApplication();
new Thread(){
@Override
public void run(){
try{
copy.waitForCompletion();
synchronized(application) {
//adding completed file to table
table.addItem(new Object[]{new Label(fileName),"Queue"},objectSummary);
}
}catch(Exception e){
}
}
}.start();
}
Liferay 6.1
Vaadin 6.8