Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

flowfilejava.lang.IllegalArgumentException: Cannot write to StandardContentClaim because it has already been written to

Highlighted

flowfilejava.lang.IllegalArgumentException: Cannot write to StandardContentClaim because it has already been written to

New Contributor

Error in transfering flowfiles from custom processor while multiple threads accessing the below method

Code:

private void transferFlowFile(final ProcessSession session, final String message, ComponentLog logger,Relationship RELATIONSHIP_SUCCESS)

{
	


final AtomicInteger msgsThisFlowFile = new AtomicInteger(1);

FlowFile flowFile=null;

try {
	


synchronized (this){
	


flowFile = session.create();

flowFile = session.write(flowFile, new OutputStreamCallback() {
	


@Override

public void process(final OutputStream rawOut) throws IOException {
	


rawOut.write(message.getBytes());

}

});

//session.getProvenanceReporter().receive(flowFile, "myfile");

session.transfer(flowFile, RELATIONSHIP_SUCCESS);

session.commit();

}

} catch (Exception e) {
	


LOG.info("Error occured while sending flowfile"+e);

session.remove(flowFile);

//throw e;

}

}
Don't have an account?
Coming from Hortonworks? Activate your account here