@RpcMethod public void transferImage(String imageId,String source,String destination,ServerAddress destinationHost,AsyncMethodCallback<Host.AsyncClient.copy_image_call> handler) throws RpcException {
  ensureClient();
  TransferImageRequest transferImageRequest=new TransferImageRequest();
  transferImageRequest.setDestination_datastore_id(destination);
  transferImageRequest.setDestination_host(destinationHost);
  transferImageRequest.setSource_datastore_id(source);
  transferImageRequest.setSource_image_id(imageId);
  clientProxy.setTimeout(TRANSFER_IMAGE_TIMEOUT_MS);
  logger.info("transfer_image target {}, request {}",getHostIp(),transferImageRequest);
  try {
    clientProxy.transfer_image(transferImageRequest,handler);
  }
 catch (  TException e) {
    throw new RpcException(e.getMessage());
  }
}

@ RpcMethod public void transferImage ( String imageId , String source , String destination , ServerAddress destinationHost , AsyncMethodCallback < Host . AsyncClient . copy_image_call > handler ) throws RpcException { ensureClient ( ) ; TransferImageRequest transferImageRequest = new TransferImageRequest ( ) ; transferImageRequest . setDestination_datastore_id ( destination ) ; transferImageRequest . setDestination_host ( destinationHost ) ; transferImageRequest . setSource_datastore_id ( source ) ; transferImageRequest . setSource_image_id ( imageId ) ; clientProxy . setTimeout ( TRANSFER_IMAGE_TIMEOUT_MS ) ; logger . info ( "transfer_image target {}, request {}" , getHostIp ( ) , transferImageRequest ) ; try { clientProxy . transfer_image ( transferImageRequest , handler ) ; } catch ( TException e ) { throw new RpcException ( e . getMessage ( ) ) ; } }
this method performs an asynchronous thrift call to copy an image from one host to another . on completion , the specified handler is invoked .
