ArrayBlockingQueue
is backed by an array that size will never change after creation. Setting the capacity to Integer.MAX_VALUE
would create a big array with high costs in space.
ArrayBlockingQueue
is always bounded.
LinkedBlockingQueue
creates nodes dynamically until the capacity
is reached. This is by default Integer.MAX_VALUE
. Using such a big capacity has no extra costs in space.
LinkedBlockingQueue
is optionally bounded.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…