org.apache.pig.data
Class SelfSpillBag.MemoryLimits

java.lang.Object
  extended by org.apache.pig.data.SelfSpillBag.MemoryLimits
Enclosing class:
SelfSpillBag

@InterfaceAudience.Private
@InterfaceStability.Evolving
public static class SelfSpillBag.MemoryLimits
extends Object

This class helps to compute the number of entries that should be held in memory so that memory consumption is limited. The memory limit is computed using the percentage of max memory that the user of this class is allowed to use, and number of similar objects that share this limit. The number of objects that will fit into this memory limit is computed using the average memory size of the objects whose size is given to this class.


Constructor Summary
SelfSpillBag.MemoryLimits(int bagCount, float percent)
           
 
Method Summary
 void addNewObjSize(long memorySize)
          Submit information about size of another object
 long getCacheLimit()
          Computes the number of objects that would fit into memory based on the memory limit and average size of each object.
 long getNumObjectsSizeAdded()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SelfSpillBag.MemoryLimits

public SelfSpillBag.MemoryLimits(int bagCount,
                                 float percent)
Parameters:
bagCount -
percent -
Method Detail

getCacheLimit

public long getCacheLimit()
Computes the number of objects that would fit into memory based on the memory limit and average size of each object.

Returns:
number of objects limit

addNewObjSize

public void addNewObjSize(long memorySize)
Submit information about size of another object

Parameters:
memorySize -

getNumObjectsSizeAdded

public long getNumObjectsSizeAdded()
Returns:
the size of


Copyright © 2007-2012 The Apache Software Foundation