/** * @return NoWaitRetry strategy {@see NoWaitRetry} */ static <T> NoWaitRetry<T> noWaitRetry() { return new NoWaitRetry<>(); }
/** * Creates an async.Queue backed by a JDK Wait Free unbounded ConcurrentLinkedQueue * Wait strategy used is NoWaitRetry by default for both Consumers and Producers * (both Consumers and Producers will repeatedly retry until successful). Use * withConsumerWaitStrategy & withProducerWaitStrategy methods on the returned queue to change the * wait strategy * <pre> * {@code * queue.withConsumerWaitStrategy(new DirectWaitStrategy()) * .withProducerWaitStrategy(new YieldWait()); * }</pre> * * * @return Factory for unbounded wait free queue backed by ConcurrentLinkedQueue */ public static <T> QueueFactory<T> unboundedNonBlockingQueue() { return () -> new Queue<T>( new ConcurrentLinkedQueue<>(), new NoWaitRetry<>(), new NoWaitRetry<>()); }
/** * Creates an async.Queue backed by an Agrona OneToOneConcurrentArrayQueue bounded by specified queueSize * Wait strategy used is NoWaitRetry by default for both Consumers and Producers * (both Consumers and Producers will repeatedly retry until successful). Use * withConsumerWaitStrategy & withProducerWaitStrategy methods on the returned queue to change the * wait strategy * <pre> * {@code * queue.withConsumerWaitStrategy(new DirectWaitStrategy()) * .withProducerWaitStrategy(new YieldWait()); * }</pre> * * @param queueSize * @return */ public static <T> QueueFactory<T> singleWriterboundedNonBlockingQueue(final int queueSize) { return () -> new Queue<T>( new OneToOneConcurrentArrayQueue<>( queueSize), new NoWaitRetry<>(), new NoWaitRetry<>()); } /**
/** * Creates an async.Queue backed by an Agrona ManyToOneConcurrentArrayQueue bounded by specified queueSize * Wait strategy used is NoWaitRetry by default for both Consumers and Producers * (both Consumers and Producers will repeatedly retry until successful). Use * withConsumerWaitStrategy & withProducerWaitStrategy methods on the returned queue to change the * wait strategy * <pre> * {@code * queue.withConsumerWaitStrategy(new DirectWaitStrategy()) * .withProducerWaitStrategy(new YieldWait()); * }</pre> * * @param queueSize upper bound for Queue * @return bounded wait free Queue Factory backed by an Agrona ManyToOneConcurrentArrayQueue */ public static <T> QueueFactory<T> boundedNonBlockingQueue(final int queueSize) { return () -> new Queue<T>( new ManyToOneConcurrentArrayQueue<>( queueSize), new NoWaitRetry<>(), new NoWaitRetry<>()); }
/** * @return NoWaitRetry strategy {@see NoWaitRetry} */ static <T> NoWaitRetry<T> noWaitRetry() { return new NoWaitRetry<>(); }
/** * Creates an async.Queue backed by a JDK Wait Free unbounded ConcurrentLinkedQueue * Wait strategy used is NoWaitRetry by default for both Consumers and Producers * (both Consumers and Producers will repeatedly retry until successful). Use * withConsumerWaitStrategy & withProducerWaitStrategy methods on the returned queue to change the * wait strategy * <pre> * {@code * queue.withConsumerWaitStrategy(new DirectWaitStrategy()) * .withProducerWaitStrategy(new YieldWait()); * }</pre> * * * @return Factory for unbounded wait free queue backed by ConcurrentLinkedQueue */ public static <T> QueueFactory<T> unboundedNonBlockingQueue() { return () -> new Queue<T>( new ConcurrentLinkedQueue<>(), new NoWaitRetry<>(), new NoWaitRetry<>()); }
/** * Creates an async.Queue backed by an Agrona OneToOneConcurrentArrayQueue bounded by specified queueSize * Wait strategy used is NoWaitRetry by default for both Consumers and Producers * (both Consumers and Producers will repeatedly retry until successful). Use * withConsumerWaitStrategy & withProducerWaitStrategy methods on the returned queue to change the * wait strategy * <pre> * {@code * queue.withConsumerWaitStrategy(new DirectWaitStrategy()) * .withProducerWaitStrategy(new YieldWait()); * }</pre> * * @param queueSize * @return */ public static <T> QueueFactory<T> singleWriterboundedNonBlockingQueue(final int queueSize) { return () -> new Queue<T>( new OneToOneConcurrentArrayQueue<>( queueSize), new NoWaitRetry<>(), new NoWaitRetry<>()); } /**
/** * Creates an async.Queue backed by an Agrona ManyToOneConcurrentArrayQueue bounded by specified queueSize * Wait strategy used is NoWaitRetry by default for both Consumers and Producers * (both Consumers and Producers will repeatedly retry until successful). Use * withConsumerWaitStrategy & withProducerWaitStrategy methods on the returned queue to change the * wait strategy * <pre> * {@code * queue.withConsumerWaitStrategy(new DirectWaitStrategy()) * .withProducerWaitStrategy(new YieldWait()); * }</pre> * * @param queueSize upper bound for Queue * @return bounded wait free Queue Factory backed by an Agrona ManyToOneConcurrentArrayQueue */ public static <T> QueueFactory<T> boundedNonBlockingQueue(final int queueSize) { return () -> new Queue<T>( new ManyToOneConcurrentArrayQueue<>( queueSize), new NoWaitRetry<>(), new NoWaitRetry<>()); }