org.jctools.queues.atomic.MpscLinkedAtomicQueue Java Examples

The following examples show how to use org.jctools.queues.atomic.MpscLinkedAtomicQueue. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MpscBenchmark.java    From java-Kcp with Apache License 2.0 5 votes vote down vote up
@Setup(Level.Trial)
public void setUp() {
    switch (implementation) {
        case PARAM_UNSAFE:
            queue = new MpscArrayQueue<>(CAPACITY);
            break;
        case PARAM_AFU:
            queue = new MpscAtomicArrayQueue<>(CAPACITY);
            break;
        case PARAM_JDK:
            queue = new ArrayBlockingQueue<>(CAPACITY);
            break;
        case PARAM_LINKED:
            queue = new MpscChunkedArrayQueue<>(CAPACITY);
            break;
        case PARAM_JDK_LINK:
            queue = new LinkedBlockingQueue<>(CAPACITY);
            break;
        case PARAM_LINKED_GROUP:
            queue = new MpscGrowableAtomicArrayQueue<>(CAPACITY);
            break;
        case PARAM_MPSC_LINKED:
            queue = new MpscLinkedQueue<>();
            break;
        case PARAM_MPMC_LINKED_ATOMICQUEUE:
            queue = new MpscLinkedAtomicQueue<>();
            break;
        default:
            throw new UnsupportedOperationException("Unsupported implementation " + implementation);
    }
}
 
Example #2
Source File: MpscaBenchmark.java    From java-Kcp with Apache License 2.0 5 votes vote down vote up
@Setup(Level.Trial)
public void setUp() {
    switch (implementation) {
        case PARAM_Linked:
            queue = new MpscLinkedQueue<>();
            break;
        case PARAM_LINKED_ATOMICQUEUE:
            queue = new MpscLinkedAtomicQueue<>();
            break;
        default:
            throw new UnsupportedOperationException("Unsupported implementation " + implementation);
    }
}
 
Example #3
Source File: TestJctools.java    From util4j with Apache License 2.0 5 votes vote down vote up
/**
 * 链表原子队列占用内存比MpscLinkedQueue低
 */
public void teste4()
{
	MpscLinkedAtomicQueue[] qs=new MpscLinkedAtomicQueue[65535];
	for(int i=0;i<qs.length;i++)
	{
		qs[i]=new MpscLinkedAtomicQueue<>();
	}
}
 
Example #4
Source File: PlatformDependent.java    From servicetalk with Apache License 2.0 4 votes vote down vote up
static <T> Queue<T> newUnboundedLinkedMpscQueue() {
    return USE_UNSAFE_QUEUES ? new MpscLinkedQueue<>()
                             : new MpscLinkedAtomicQueue<>();
}