Package org.jets3t.service.multithread

Examples of org.jets3t.service.multithread.S3ServiceMulti


            /*
             * Create a S3ServiceMulti object with an event listener that responds to
             * ListObjectsEvent notifications and populates a complete object listing.
             */
            final S3ServiceMulti s3Multi = new S3ServiceMulti(restService, new S3ServiceEventAdaptor() {
                @Override
                public void s3ServiceEventPerformed(ListObjectsEvent event) {
                    if (ListObjectsEvent.EVENT_IN_PROGRESS == event.getEventCode()) {
                        Iterator chunkIter = event.getChunkList().iterator();
                        while (chunkIter.hasNext()) {
                            StorageObjectsChunk chunk = (StorageObjectsChunk) chunkIter.next();

                            System.out.println("Listed " + chunk.getObjects().length
                                + " objects for sub-listing with prefix: '"
                                + chunk.getPrefix() + "'");

                            allObjects.addAll(Arrays.asList(chunk.getObjects()));
                        }
                    } else if (ListObjectsEvent.EVENT_ERROR == event.getEventCode()) {
                        s3ServiceExceptions[0] = new S3ServiceException(
                            "Failed to list all objects in S3 bucket",
                            event.getErrorCause());
                    }
                }
            });

            startTime = System.currentTimeMillis();

            /*
             * Perform a multi-threaded listing, where each common prefix string
             * will be used as the prefix for a separate listing thread.
             */
            (new Thread() {
                @Override
                public void run() {
                    s3Multi.listObjects(bucketName, commonPrefixes, null, 1000);
                };
            }).run();

            long threadedElapsedTime = System.currentTimeMillis() - startTime;
            totalElapsedTime += threadedElapsedTime;
View Full Code Here


                APPLICATION_DESCRIPTION, MAX_CONNECTION_RETRIES, HTTP_CONNECTION_TIMEOUT,
                this);

        // Initialise a non-authenticated service.
        // Revert to anonymous service.
        s3ServiceMulti = new S3ServiceMulti(
                new RestS3Service(null, APPLICATION_DESCRIPTION, this), this);
    }
View Full Code Here

TOP

Related Classes of org.jets3t.service.multithread.S3ServiceMulti

Copyright © 2018 www.massapicom. 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.