public class MemorySafeLinkedBlockingQueue<E> extends LinkedBlockingQueue<E>
LinkedBlockingQueue,
does not depend on Instrumentation and is easier to use than
MemoryLimitedLinkedBlockingQueue.| 限定符和类型 | 字段和说明 |
|---|---|
static int |
THE_256_MB |
| 构造器和说明 |
|---|
MemorySafeLinkedBlockingQueue() |
MemorySafeLinkedBlockingQueue(Collection<? extends E> c,
int maxFreeMemory) |
MemorySafeLinkedBlockingQueue(int maxFreeMemory) |
| 限定符和类型 | 方法和说明 |
|---|---|
int |
getMaxFreeMemory()
get the max free memory.
|
boolean |
hasRemainedMemory()
determine if there is any remaining free memory.
|
boolean |
offer(E e) |
boolean |
offer(E e,
long timeout,
TimeUnit unit) |
void |
put(E e) |
void |
setMaxFreeMemory(int maxFreeMemory)
set the max free memory.
|
void |
setRejector(Rejector<E> rejector)
set the rejector.
|
clear, contains, drainTo, drainTo, iterator, peek, poll, poll, remainingCapacity, remove, size, spliterator, take, toArray, toArray, toStringadd, addAll, element, removecontainsAll, isEmpty, removeAll, retainAlladdaddAll, containsAll, equals, hashCode, isEmpty, parallelStream, removeAll, removeIf, retainAll, streampublic MemorySafeLinkedBlockingQueue()
public MemorySafeLinkedBlockingQueue(int maxFreeMemory)
public MemorySafeLinkedBlockingQueue(Collection<? extends E> c, int maxFreeMemory)
public void setMaxFreeMemory(int maxFreeMemory)
maxFreeMemory - the max free memorypublic int getMaxFreeMemory()
public void setRejector(Rejector<E> rejector)
rejector - the rejectorpublic boolean hasRemainedMemory()
public void put(E e) throws InterruptedException
put 在接口中 BlockingQueue<E>put 在类中 LinkedBlockingQueue<E>InterruptedExceptionpublic boolean offer(E e, long timeout, TimeUnit unit) throws InterruptedException
offer 在接口中 BlockingQueue<E>offer 在类中 LinkedBlockingQueue<E>InterruptedExceptionpublic boolean offer(E e)
offer 在接口中 BlockingQueue<E>offer 在接口中 Queue<E>offer 在类中 LinkedBlockingQueue<E>Copyright © 2011–2023 The Apache Software Foundation. All rights reserved.