public void onPartCreate(PartCreationEvent event) {
        final File part = event.getPart();
        final UploadPartRequest reqUploadPart =
            newUploadPartRequest(event, part);
        final OnFileDelete fileDeleteObserver = event.getFileDeleteObserver();
        appendUserAgent(reqUploadPart, AmazonS3EncryptionClient.USER_AGENT);
        futures.add(es.submit(new Callable<UploadPartResult>() {
            @Override public UploadPartResult call() {
                // Upload the ciphertext directly via the non-encrypting
                // s3 client
                try {
                    return uploadPart(reqUploadPart);
                } finally {
                    // clean up part already uploaded 
                    if (!part.delete()) {
                        LogFactory.getLog(getClass()).debug(
                                "Ignoring failure to delete file " + part
                                        + " which has already been uploaded");
                    } else {
                        if (fileDeleteObserver != null)
                            fileDeleteObserver.onFileDelete(null);
                    }
                }
            }
        }));
    }
public void onPartCreate ( PartCreationEvent event ) { final File part = event . getPart ( ) ; final UploadPartRequest reqUploadPart = newUploadPartRequest ( event , part ) ; final OnFileDelete fileDeleteObserver = event . getFileDeleteObserver ( ) ; appendUserAgent ( reqUploadPart , AmazonS3EncryptionClient . USER_AGENT ) ; futures . add ( es . submit ( new Callable < UploadPartResult > ( ) { @ Override public UploadPartResult call ( ) { try { return uploadPart ( reqUploadPart ) ; } finally { if ( ! part . delete ( ) ) { LogFactory . getLog ( getClass ( ) ) . debug ( "Ignoring failure to delete file " + part + " which has already been uploaded" ) ; } else { if ( fileDeleteObserver != null ) fileDeleteObserver . onFileDelete ( null ) ; } } } } ) ) ; }
Notified from {@link MultiFileOutputStream#fos()} when a part ready for
upload has been successfully created on disk. By default, this method
performs the following:
<ol>
<li>calls {@link #newUploadPartRequest(PartCreationEvent, File)} to
create an upload-part request for the newly created ciphertext file</li>
<li>call {@link #appendUserAgent(AmazonWebServiceRequest, String)} to
append the necessary user agent string to the request</li>
<li>and finally submit a concurrent task, which calls the method
{@link #uploadPart(UploadPartRequest)}, to be performed</li>
</ol>
<p>
To enable parallel uploads, implementation of this method should never
block.

@param event
to represent the completion of a ciphertext file creation
which is ready for multipart upload to S3.