Class MemoryLimitedLinkedBlockingQueue<E>
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractQueue<E>
java.util.concurrent.LinkedBlockingQueue<E>
org.apache.dubbo.common.threadpool.MemoryLimitedLinkedBlockingQueue<E>
- All Implemented Interfaces:
Serializable,Iterable<E>,Collection<E>,BlockingQueue<E>,Queue<E>
Can completely solve the OOM problem caused by
LinkedBlockingQueue.- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionMemoryLimitedLinkedBlockingQueue(long memoryLimit, Instrumentation inst) MemoryLimitedLinkedBlockingQueue(Collection<? extends E> c, long memoryLimit, Instrumentation inst) -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()longlonglongbooleanbooleanpoll()voidbooleanvoidsetMemoryLimit(long memoryLimit) take()Methods inherited from class java.util.concurrent.LinkedBlockingQueue
contains, drainTo, drainTo, forEach, iterator, peek, remainingCapacity, removeAll, removeIf, retainAll, size, spliterator, toArray, toArray, toStringMethods inherited from class java.util.AbstractQueue
add, addAll, element, removeMethods inherited from class java.util.AbstractCollection
containsAll, isEmptyMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.concurrent.BlockingQueue
addMethods inherited from interface java.util.Collection
addAll, containsAll, equals, hashCode, isEmpty, parallelStream, stream, toArray
-
Constructor Details
-
MemoryLimitedLinkedBlockingQueue
-
MemoryLimitedLinkedBlockingQueue
-
MemoryLimitedLinkedBlockingQueue
public MemoryLimitedLinkedBlockingQueue(Collection<? extends E> c, long memoryLimit, Instrumentation inst)
-
-
Method Details
-
setMemoryLimit
public void setMemoryLimit(long memoryLimit) -
getMemoryLimit
public long getMemoryLimit() -
getCurrentMemory
public long getCurrentMemory() -
getCurrentRemainMemory
public long getCurrentRemainMemory() -
put
- Specified by:
putin interfaceBlockingQueue<E>- Overrides:
putin classLinkedBlockingQueue<E>- Throws:
InterruptedException
-
offer
- Specified by:
offerin interfaceBlockingQueue<E>- Overrides:
offerin classLinkedBlockingQueue<E>- Throws:
InterruptedException
-
offer
- Specified by:
offerin interfaceBlockingQueue<E>- Specified by:
offerin interfaceQueue<E>- Overrides:
offerin classLinkedBlockingQueue<E>
-
take
- Specified by:
takein interfaceBlockingQueue<E>- Overrides:
takein classLinkedBlockingQueue<E>- Throws:
InterruptedException
-
poll
- Specified by:
pollin interfaceBlockingQueue<E>- Overrides:
pollin classLinkedBlockingQueue<E>- Throws:
InterruptedException
-
poll
-
remove
- Specified by:
removein interfaceBlockingQueue<E>- Specified by:
removein interfaceCollection<E>- Overrides:
removein classLinkedBlockingQueue<E>
-
clear
public void clear()- Specified by:
clearin interfaceCollection<E>- Overrides:
clearin classLinkedBlockingQueue<E>
-