Examples of ThreadedS3Service


Examples of org.jets3t.service.multi.s3.ThreadedS3Service

                new S3Object(threadedMultipartUpload.getObjectKey(), fiveMBTestData),
                new S3Object(threadedMultipartUpload.getObjectKey(), new byte[] {fiveMBTestData[0]}),
            };

            // Create threaded service and perform upload in multiple threads
            ThreadedS3Service threadedS3Service = new ThreadedS3Service(service,
                new S3ServiceEventAdaptor());
            List<MultipartUploadAndParts> uploadAndParts = new ArrayList<MultipartUploadAndParts>();
            uploadAndParts.add(new MultipartUploadAndParts(
                threadedMultipartUpload, Arrays.asList(objectsForThreadedUpload)));
            threadedS3Service.multipartUploadParts(uploadAndParts);

            // Complete threaded multipart upload using automatic part listing and normal service.
            MultipartCompleted threadedMultipartCompleted = service.multipartCompleteUpload(
                threadedMultipartUpload);
View Full Code Here

Examples of org.jets3t.service.multi.s3.ThreadedS3Service

                }
            };

        List<S3Object> partObjects = null;
        try {
            ThreadedS3Service threadedS3Service =
                new ThreadedS3Service(s3Service, eventListener);
            threadedS3Service.addServiceEventListener(
                captureMultipartUploadObjectsEventAdaptor);

            // Build map from object key to storage object
            final Map<String, StorageObject> objectsByKey =
                new HashMap<String, StorageObject>();
            for (StorageObject object: objectsForMultipartUpload) {
                objectsByKey.put(object.getKey(), object);
            }

            // Start all multipart uploads
            threadedS3Service.multipartStartUploads(bucketName, objectsForMultipartUpload);
            throwServiceEventAdaptorErrorIfPresent(eventListener);

            // Build upload and part lists from new multipart uploads, where new
            // MultipartUpload objects were captured by this method's
            // captureMultipartUploadObjectsEventAdaptor)
            for (MultipartUpload upload: multipartUploadList) {
                StorageObject object = objectsByKey.get(upload.getObjectKey());
                if (object.getDataInputFile() == null) {
                    throw new ServiceException();
                }
                partObjects = splitFileIntoObjectsByMaxPartSize(
                    upload.getObjectKey(),
                    object.getDataInputFile());
                uploadAndPartsList.add(
                    new MultipartUploadAndParts(upload, partObjects));
            }

            // Upload all parts for all multipart uploads
            threadedS3Service.multipartUploadParts(uploadAndPartsList);
            throwServiceEventAdaptorErrorIfPresent(eventListener);

            // Complete all multipart uploads
            threadedS3Service.multipartCompleteUploads(multipartUploadList);
            throwServiceEventAdaptorErrorIfPresent(eventListener);
        } catch (Exception e) {
            if (partObjects != null && partObjects.size() > 0) {
                for (S3Object partObject: partObjects) {
                    partObject.closeDataInputStream();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.