org.apache.activemq.kaha.impl.index.hash
Class HashIndex

java.lang.Object
  extended by org.apache.activemq.kaha.impl.index.hash.HashIndex
All Implemented Interfaces:
HashIndexMBean, Index, IndexMBean

public class HashIndex
extends Object
implements Index, HashIndexMBean

BTree implementation


Field Summary
static int DEFAULT_BIN_SIZE
           
static int DEFAULT_KEY_SIZE
           
static int DEFAULT_LOAD_FACTOR
           
static int DEFAULT_PAGE_SIZE
           
static int MAXIMUM_CAPACITY
           
 
Constructor Summary
HashIndex(File directory, String name, IndexManager indexManager)
          Constructor
 
Method Summary
 void clear()
          clear the index
 boolean containsKey(Object key)
           
 void delete()
          delete all state associated with the index
 StoreEntry get(Object key)
           
 int getActiveBins()
           
 int getKeySize()
           
 int getLoadFactor()
           
 int getMaximumCapacity()
           
 int getNumberOfBins()
           
 int getPageCacheSize()
           
 int getPageSize()
           
 int getSize()
          return the size of the index
 int getThreshold()
           
 boolean isEnablePageCaching()
           
 boolean isTransient()
           
 void load()
          load indexes
 StoreEntry remove(Object key)
          remove the index key
 void setEnablePageCaching(boolean enablePageCaching)
           
 void setKeyMarshaller(Marshaller marshaller)
          Set the marshaller for key objects
 void setKeySize(int keySize)
           
 void setLoadFactor(int loadFactor)
           
 void setMaximumCapacity(int maximumCapacity)
           
 void setNumberOfBins(int numberOfBins)
           
 void setPageCacheSize(int pageCacheSize)
           
 void setPageSize(int pageSize)
           
 void setThreshold(int threshold)
           
 void store(Object key, StoreEntry value)
          store the key, item
 String toString()
           
 void unload()
          unload indexes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

DEFAULT_PAGE_SIZE

public static final int DEFAULT_PAGE_SIZE

DEFAULT_KEY_SIZE

public static final int DEFAULT_KEY_SIZE

DEFAULT_BIN_SIZE

public static final int DEFAULT_BIN_SIZE

MAXIMUM_CAPACITY

public static final int MAXIMUM_CAPACITY

DEFAULT_LOAD_FACTOR

public static final int DEFAULT_LOAD_FACTOR
Constructor Detail

HashIndex

public HashIndex(File directory,
                 String name,
                 IndexManager indexManager)
          throws IOException
Constructor

Parameters:
directory -
name -
indexManager -
Throws:
IOException
Method Detail

setKeyMarshaller

public void setKeyMarshaller(Marshaller marshaller)
Set the marshaller for key objects

Specified by:
setKeyMarshaller in interface Index
Parameters:
marshaller -

getKeySize

public int getKeySize()
Specified by:
getKeySize in interface HashIndexMBean
Returns:
the keySize

setKeySize

public void setKeySize(int keySize)
Specified by:
setKeySize in interface HashIndexMBean
Parameters:
keySize - the keySize to set

getPageSize

public int getPageSize()
Specified by:
getPageSize in interface HashIndexMBean
Returns:
the pageSize

setPageSize

public void setPageSize(int pageSize)
Parameters:
pageSize - the pageSize to set

getNumberOfBins

public int getNumberOfBins()
Specified by:
getNumberOfBins in interface HashIndexMBean
Returns:
number of bins

setNumberOfBins

public void setNumberOfBins(int numberOfBins)
Parameters:
numberOfBins -

isEnablePageCaching

public boolean isEnablePageCaching()
Specified by:
isEnablePageCaching in interface HashIndexMBean
Returns:
the enablePageCaching

setEnablePageCaching

public void setEnablePageCaching(boolean enablePageCaching)
Parameters:
enablePageCaching - the enablePageCaching to set

getPageCacheSize

public int getPageCacheSize()
Specified by:
getPageCacheSize in interface HashIndexMBean
Returns:
the pageCacheSize

setPageCacheSize

public void setPageCacheSize(int pageCacheSize)
Parameters:
pageCacheSize - the pageCacheSize to set

isTransient

public boolean isTransient()
Specified by:
isTransient in interface Index
Specified by:
isTransient in interface IndexMBean
Returns:
true if the index is transient

getThreshold

public int getThreshold()
Returns:
the threshold

setThreshold

public void setThreshold(int threshold)
Parameters:
threshold - the threshold to set

getLoadFactor

public int getLoadFactor()
Returns:
the loadFactor

setLoadFactor

public void setLoadFactor(int loadFactor)
Parameters:
loadFactor - the loadFactor to set

getMaximumCapacity

public int getMaximumCapacity()
Returns:
the maximumCapacity

setMaximumCapacity

public void setMaximumCapacity(int maximumCapacity)
Parameters:
maximumCapacity - the maximumCapacity to set

getSize

public int getSize()
Description copied from interface: Index
return the size of the index

Specified by:
getSize in interface HashIndexMBean
Specified by:
getSize in interface Index
Specified by:
getSize in interface IndexMBean
Returns:
size

getActiveBins

public int getActiveBins()
Specified by:
getActiveBins in interface HashIndexMBean
Returns:
the number of active bins

load

public void load()
Description copied from interface: Index
load indexes

Specified by:
load in interface Index

unload

public void unload()
            throws IOException
Description copied from interface: Index
unload indexes

Specified by:
unload in interface Index
Throws:
IOException

store

public void store(Object key,
                  StoreEntry value)
           throws IOException
Description copied from interface: Index
store the key, item

Specified by:
store in interface Index
Throws:
IOException

get

public StoreEntry get(Object key)
               throws IOException
Specified by:
get in interface Index
Returns:
the entry
Throws:
IOException

remove

public StoreEntry remove(Object key)
                  throws IOException
Description copied from interface: Index
remove the index key

Specified by:
remove in interface Index
Returns:
StoreEntry removed
Throws:
IOException

containsKey

public boolean containsKey(Object key)
                    throws IOException
Specified by:
containsKey in interface Index
Returns:
true if it contains the key
Throws:
IOException

clear

public void clear()
           throws IOException
Description copied from interface: Index
clear the index

Specified by:
clear in interface Index
Throws:
IOException

delete

public void delete()
            throws IOException
Description copied from interface: Index
delete all state associated with the index

Specified by:
delete in interface Index
Throws:
IOException

toString

public String toString()
Overrides:
toString in class Object


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