类 MemorySafeLinkedBlockingQueue<E>

所有已实现的接口:
Serializable, Iterable<E>, Collection<E>, BlockingQueue<E>, Queue<E>

public class MemorySafeLinkedBlockingQueue<E> extends VariableLinkedBlockingQueue<E>
Can completely solve the OOM problem caused by LinkedBlockingQueue.
另请参阅:
  • 字段详细资料

    • 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

      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
      从类复制的说明: VariableLinkedBlockingQueue
      Inserts 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

      public boolean offer(E e, long timeout, TimeUnit unit) throws InterruptedException
      从类复制的说明: VariableLinkedBlockingQueue
      Inserts 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>
      返回:
      true if successful, or false if the specified waiting time elapses before space is available
      抛出:
      InterruptedException
    • offer

      public boolean offer(E e)
      从类复制的说明: VariableLinkedBlockingQueue
      Inserts the specified element at the tail of this queue if it is possible to do so immediately without exceeding the queue's capacity, returning true upon success and false if this queue is full. When using a capacity-restricted queue, this method is generally preferable to method add, which can fail to insert an element only by throwing an exception.
      指定者:
      offer 在接口中 BlockingQueue<E>
      指定者:
      offer 在接口中 Queue<E>
      覆盖:
      offer 在类中 VariableLinkedBlockingQueue<E>