类 MemorySafeLinkedBlockingQueue<E>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractQueue<E>
org.dromara.dynamictp.common.queue.VariableLinkedBlockingQueue<E>
org.dromara.dynamictp.common.queue.MemorySafeLinkedBlockingQueue<E>
- 所有已实现的接口:
Serializable,Iterable<E>,Collection<E>,BlockingQueue<E>,Queue<E>
Can completely solve the OOM problem caused by
LinkedBlockingQueue.-
字段概要
字段 -
构造器概要
构造器构造器说明MemorySafeLinkedBlockingQueue(int maxFreeMemory) MemorySafeLinkedBlockingQueue(int capacity, int maxFreeMemory) MemorySafeLinkedBlockingQueue(Collection<? extends E> c, int maxFreeMemory) -
方法概要
修饰符和类型方法说明intget the max free memory.booleandetermine if there is any remaining free memory.booleanInserts the specified element at the tail of this queue if it is possible to do so immediately without exceeding the queue's capacity, returningtrueupon success andfalseif this queue is full.booleanInserts the specified element at the tail of this queue, waiting if necessary up to the specified wait time for space to become available.voidInserts the specified element at the tail of this queue, waiting if necessary for space to become available.voidsetMaxFreeMemory(int maxFreeMemory) set the max free memory.从类继承的方法 org.dromara.dynamictp.common.queue.VariableLinkedBlockingQueue
clear, contains, drainTo, drainTo, iterator, peek, poll, poll, remainingCapacity, remove, setCapacity, size, spliterator, take, toArray, toArray, toString从类继承的方法 java.util.AbstractQueue
add, addAll, element, remove从类继承的方法 java.util.AbstractCollection
containsAll, isEmpty, removeAll, retainAll从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait从接口继承的方法 java.util.concurrent.BlockingQueue
add从接口继承的方法 java.util.Collection
addAll, containsAll, equals, hashCode, isEmpty, parallelStream, removeAll, removeIf, retainAll, stream, toArray
-
字段详细资料
-
THE_16_MB
public static final int THE_16_MB- 另请参阅:
-
-
构造器详细资料
-
MemorySafeLinkedBlockingQueue
public MemorySafeLinkedBlockingQueue() -
MemorySafeLinkedBlockingQueue
public MemorySafeLinkedBlockingQueue(int maxFreeMemory) -
MemorySafeLinkedBlockingQueue
public MemorySafeLinkedBlockingQueue(int capacity, int maxFreeMemory) -
MemorySafeLinkedBlockingQueue
-
-
方法详细资料
-
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
从类复制的说明:VariableLinkedBlockingQueueInserts the specified element at the tail of this queue, waiting if necessary for space to become available.- 指定者:
put在接口中BlockingQueue<E>- 覆盖:
put在类中VariableLinkedBlockingQueue<E>- 抛出:
InterruptedException
-
offer
从类复制的说明:VariableLinkedBlockingQueueInserts the specified element at the tail of this queue, waiting if necessary up to the specified wait time for space to become available.- 指定者:
offer在接口中BlockingQueue<E>- 覆盖:
offer在类中VariableLinkedBlockingQueue<E>- 返回:
trueif successful, orfalseif the specified waiting time elapses before space is available- 抛出:
InterruptedException
-
offer
从类复制的说明:VariableLinkedBlockingQueueInserts the specified element at the tail of this queue if it is possible to do so immediately without exceeding the queue's capacity, returningtrueupon success andfalseif this queue is full. When using a capacity-restricted queue, this method is generally preferable to methodadd, which can fail to insert an element only by throwing an exception.- 指定者:
offer在接口中BlockingQueue<E>- 指定者:
offer在接口中Queue<E>- 覆盖:
offer在类中VariableLinkedBlockingQueue<E>
-