|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorca.shirako.util.BinPool
public class BinPool
This is a utility class for use in mappers: it manages a pool of resource "bins" (any Object), indexed by the number of units allocated or free from each bin.
| Constructor Summary | |
|---|---|
BinPool(int ballsPerBin)
|
|
| Method Summary | |
|---|---|
void |
addBin(java.lang.Object o)
Installs a new bin with all elements free. |
void |
drainBin(java.lang.Object o,
int balls,
int draining)
Deallocates units from a bin, increasing its number of free units. |
void |
fillBin(java.lang.Object o,
int balls,
int filling)
Allocates units from/to a bin, reducing the number of free units. |
java.lang.Object |
findAndFillBin(int balls)
Finds a bin with a minimum number of units free, and allocate more units from (to?) it, reducing the number of free units. |
int |
getBinSize()
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public BinPool(int ballsPerBin)
| Method Detail |
|---|
public void addBin(java.lang.Object o)
o - the bin
public void drainBin(java.lang.Object o,
int balls,
int draining)
o - the binballs - how many units the bin has freedraining - how many units being restored
public void fillBin(java.lang.Object o,
int balls,
int filling)
o - the binballs - how many units the bin currently has allocatedfilling - how many new units being allocated
public java.lang.Object findAndFillBin(int balls)
throws java.lang.Exception
balls - number of units needed
java.lang.Exceptionpublic int getBinSize()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||