类 MemorySafeLinkedBlockingQueue<E>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractQueue<E>
-
- java.util.concurrent.LinkedBlockingQueue<E>
-
- org.apache.dubbo.common.threadpool.MemorySafeLinkedBlockingQueue<E>
-
- 所有已实现的接口:
Serializable,Iterable<E>,Collection<E>,BlockingQueue<E>,Queue<E>
public class MemorySafeLinkedBlockingQueue<E> extends LinkedBlockingQueue<E>
Can completely solve the OOM problem caused byLinkedBlockingQueue, does not depend onInstrumentationand is easier to use thanMemoryLimitedLinkedBlockingQueue.
-
-
字段概要
字段 修饰符和类型 字段 说明 static intTHE_256_MB
-
构造器概要
构造器 构造器 说明 MemorySafeLinkedBlockingQueue()MemorySafeLinkedBlockingQueue(int maxFreeMemory)MemorySafeLinkedBlockingQueue(Collection<? extends E> c, int maxFreeMemory)
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 intgetMaxFreeMemory()get the max free memory.booleanhasRemainedMemory()determine if there is any remaining free memory.booleanoffer(E e)booleanoffer(E e, long timeout, TimeUnit unit)voidput(E e)voidsetMaxFreeMemory(int maxFreeMemory)set the max free memory.-
从类继承的方法 java.util.concurrent.LinkedBlockingQueue
clear, contains, drainTo, drainTo, forEach, iterator, peek, poll, poll, remainingCapacity, remove, removeAll, removeIf, retainAll, size, spliterator, take, toArray, toArray, toString
-
从类继承的方法 java.util.AbstractQueue
add, addAll, element, remove
-
从类继承的方法 java.util.AbstractCollection
containsAll, isEmpty
-
从接口继承的方法 java.util.concurrent.BlockingQueue
add
-
从接口继承的方法 java.util.Collection
addAll, containsAll, equals, hashCode, isEmpty, parallelStream, stream, toArray
-
-
-
-
构造器详细资料
-
MemorySafeLinkedBlockingQueue
public MemorySafeLinkedBlockingQueue()
-
MemorySafeLinkedBlockingQueue
public MemorySafeLinkedBlockingQueue(int maxFreeMemory)
-
MemorySafeLinkedBlockingQueue
public MemorySafeLinkedBlockingQueue(Collection<? extends E> c, int maxFreeMemory)
-
-
方法详细资料
-
setMaxFreeMemory
public void setMaxFreeMemory(int maxFreeMemory)
set the max free memory.- 参数:
maxFreeMemory- the max free memory
-
getMaxFreeMemory
public int getMaxFreeMemory()
get the max free memory.- 返回:
- the max free memory limit
-
hasRemainedMemory
public boolean hasRemainedMemory()
determine if there is any remaining free memory.- 返回:
- true if has free memory
-
put
public void put(E e) throws InterruptedException
- 指定者:
put在接口中BlockingQueue<E>- 覆盖:
put在类中LinkedBlockingQueue<E>- 抛出:
InterruptedException
-
offer
public boolean offer(E e, long timeout, TimeUnit unit) throws InterruptedException
- 指定者:
offer在接口中BlockingQueue<E>- 覆盖:
offer在类中LinkedBlockingQueue<E>- 抛出:
InterruptedException
-
offer
public boolean offer(E e)
- 指定者:
offer在接口中BlockingQueue<E>- 指定者:
offer在接口中Queue<E>- 覆盖:
offer在类中LinkedBlockingQueue<E>
-
-