hasSwapped properly check

protect check for hasSwapped.
This commit is contained in:
nishantmonu51 2014-05-01 01:38:03 +05:30
parent ff56573910
commit faa74ce2cb
1 changed files with 6 additions and 4 deletions

View File

@ -313,10 +313,12 @@ public class RealtimePlumber implements Plumber
final Interval interval = sink.getInterval(); final Interval interval = sink.getInterval();
for (FireHydrant hydrant : sink) { for (FireHydrant hydrant : sink) {
if (!hydrant.hasSwapped()) { synchronized (hydrant) {
log.info("Hydrant[%s] hasn't swapped yet, swapping. Sink[%s]", hydrant, sink); if (!hydrant.hasSwapped()) {
final int rowCount = persistHydrant(hydrant, schema, interval); log.info("Hydrant[%s] hasn't swapped yet, swapping. Sink[%s]", hydrant, sink);
metrics.incrementRowOutputCount(rowCount); final int rowCount = persistHydrant(hydrant, schema, interval);
metrics.incrementRowOutputCount(rowCount);
}
} }
} }