/** * Create a channel based on the provided {@link MessageGroupQueue}. * @param messageGroupQueue the {@link MessageGroupQueue} to use. * @since 5.0 */ public PriorityChannel(MessageGroupQueue messageGroupQueue) { super(messageGroupQueue); this.upperBound = new UpperBound(0); this.useMessageStore = true; }
/** * Creates a SimpleMessageStore with a maximum size limited by the given capacity, * the timeout in millisecond to wait for the empty slot in the store and LockRegistry * for the message group operations concurrency. * @param individualCapacity The message capacity. * @param groupCapacity The capacity of each group. * @param upperBoundTimeout The time to wait if the store is at max capacity * @param lockRegistry The lock registry. * @since 4.3 */ public SimpleMessageStore(int individualCapacity, int groupCapacity, long upperBoundTimeout, LockRegistry lockRegistry) { super(false); Assert.notNull(lockRegistry, "The LockRegistry cannot be null"); this.individualUpperBound = new UpperBound(individualCapacity); this.individualCapacity = individualCapacity; this.groupCapacity = groupCapacity; this.lockRegistry = lockRegistry; this.upperBoundTimeout = upperBoundTimeout; }
/** * Create a channel with the specified queue capacity. If the capacity * is a non-positive value, the queue will be unbounded. Message priority * will be determined by the provided {@link Comparator}. If the comparator * is <code>null</code>, the priority will be based upon the value of * {@link IntegrationMessageHeaderAccessor#getPriority()}. * * @param capacity The capacity. * @param comparator The comparator. */ public PriorityChannel(int capacity, @Nullable Comparator<Message<?>> comparator) { super(new PriorityBlockingQueue<>(11, new SequenceFallbackComparator(comparator))); this.upperBound = new UpperBound(capacity); this.useMessageStore = false; }
upperBound = new UpperBound(this.groupCapacity); for (Message<?> message : messages) { upperBound.tryAcquire(-1);
/** * Create a channel based on the provided {@link MessageGroupQueue}. * @param messageGroupQueue the {@link MessageGroupQueue} to use. * @since 5.0 */ public PriorityChannel(MessageGroupQueue messageGroupQueue) { super(messageGroupQueue); this.upperBound = new UpperBound(0); this.useMessageStore = true; }
/** * Creates a SimpleMessageStore with a maximum size limited by the given capacity, * the timeout in millisecond to wait for the empty slot in the store and LockRegistry * for the message group operations concurrency. * @param individualCapacity The message capacity. * @param groupCapacity The capacity of each group. * @param upperBoundTimeout The time to wait if the store is at max capacity * @param lockRegistry The lock registry. * @since 4.3 */ public SimpleMessageStore(int individualCapacity, int groupCapacity, long upperBoundTimeout, LockRegistry lockRegistry) { super(false); Assert.notNull(lockRegistry, "The LockRegistry cannot be null"); this.individualUpperBound = new UpperBound(individualCapacity); this.individualCapacity = individualCapacity; this.groupCapacity = groupCapacity; this.lockRegistry = lockRegistry; this.upperBoundTimeout = upperBoundTimeout; }
/** * Create a channel with the specified queue capacity. If the capacity * is a non-positive value, the queue will be unbounded. Message priority * will be determined by the provided {@link Comparator}. If the comparator * is <code>null</code>, the priority will be based upon the value of * {@link IntegrationMessageHeaderAccessor#getPriority()}. * * @param capacity The capacity. * @param comparator The comparator. */ public PriorityChannel(int capacity, @Nullable Comparator<Message<?>> comparator) { super(new PriorityBlockingQueue<>(11, new SequenceFallbackComparator(comparator))); this.upperBound = new UpperBound(capacity); this.useMessageStore = false; }
upperBound = new UpperBound(this.groupCapacity); for (Message<?> message : messages) { upperBound.tryAcquire(-1);