manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject [CONF] Apache Connectors Framework > How to Write an Output Connector
Date Sat, 23 Oct 2010 07:26:00 GMT
Space: Apache Connectors Framework (
Page: How to Write an Output Connector (

Comment added by Karl Wright:

The thread context is set whenever the connector instance is grabbed by a thread, and must
be forgetten when the connector instance is released by that thread.   Furthermore,
connector instances are pooled, so there is no guarantee that the same instance will be used
for subsequent operations within the same crawl.

If you are trying to use the thread context and finding it to be null, you are by definition
using it incorrectly.

In reply to a comment by Farzad:
So I figured out an answer, please verify it is correct.  It seems thread context is set when
a crawl is happening which makes sense.  I overwrote the setThreadContext method and assigned
an id.  It works, is this the right way?

public void setThreadContext(IThreadContext threadContext) {
	if (threadContext != null) {
		Object id = currentContext.get("id");
		if (id == null) {"id", new Integer(idNum));
			Thread.currentThread().getStackTrace()[1].getMethodName() + 
			", id=" + 
			"[" + 
			currentContext.get("id") + 

Change your notification preferences:

View raw message