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 Sun, 24 Oct 2010 16:43: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=24184172#comment-24184172

Comment added by Karl Wright:
---------------------------------------------------------------------

I would use the IDFactory.make() method to generate a unique identifier.  See the
class org.apache.manifoldcf.core.interfaces.IDFactory.

In reply to a comment by Farzad:
I seem to had two major problems.  I was caching the thread context, I cleaned them all up.
 The other one is a race condition problem.  Two threads are trying to do an insert, both
fail, they do the second query and find the same max number.  The last txn will fail.  So
I made the second part of my algorithm synchronized.  Same thing happen on the first insert.
 About to make the whole insert method synchronized.  Before doing that I was wondering if
you have other suggestion about solving this problem.  It seems making it synchronized defeats
having multiple threads. My other choice would be to keep another table with the highest dup
numbers and lock it out during a write operation. Thoughts?

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

Mime
View raw message