/** * Gets a transfer manager with the specified parameters including proxy host, proxy port, S3 access key, S3 secret key, and max threads. * * @param params the parameters. * * @return a newly created transfer manager. */ private TransferManager getTransferManager(final S3FileTransferRequestParamsDto params) { // We are returning a new transfer manager each time it is called. Although the Javadocs of TransferManager say to share a single instance // if possible, this could potentially be a problem if TransferManager.shutdown(true) is called and underlying resources are not present when needed // for subsequent transfers. if (params.getMaxThreads() == null) { // Create a transfer manager that will internally use an appropriate number of threads. return new TransferManager(getAmazonS3(params)); } else { // Create a transfer manager with our own executor configured with the specified total threads. LOGGER.info("Creating a transfer manager. fixedThreadPoolSize={}", params.getMaxThreads()); return new TransferManager(getAmazonS3(params), Executors.newFixedThreadPool(params.getMaxThreads())); } }
/** * Gets a transfer manager with the specified parameters including proxy host, proxy port, S3 access key, S3 secret key, and max threads. * * @param params the parameters. * * @return a newly created transfer manager. */ private TransferManager getTransferManager(final S3FileTransferRequestParamsDto params) { // We are returning a new transfer manager each time it is called. Although the Javadocs of TransferManager say to share a single instance // if possible, this could potentially be a problem if TransferManager.shutdown(true) is called and underlying resources are not present when needed // for subsequent transfers. if (params.getMaxThreads() == null) { // Create a transfer manager that will internally use an appropriate number of threads. return new TransferManager(getAmazonS3(params)); } else { // Create a transfer manager with our own executor configured with the specified total threads. LOGGER.info("Creating a transfer manager. fixedThreadPoolSize={}", params.getMaxThreads()); return new TransferManager(getAmazonS3(params), Executors.newFixedThreadPool(params.getMaxThreads())); } }
s3FileTransferRequestParamsDto.setMaxThreads(adjustIntegerValue(s3FileTransferRequestParamsDto.getMaxThreads(), MIN_THREADS, MAX_THREADS));
params.setMaxThreads(adjustIntegerValue(params.getMaxThreads(), MIN_THREADS, MAX_THREADS));
theMaxThreads = this.getMaxThreads(); strategy.appendField(locator, this, "maxThreads", buffer, theMaxThreads, (this.maxThreads!= null));
lhsMaxThreads = this.getMaxThreads(); Integer rhsMaxThreads; rhsMaxThreads = that.getMaxThreads(); if (!strategy.equals(LocatorUtils.property(thisLocator, "maxThreads", lhsMaxThreads), LocatorUtils.property(thatLocator, "maxThreads", rhsMaxThreads), lhsMaxThreads, rhsMaxThreads, (this.maxThreads!= null), (that.maxThreads!= null))) { return false;
theMaxThreads = this.getMaxThreads(); currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "maxThreads", theMaxThreads), currentHashCode, theMaxThreads, (this.maxThreads!= null));
if (maxThreadsShouldBeCopiedAndSet == Boolean.TRUE) { Integer sourceMaxThreads; sourceMaxThreads = this.getMaxThreads(); Integer copyMaxThreads = ((Integer) strategy.copy(LocatorUtils.property(locator, "maxThreads", sourceMaxThreads), sourceMaxThreads, (this.maxThreads!= null))); copy.setMaxThreads(copyMaxThreads);