agave-systems/systems-core/src/main/java/org/iplantc/service/transfer/URLCopy.java
/**
     * This performs third party transfer only if source and destination urls
     * have a matching protocol that support third party transfers.
     */
This performs third party transfer only if source and destination urls
have a matching protocol that support third party transfers.
This performs third party transfer only if source and destination urls have a matching protocol that support third party transfers .
protected void dothirdPartyTransfer(String srcPath, String destPath, RemoteTransferListener listener) throws RemoteDataException, IOException {
        try {
            log.debug(String.format(
                    "Beginning third party transfer for task %s. %s to %s . Protocol: %s => %s",
                    listener.getTransferTask().getUuid(),
                    listener.getTransferTask().getSource(),
                    listener.getTransferTask().getDest(),
                    getProtocolForClass(sourceClient.getClass()),
                    getProtocolForClass(destClient.getClass())));
            ((GridFTP) destClient).setProtectionBufferSize(16384);
            ((GridFTP) destClient).setType(GridFTPSession.TYPE_IMAGE);
            ((GridFTP) destClient).setMode(GridFTPSession.MODE_EBLOCK);
            ((GridFTP) destClient).setTCPBufferSize(destClient.getMaxBufferSize());
            ((GridFTP) sourceClient).setProtectionBufferSize(16384);
            ((GridFTP) sourceClient).setType(GridFTPSession.TYPE_IMAGE);
            ((GridFTP) sourceClient).setMode(GridFTPSession.MODE_EBLOCK);
            ((GridFTP) sourceClient).setTCPBufferSize(sourceClient.getMaxBufferSize());
            ((GridFTP) sourceClient).setStripedActive(((GridFTP) destClient).setStripedPassive());
	            task.setBytesTransferred(0);
	            task.setAttempts(task.getAttempts() + 1);
	            task.setStatus(TransferStatusType.TRANSFERRING);
	            task.setStartTime(new Date());
	            TransferTaskDao.persist(task);
	        }
            if (sourceClient.getHost().equals(destClient.getHost())) {
                ((GridFTP) sourceClient).extendedTransfer(srcPath,
                        (GridFTP) destClient,
                        destClient.resolvePath(destPath),
                        listener);
            } else {
                ((GridFTP) sourceClient).extendedTransfer(srcPath,
                        (GridFTP) destClient,
                        destClient.resolvePath(destPath),
                        listener);
            }
            log.debug(String.format(
                    "Completed third party transfer for task %s. %s to %s . Protocol: %s => %s",
                    listener.getTransferTask().getUuid(),
                    listener.getTransferTask().getSource(),
                    listener.getTransferTask().getDest(),
                    getProtocolForClass(sourceClient.getClass()),
                    getProtocolForClass(destClient.getClass())));
        } catch (ClosedByInterruptException e) {
            log.debug(String.format(
                    "Aborted third party transfer for task %s. %s to %s . Protocol: %s => %s",
                    listener.getTransferTask().getUuid(),
                    listener.getTransferTask().getSource(),
                    listener.getTransferTask().getDest(),
                    getProtocolForClass(sourceClient.getClass()),
                    getProtocolForClass(destClient.getClass())));
            log.info("Transfer task " + listener.getTransferTask().getUuid() + " killed by worker shutdown.");
            setKilled(true);
            try {
                ((GridFTP) sourceClient).abort();
            } catch (Exception ignored) {
            }
            try {
                ((GridFTP) destClient).abort();
            } catch (Exception ignored) {
            }
            Thread.currentThread().interrupt();
            throw e;
        } catch (IOException e) {
            log.debug(String.format(
                    "Failed third party transfer for task %s. %s to %s . Protocol: %s => %s",
                    listener.getTransferTask().getUuid(),
                    listener.getTransferTask().getSource(),
                    listener.getTransferTask().getDest(),
                    getProtocolForClass(sourceClient.getClass()),
                    getProtocolForClass(destClient.getClass())));
             transfer failed due to connectivity issue
            listener.failed();
            throw e;
        } catch (Throwable e) {
            log.debug(String.format(
                    "Failed third party transfer for task %s. %s to %s . Protocol: %s => %s",
                    listener.getTransferTask().getUuid(),
                    listener.getTransferTask().getSource(),
                    listener.getTransferTask().getDest(),
                    getProtocolForClass(sourceClient.getClass()),
                    getProtocolForClass(destClient.getClass())));
             stuff happens, what are you going to do.
            listener.failed();
            throw new RemoteDataException("Transfer task " + listener.getTransferTask().getUuid()
                    + " failed.", e);
        } finally {
            if (listener != null && listener.getTransferTask() != null) {
                log.info(String.format(
                        "Total of %s bytes transferred in task %s . Protocol %s => %s",
                        listener.getTransferTask().getBytesTransferred(),
                        listener.getTransferTask().getUuid(),
                        getProtocolForClass(sourceClient.getClass()),
                        getProtocolForClass(destClient.getClass())));
            }
        }
    }
