Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix null pointer exception when importing program members multithread. #125

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
public class ProgramMembersBulkExtractInputPlugin extends MarketoBaseInputPluginDelegate<ProgramMembersBulkExtractInputPlugin.PluginTask>
{
private final Logger logger = LoggerFactory.getLogger(getClass());
private final Object pageBuilderLock = new Object();

public interface PluginTask extends MarketoBaseInputPluginDelegate.PluginTask, CsvTokenizer.PluginTask
{
Expand Down Expand Up @@ -214,7 +215,9 @@ private Future<?> createFutureTask(PluginTask task, RecordImporter recordImporte
while (csvRecords.hasNext()) {
Map<String, String> csvRecord = csvRecords.next();
ObjectNode objectNode = MarketoUtils.OBJECT_MAPPER.valueToTree(csvRecord);
recordImporter.importRecord(new AllStringJacksonServiceRecord(objectNode), pageBuilder);
synchronized (pageBuilderLock) {
recordImporter.importRecord(new AllStringJacksonServiceRecord(objectNode), pageBuilder);
}
imported = imported + 1;
}

Expand Down