Revision 9594
Added by Jing Tao over 8 years ago
src/edu/ucsb/nceas/metacat/replication/ReplicationService.java | ||
---|---|---|
73 | 73 |
import org.apache.log4j.Logger; |
74 | 74 |
import org.dataone.client.auth.CertificateManager; |
75 | 75 |
import org.dataone.client.rest.RestClient; |
76 |
import org.dataone.client.types.AutoCloseHttpClientInputStream; |
|
76 | 77 |
import org.dataone.client.utils.HttpUtils; |
77 | 78 |
import org.dataone.service.types.v1.Identifier; |
78 | 79 |
import org.dataone.service.types.v2.SystemMetadata; |
... | ... | |
2332 | 2333 |
if (entity == null) { |
2333 | 2334 |
throw new ClientProtocolException("ReplicationService.getURLStream - Response contains no content"); |
2334 | 2335 |
} |
2335 |
input = entity.getContent();
|
|
2336 |
input = new AutoCloseHttpClientInputStream(entity.getContent(), client.getHttpClient());
|
|
2336 | 2337 |
} |
2337 | 2338 |
catch (Throwable t) { |
2338 | 2339 |
logReplication.error("Unexpected Throwable encountered. Logging and moving on: " + |
Also available in: Unified diff
Use the new AutoCloseInputStream wrapper for replication. It will close but http client and input stream when the inputStream.close method is called.