public ProcessingBucketGroup(final ClusterInfo cluster, final AsyncConfig config, final StealPolicy<I> policy) { this.cluster = ClusterInfoUtil.determineDsoClusterInstance(cluster); this.config = config; this.policy = policy; this.buckets = newMap(); this.groupLock = new TerracottaReadWriteLock(config.isSynchronousWrite()); this.groupWriteLock = groupLock.writeLock(); this.groupReadLock = groupLock.readLock(); }
public ProcessingBucketGroup(final ClusterInfo cluster, final AsyncConfig config, final StealPolicy<I> policy) { this.cluster = ClusterInfoUtil.determineDsoClusterInstance(cluster); this.config = config; this.policy = policy; this.buckets = newMap(); this.groupLock = new TerracottaReadWriteLock(config.isSynchronousWrite()); this.groupWriteLock = groupLock.writeLock(); this.groupReadLock = groupLock.readLock(); }
public ProcessingBucketGroup(final ClusterInfo cluster, final AsyncConfig config, final StealPolicy<I> policy) { this.cluster = ClusterInfoUtil.determineDsoClusterInstance(cluster); this.config = config; this.policy = policy; this.buckets = newMap(); this.groupLock = new TerracottaReadWriteLock(config.isSynchronousWrite()); this.groupWriteLock = groupLock.writeLock(); this.groupReadLock = groupLock.readLock(); }
ProcessingBucket(final ProcessingBucketGroup<I> group, final ClusterInfo cluster, final ItemProcessor<I> processor, final AsyncErrorHandler errorHandler) { this.group = group; this.stateLock = new TerracottaReadWriteLock(group.getConfig().isSynchronousWrite()); this.stateReadLock = stateLock.readLock(); this.stateWriteLock = stateLock.writeLock(); this.bucketLock = new TerracottaReadWriteLock(group.getConfig().isSynchronousWrite()); this.bucketWriteLock = bucketLock.writeLock(); this.bucketReadLock = bucketLock.readLock(); this.bucketIsEmpty = bucketWriteLock.newCondition(); this.quarantineLock = new TerracottaReadWriteLock(group.getConfig().isSynchronousWrite()); this.quarantineWriteLock = quarantineLock.writeLock(); this.quarantineReadLock = quarantineLock.readLock(); this.cluster = ClusterInfoUtil.determineDsoClusterInstance(cluster); this.baselineTimestamp = System.currentTimeMillis(); this.processor = processor; if (null == errorHandler) { this.errorHandler = new LoggingErrorHandler(); } else { this.errorHandler = errorHandler; } }
ProcessingBucket(final ProcessingBucketGroup<I> group, final ClusterInfo cluster, final ItemProcessor<I> processor, final AsyncErrorHandler errorHandler) { this.group = group; AsyncConfig config = group.getConfig(); if(config instanceof AsyncConfig2) { this.maxQueueSize = ((AsyncConfig2)config).getMaxQueueSize(); } else { this.maxQueueSize = 0; } this.stateLock = new TerracottaReadWriteLock(group.getConfig().isSynchronousWrite()); this.stateReadLock = stateLock.readLock(); this.stateWriteLock = stateLock.writeLock(); this.bucketLock = new TerracottaReadWriteLock(group.getConfig().isSynchronousWrite()); this.bucketWriteLock = bucketLock.writeLock(); this.bucketReadLock = bucketLock.readLock(); this.bucketIsEmpty = bucketWriteLock.newCondition(); this.bucketNotFull = bucketWriteLock.newCondition(); this.quarantineLock = new TerracottaReadWriteLock(group.getConfig().isSynchronousWrite()); this.quarantineWriteLock = quarantineLock.writeLock(); this.quarantineReadLock = quarantineLock.readLock(); this.cluster = ClusterInfoUtil.determineDsoClusterInstance(cluster); this.baselineTimestamp = System.currentTimeMillis(); this.processor = processor; if (null == errorHandler) { this.errorHandler = new LoggingErrorHandler(); } else { this.errorHandler = errorHandler; } }
ProcessingBucket(final ProcessingBucketGroup<I> group, final ClusterInfo cluster, final ItemProcessor<I> processor, final AsyncErrorHandler errorHandler) { this.group = group; AsyncConfig config = group.getConfig(); if(config instanceof AsyncConfig2) { this.maxQueueSize = ((AsyncConfig2)config).getMaxQueueSize(); } else { this.maxQueueSize = 0; } this.stateLock = new TerracottaReadWriteLock(group.getConfig().isSynchronousWrite()); this.stateReadLock = stateLock.readLock(); this.stateWriteLock = stateLock.writeLock(); this.bucketLock = new TerracottaReadWriteLock(group.getConfig().isSynchronousWrite()); this.bucketWriteLock = bucketLock.writeLock(); this.bucketReadLock = bucketLock.readLock(); this.bucketIsEmpty = bucketWriteLock.newCondition(); this.bucketNotFull = bucketWriteLock.newCondition(); this.quarantineLock = new TerracottaReadWriteLock(group.getConfig().isSynchronousWrite()); this.quarantineWriteLock = quarantineLock.writeLock(); this.quarantineReadLock = quarantineLock.readLock(); this.cluster = ClusterInfoUtil.determineDsoClusterInstance(cluster); this.baselineTimestamp = System.currentTimeMillis(); this.processor = processor; if (null == errorHandler) { this.errorHandler = new LoggingErrorHandler(); } else { this.errorHandler = errorHandler; } }
/** * 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(); }