incubator-connectors-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From conflue...@apache.org
Subject [CONF] Apache Connectors Framework > How to Write an Output Connector
Date Thu, 21 Oct 2010 21:35:00 GMT
Space: Apache Connectors Framework (https://cwiki.apache.org/confluence/display/CONNECTORS)
Page: How to Write an Output Connector (https://cwiki.apache.org/confluence/display/CONNECTORS/How+to+Write+an+Output+Connector)
Comment: https://cwiki.apache.org/confluence/display/CONNECTORS/How+to+Write+an+Output+Connector?focusedCommentId=24183895#comment-24183895

Comment added by Farzad:
---------------------------------------------------------------------

While there are not jobs running, right after a restart, the framework seems to be calling
the setThreadContext and followed by the clearThreadContext.  Sometimes, it uses an old thread,
sometimes a new thread. Is there something I'm not doing to say the connector is done?

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?

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

Change your notification preferences: https://cwiki.apache.org/confluence/users/viewnotifications.action

Mime
View raw message