public class MemorySafeLinkedBlockingQueue<E>
extends java.util.concurrent.LinkedBlockingQueue<E>
LinkedBlockingQueue,
does not depend on Instrumentation and is easier to use than
MemoryLimitedLinkedBlockingQueue.| Constructor and Description |
|---|
MemorySafeLinkedBlockingQueue(java.util.Collection<? extends E> c,
int maxFreeMemory) |
MemorySafeLinkedBlockingQueue(int maxFreeMemory) |
| Modifier and Type | Method and Description |
|---|---|
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,
java.util.concurrent.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, toStringcontainsAll, isEmpty, removeAll, retainAllclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic MemorySafeLinkedBlockingQueue(int maxFreeMemory)
public MemorySafeLinkedBlockingQueue(java.util.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 java.lang.InterruptedException
public boolean offer(E e, long timeout, java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
Copyright © 2024 The Apache Software Foundation. All rights reserved.