001package com.hammurapi.common; 002 003import java.util.concurrent.locks.Lock; 004import java.util.concurrent.locks.ReentrantLock; 005 006/** 007 * LocalJoiner uses java.util.concurrent.locks.ReentrantLock to protect simultaneous access 008 * to input collectors. 009 * @author Pavel Vlasov 010 * 011 * @param <T> 012 * @param <C> 013 * @param <R> 014 */ 015public abstract class LocalJoiner<T, C, R> extends Joiner<T, C, R> { 016 017 Lock lock = new ReentrantLock(); 018 019 protected LocalJoiner( 020 Collector<T>[] inputCollectors, 021 Class<T> inputType, 022 boolean outerJoin) { 023 super(inputCollectors, inputType, outerJoin); 024 } 025 026 @Override 027 protected void startJoin() { 028 lock.lock(); 029 } 030 031 @Override 032 protected void endJoin() { 033 lock.unlock(); 034 } 035 036}