@@ -52,12 +52,14 @@ public class S3DownloadStep extends AbstractS3Step {
5252 private final String bucket ;
5353 private String path = "" ;
5454 private boolean force = false ;
55+ private boolean disableParallelDownloads = false ;
5556
5657 @ DataBoundConstructor
57- public S3DownloadStep (String file , String bucket , boolean pathStyleAccessEnabled , boolean payloadSigningEnabled ) {
58+ public S3DownloadStep (String file , String bucket , boolean pathStyleAccessEnabled , boolean payloadSigningEnabled , boolean disableParallelDownloads ) {
5859 super (pathStyleAccessEnabled , payloadSigningEnabled );
5960 this .file = file ;
6061 this .bucket = bucket ;
62+ this .disableParallelDownloads = disableParallelDownloads ;
6163 }
6264
6365 public String getFile () {
@@ -76,6 +78,10 @@ public boolean isForce() {
7678 return this .force ;
7779 }
7880
81+ public boolean isDisableParallelDownloads () {
82+ return this .disableParallelDownloads ;
83+ }
84+
7985 @ DataBoundSetter
8086 public void setForce (boolean force ) {
8187 this .force = force ;
@@ -86,6 +92,11 @@ public void setPath(String path) {
8692 this .path = path ;
8793 }
8894
95+ @ DataBoundSetter
96+ public void setDisableParallelDownload (boolean disableParallelDownloads ) {
97+ this .disableParallelDownloads = disableParallelDownloads ;
98+ }
99+
89100 @ Override
90101 public StepExecution start (StepContext context ) throws Exception {
91102 return new S3DownloadStep .Execution (this , context );
@@ -130,6 +141,7 @@ public Void run() throws Exception {
130141 final String bucket = this .step .getBucket ();
131142 final String path = this .step .getPath ();
132143 final boolean force = this .step .isForce ();
144+ final boolean disableParallelDownloads = this .step .isDisableParallelDownloads ();
133145
134146 Preconditions .checkArgument (bucket != null && !bucket .isEmpty (), "Bucket must not be null or empty" );
135147
@@ -146,7 +158,7 @@ public Void run() throws Exception {
146158 throw new RuntimeException ("Target exists: " + target .toURI ().toString ());
147159 }
148160 }
149- target .act (new RemoteDownloader (Execution .this .step .createS3ClientOptions (), envVars , listener , bucket , path ));
161+ target .act (new RemoteDownloader (Execution .this .step .createS3ClientOptions (), envVars , listener , bucket , path , disableParallelDownloads ));
150162 listener .getLogger ().println ("Download complete" );
151163 return null ;
152164 }
@@ -162,19 +174,22 @@ private static class RemoteDownloader extends MasterToSlaveFileCallable<Void> {
162174 private final TaskListener taskListener ;
163175 private final String bucket ;
164176 private final String path ;
177+ private final Boolean disableParallelDownloads ;
165178
166- RemoteDownloader (S3ClientOptions amazonS3ClientOptions , EnvVars envVars , TaskListener taskListener , String bucket , String path ) {
179+ RemoteDownloader (S3ClientOptions amazonS3ClientOptions , EnvVars envVars , TaskListener taskListener , String bucket , String path , Boolean disableParallelDownloads ) {
167180 this .amazonS3ClientOptions = amazonS3ClientOptions ;
168181 this .envVars = envVars ;
169182 this .taskListener = taskListener ;
170183 this .bucket = bucket ;
171184 this .path = path ;
185+ this .disableParallelDownloads = disableParallelDownloads ;
172186 }
173187
174188 @ Override
175189 public Void invoke (File localFile , VirtualChannel channel ) throws IOException , InterruptedException {
176190 TransferManager mgr = TransferManagerBuilder .standard ()
177191 .withS3Client (AWSClientFactory .create (this .amazonS3ClientOptions .createAmazonS3ClientBuilder (), this .envVars ))
192+ .withDisableParallelDownloads (this .disableParallelDownloads )
178193 .build ();
179194
180195 if (this .path == null || this .path .isEmpty () || this .path .endsWith ("/" )) {
0 commit comments