/** * Creates a new coordinator instance with a custom configuration and steal policy. * <p/> * In case {@code null} is provided for either argument, the corresponding default will be used. For the * configuration, the default is {@link DefaultAsyncConfig} and for the steal policy, the default is * {@link FallBehindStealPolicy}. The {@code maxAllowedFallBehind} value of the default steal policy will be retrieved * from the configuration. * * @param config the custom configuration instance that should be used by this coordinator, if {@code null} is * provided the default configuration will be used * @param stealPolicy the custom steal policy that should be used by this coordinator, if {@code null} is provided the * default steal policy will be used */ public AsyncCoordinator(AsyncConfig config, StealPolicy<I> stealPolicy) { if (null == config) { config = DefaultAsyncConfig.getInstance(); } if (null == stealPolicy) { stealPolicy = new FallBehindStealPolicy<I>(config.getMaxAllowedFallBehind()); } this.group = new ProcessingBucketGroup(config, stealPolicy); this.coordinatorLock = new TerracottaReadWriteLock(config.isSynchronousWrite()); this.coordinatorWriteLock = coordinatorLock.writeLock(); this.coordinatorReadLock = coordinatorLock.readLock(); }
/** * Creates a new coordinator instance with a custom configuration and steal policy. * <p/> * In case {@code null} is provided for either argument, the corresponding default will be used. For the * configuration, the default is {@link DefaultAsyncConfig} and for the steal policy, the default is * {@link FallBehindStealPolicy}. The {@code maxAllowedFallBehind} value of the default steal policy will be retrieved * from the configuration. * * @param config the custom configuration instance that should be used by this coordinator, if {@code null} is * provided the default configuration will be used * @param stealPolicy the custom steal policy that should be used by this coordinator, if {@code null} is provided the * default steal policy will be used */ public AsyncCoordinator(AsyncConfig config, StealPolicy<I> stealPolicy) { if (null == config) { config = DefaultAsyncConfig.getInstance(); } if (null == stealPolicy) { stealPolicy = new FallBehindStealPolicy<I>(config.getMaxAllowedFallBehind()); } this.group = new ProcessingBucketGroup(config, stealPolicy); this.coordinatorLock = new TerracottaReadWriteLock(config.isSynchronousWrite()); this.coordinatorWriteLock = coordinatorLock.writeLock(); this.coordinatorReadLock = coordinatorLock.readLock(); }
/** * Creates a new coordinator instance with a custom configuration and steal policy. * <p/> * In case {@code null} is provided for either argument, the corresponding default will be used. For the * configuration, the default is {@link DefaultAsyncConfig} and for the steal policy, the default is * {@link FallBehindStealPolicy}. The {@code maxAllowedFallBehind} value of the default steal policy will be retrieved * from the configuration. * * @param config the custom configuration instance that should be used by this coordinator, if {@code null} is * provided the default configuration will be used * @param stealPolicy the custom steal policy that should be used by this coordinator, if {@code null} is provided the * default steal policy will be used */ public AsyncCoordinator(AsyncConfig config, StealPolicy<I> stealPolicy) { if (null == config) { config = DefaultAsyncConfig.getInstance(); } if (null == stealPolicy) { stealPolicy = new FallBehindStealPolicy<I>(config.getMaxAllowedFallBehind()); } this.group = new ProcessingBucketGroup(config, stealPolicy); this.coordinatorLock = new TerracottaReadWriteLock(config.isSynchronousWrite()); this.coordinatorWriteLock = coordinatorLock.writeLock(); this.coordinatorReadLock = coordinatorLock.readLock(); }