Skip to content

Commit

Permalink
0003293: Resource leak when loading data from transport
Browse files Browse the repository at this point in the history
  • Loading branch information
chenson42 committed Oct 29, 2017
1 parent 15611f9 commit e222aaf
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -553,14 +553,18 @@ protected List<IncomingBatch> loadDataFromTransport(final ProcessInfo processInf
if (threadFactory == null) {
threadFactory = new CustomizableThreadFactory(parameterService.getEngineName().toLowerCase() + "-dataloader");
}

ExecutorService executor = Executors.newFixedThreadPool(1, threadFactory);
LoadIntoDatabaseOnArrivalListener loadListener = new LoadIntoDatabaseOnArrivalListener(processInfo,
sourceNode.getNodeId(), listener, executor);
new SimpleStagingDataWriter(transport.openReader(), stagingManager, Constants.STAGING_CATEGORY_INCOMING,
memoryThresholdInBytes, BatchType.LOAD, targetNodeId, ctx, loadListener).process();

/* Previously submitted tasks will still be executed */
executor.shutdown();
try {
new SimpleStagingDataWriter(transport.openReader(), stagingManager, Constants.STAGING_CATEGORY_INCOMING,
memoryThresholdInBytes, BatchType.LOAD, targetNodeId, ctx, loadListener).process();
} finally {
/* Previously submitted tasks will still be executed */
executor.shutdown();
}

OutputStreamWriter outWriter = null;
if (out != null) {
Expand Down

0 comments on commit e222aaf

Please sign in to comment.