I have a need to add a integer counter field to the source record, so i created a custom filter and added the same to the connector property ’
event.filter.class'. I increase this counter in the ‘pass’ call back method (which is called for every DCP event)
I want to know if the counter variable has to be treated as an instance variable or a static variable,
So I want to understand how the filter class is instantiated i.e. for a given connector task, how many instances of the filter class would be instantiated?
Is the filter object or the filter objects called from multiple threads?
And finally, can more than one task for the same connector go to the same connect worker? I guess it does. if so, then if i treat the counter variable to be a static variable then i have to synchronize it, rather i would keep it as an instance variable but still question 1 and 2 needs to be answered.
In short, is the instance variable in the filter class thread safe