Reputation: 1444
i have to copy a large file via FTP. For faster upload i have split the file into 10 parts and I'm trying to upload the splits using the target of ant.However i found that all the splits are queued and are not uploaded parallelly. Does ant have any option to initiate parallel uploads ? For.eg in Filezilla you can have set the max parallel upload limit to 10, which starts all the uploads parallelly ?
Upvotes: 0
Views: 465
Reputation: 1517
Try wrapping your tasks in the <parallel>
task. When your build file looks similar to
<ftp ...transfer split1 />
<ftp ...transfer split2/>
...
<ftp ...transfer split10/>
just put these targets in a parallel
element:
<parallel>
<ftp ...transfer split1 />
<ftp ...transfer split2/>
...
<ftp ...transfer split10/>
</parallel>
In case you may want to limit the number of parallel tasks (i.e. file transfers) you can set the threadCount
property, e. g.
<parallel threadCount="4">
lets a maximum of 4 threads run in parallel.
If you need to handle several tasks after each other, e.g. transfering a file and then logging that the file was transferred, you can cluster those tasks in a <sequential>
task:
<parallel>
<sequential>
<ftp ...transfer split1 />
<echo>transferred file 1</echo>
</sequential>
<sequential>
<ftp ...transfer split2/>
echo>transferred file 2</echo>
...
</parallel>
Upvotes: 1