org.apache.activemq.memory.buffer
Class SizeBasedMessageBuffer

java.lang.Object
  extended by org.apache.activemq.memory.buffer.SizeBasedMessageBuffer
All Implemented Interfaces:
MessageBuffer

public class SizeBasedMessageBuffer
extends Object
implements MessageBuffer

A MessageBuffer which evicts from the largest buffers first.


Constructor Summary
SizeBasedMessageBuffer()
           
SizeBasedMessageBuffer(int limit)
           
 
Method Summary
protected  void bubbleDown(MessageQueue biggest, int position)
           
protected  void bubbleUp(MessageQueue queue, int queueSize)
           
 void clear()
           
 MessageQueue createMessageQueue()
          Creates a new message queue instance
 int getSize()
           
 void onSizeChanged(MessageQueue queue, int delta, int queueSize)
          After a message queue has changed we may need to perform some evictions
protected  void swap(int firstPosition, MessageQueue first, int secondPosition, MessageQueue second)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SizeBasedMessageBuffer

public SizeBasedMessageBuffer()

SizeBasedMessageBuffer

public SizeBasedMessageBuffer(int limit)
Method Detail

getSize

public int getSize()
Specified by:
getSize in interface MessageBuffer

createMessageQueue

public MessageQueue createMessageQueue()
Creates a new message queue instance

Specified by:
createMessageQueue in interface MessageBuffer

onSizeChanged

public void onSizeChanged(MessageQueue queue,
                          int delta,
                          int queueSize)
After a message queue has changed we may need to perform some evictions

Specified by:
onSizeChanged in interface MessageBuffer
Parameters:
delta -
queueSize -

clear

public void clear()
Specified by:
clear in interface MessageBuffer

bubbleUp

protected void bubbleUp(MessageQueue queue,
                        int queueSize)

bubbleDown

protected void bubbleDown(MessageQueue biggest,
                          int position)

swap

protected void swap(int firstPosition,
                    MessageQueue first,
                    int secondPosition,
                    MessageQueue second)


Copyright © 2005-2013 The Apache Software Foundation. All Rights Reserved.