protected void dothirdPartyTransfer ( String srcPath , String destPath , RemoteTransferListener listener ) throws RemoteDataException , IOException { try { log . debug ( String . format ( "Beginning third party transfer for task %s. %s to %s . Protocol: %s => %s" , listener . getTransferTask ( ) . getUuid ( ) , listener . getTransferTask ( ) . getSource ( ) , listener . getTransferTask ( ) . getDest ( ) , getProtocolForClass ( sourceClient . getClass ( ) ) , getProtocolForClass ( destClient . getClass ( ) ) ) ) ; ( ( GridFTP ) destClient ) . setProtectionBufferSize ( 16384 ) ; ( ( GridFTP ) destClient ) . setType ( GridFTPSession . TYPE_IMAGE ) ; ( ( GridFTP ) destClient ) . setMode ( GridFTPSession . MODE_EBLOCK ) ; ( ( GridFTP ) destClient ) . setTCPBufferSize ( destClient . getMaxBufferSize ( ) ) ; ( ( GridFTP ) sourceClient ) . setProtectionBufferSize ( 16384 ) ; ( ( GridFTP ) sourceClient ) . setType ( GridFTPSession . TYPE_IMAGE ) ; ( ( GridFTP ) sourceClient ) . setMode ( GridFTPSession . MODE_EBLOCK ) ; ( ( GridFTP ) sourceClient ) . setTCPBufferSize ( sourceClient . getMaxBufferSize ( ) ) ; ( ( GridFTP ) sourceClient ) . setStripedActive ( ( ( GridFTP ) destClient ) . setStripedPassive ( ) ) ; if ( sourceClient . getHost ( ) . equals ( destClient . getHost ( ) ) ) { ( ( GridFTP ) sourceClient ) . extendedTransfer ( srcPath , ( GridFTP ) destClient , destClient . resolvePath ( destPath ) , listener ) ; } else { ( ( GridFTP ) sourceClient ) . extendedTransfer ( srcPath , ( GridFTP ) destClient , destClient . resolvePath ( destPath ) , listener ) ; } log . debug ( String . format ( "Completed third party transfer for task %s. %s to %s . Protocol: %s => %s" , listener . getTransferTask ( ) . getUuid ( ) , listener . getTransferTask ( ) . getSource ( ) , listener . getTransferTask ( ) . getDest ( ) , getProtocolForClass ( sourceClient . getClass ( ) ) , getProtocolForClass ( destClient . getClass ( ) ) ) ) ; } catch ( ClosedByInterruptException e ) { log . debug ( String . format ( "Aborted third party transfer for task %s. %s to %s . Protocol: %s => %s" , listener . getTransferTask ( ) . getUuid ( ) , listener . getTransferTask ( ) . getSource ( ) , listener . getTransferTask ( ) . getDest ( ) , getProtocolForClass ( sourceClient . getClass ( ) ) , getProtocolForClass ( destClient . getClass ( ) ) ) ) ; log . info ( "Transfer task " + listener . getTransferTask ( ) . getUuid ( ) + " killed by worker shutdown." ) ; setKilled ( true ) ; try { ( ( GridFTP ) sourceClient ) . abort ( ) ; } catch ( Exception ignored ) { } try { ( ( GridFTP ) destClient ) . abort ( ) ; } catch ( Exception ignored ) { } Thread . currentThread ( ) . interrupt ( ) ; throw e ; } catch ( IOException e ) { log . debug ( String . format ( "Failed third party transfer for task %s. %s to %s . Protocol: %s => %s" , listener . getTransferTask ( ) . getUuid ( ) , listener . getTransferTask ( ) . getSource ( ) , listener . getTransferTask ( ) . getDest ( ) , getProtocolForClass ( sourceClient . getClass ( ) ) , getProtocolForClass ( destClient . getClass ( ) ) ) ) ; listener . failed ( ) ; throw e ; } catch ( Throwable e ) { log . debug ( String . format ( "Failed third party transfer for task %s. %s to %s . Protocol: %s => %s" , listener . getTransferTask ( ) . getUuid ( ) , listener . getTransferTask ( ) . getSource ( ) , listener . getTransferTask ( ) . getDest ( ) , getProtocolForClass ( sourceClient . getClass ( ) ) , getProtocolForClass ( destClient . getClass ( ) ) ) ) ; listener . failed ( ) ; throw new RemoteDataException ( "Transfer task " + listener . getTransferTask ( ) . getUuid ( ) + " failed." , e ) ; } finally { if ( listener != null && listener . getTransferTask ( ) != null ) { log . info ( String . format ( "Total of %s bytes transferred in task %s . Protocol %s => %s" , listener . getTransferTask ( ) . getBytesTransferred ( ) , listener . getTransferTask ( ) . getUuid ( ) , getProtocolForClass ( sourceClient . getClass ( ) ) , getProtocolForClass ( destClient . getClass ( ) ) ) ) ; } } }
This performs third party transfer only if source and destination urls
 have a matching protocol that support third party transfers.
This performs third party transfer only if source and destination urls have a matching protocol that support third party transfers .
//	        log.info("Enabling striped transfer."); //	        if (task != null) //	        { //	            try { //	          	   task.setTotalSize(sourceClient.length(srcPath)); //	            } catch (Exception e) {} // //	            task.setBytesTransferred(0); //	            task.setAttempts(task.getAttempts() + 1); //	            task.setStatus(TransferStatusType.TRANSFERRING); //	            task.setStartTime(new Date()); //	            TransferTaskDao.persist(task); //	        } // transfer failed due to connectivity issue // stuff happens, what are you going to do.