Revision 9156
Added by rnahf about 9 years ago
ReplicationHandler.java | ||
---|---|---|
43 | 43 |
import java.util.TimerTask; |
44 | 44 |
import java.util.Vector; |
45 | 45 |
|
46 |
import org.apache.commons.io.IOUtils; |
|
46 | 47 |
import org.apache.log4j.Logger; |
47 | 48 |
import org.dataone.service.types.v2.SystemMetadata; |
48 | 49 |
import org.dataone.service.util.DateTimeMarshaller; |
... | ... | |
259 | 260 |
"because "+ e.getMessage()); |
260 | 261 |
continue; |
261 | 262 |
} |
263 |
finally |
|
264 |
{ |
|
265 |
IOUtils.closeQuietly(responses.elementAt(i)); |
|
266 |
} |
|
262 | 267 |
//v is the list of updated documents |
263 | 268 |
Vector<Vector<String>> updateList = new Vector<Vector<String>>(message.getUpdatesVect()); |
264 | 269 |
logReplication.info("ReplicationHandler.update - The document list size is "+updateList.size()+ " from "+message.getServerName()); |
... | ... | |
558 | 563 |
logReplication.info("ReplicationHandler.handleSingleDataFile - Try to replicate data file: " + accNumber); |
559 | 564 |
DBConnection dbConn = null; |
560 | 565 |
int serialNumber = -1; |
566 |
InputStream input = null; |
|
561 | 567 |
try |
562 | 568 |
{ |
563 | 569 |
// Get DBConnection from pool |
... | ... | |
621 | 627 |
"&action=readdata&docid="+accNumber; |
622 | 628 |
readDataURLString = MetacatUtil.replaceWhiteSpaceForURL(readDataURLString); |
623 | 629 |
URL u = new URL(readDataURLString); |
624 |
InputStream input = ReplicationService.getURLStream(u);
|
|
630 |
input = ReplicationService.getURLStream(u); |
|
625 | 631 |
//register data file into xml_documents table and wite data file |
626 | 632 |
//into file system |
627 | 633 |
if ( input != null) |
... | ... | |
720 | 726 |
} |
721 | 727 |
finally |
722 | 728 |
{ |
729 |
IOUtils.closeQuietly(input); |
|
723 | 730 |
//return DBConnection |
724 | 731 |
DBConnectionPool.returnDBConnection(dbConn, serialNumber); |
732 |
|
|
733 |
|
|
725 | 734 |
}//finally |
726 | 735 |
logMetacat.info("replication.create localId:" + accNumber); |
727 | 736 |
} |
Also available in: Unified diff
ReplicationServices.getUrlStream(url) callers were not closing the inputstream properly, as was revealed when switching to libclient v2 (a pooling connection manager in HttpClient) and encountering reasource leaks.