org.apache.accumulo.server.tabletserver
Class NativeMap

java.lang.Object
  extended by org.apache.accumulo.server.tabletserver.NativeMap
All Implemented Interfaces:
java.lang.Iterable<java.util.Map.Entry<Key,Value>>

public class NativeMap
extends java.lang.Object
implements java.lang.Iterable<java.util.Map.Entry<Key,Value>>

This class stores data in a C++ map. Doing this allows us to store more in memory and avoid pauses caused by Java GC. The strategy for dealing with native memory allocated for the native map is that java code using the native map should call delete() as soon as it is finished using the native map. When the NativeMap object is garbage collected its native resources will be released if needed. However waiting for java GC would be a mistake for long lived NativeMaps. Long lived objects are not garbage collected quickly, therefore a process could easily use too much memory.


Constructor Summary
NativeMap()
           
 
Method Summary
 void delete()
           
protected  void finalize()
           
 Value get(Key key)
           
 long getMemoryUsed()
           
static java.lang.String getNativeLibPath()
           
 java.util.Iterator<java.util.Map.Entry<Key,Value>> iterator()
           
 java.util.Iterator<java.util.Map.Entry<Key,Value>> iterator(Key startKey)
           
static boolean loadedNativeLibraries()
           
static void loadNativeLib(java.lang.String nativeLib)
           
 void mutate(java.util.List<Mutation> mutations, int mutationCount)
           
 void mutate(Mutation mutation, int mutationCount)
           
 void put(Key key, Value value)
           
 int size()
           
 SortedKeyValueIterator<Key,Value> skvIterator()
           
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NativeMap

public NativeMap()
Method Detail

getNativeLibPath

public static java.lang.String getNativeLibPath()

loadNativeLib

public static void loadNativeLib(java.lang.String nativeLib)

loadedNativeLibraries

public static boolean loadedNativeLibraries()

finalize

protected void finalize()
                 throws java.lang.Throwable
Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable

mutate

public void mutate(Mutation mutation,
                   int mutationCount)

mutate

public void mutate(java.util.List<Mutation> mutations,
                   int mutationCount)

put

public void put(Key key,
                Value value)

get

public Value get(Key key)

size

public int size()

getMemoryUsed

public long getMemoryUsed()

iterator

public java.util.Iterator<java.util.Map.Entry<Key,Value>> iterator()
Specified by:
iterator in interface java.lang.Iterable<java.util.Map.Entry<Key,Value>>

iterator

public java.util.Iterator<java.util.Map.Entry<Key,Value>> iterator(Key startKey)

delete

public void delete()

skvIterator

public SortedKeyValueIterator<Key,Value> skvIterator()


Copyright © 2012 The Apache Software Foundation. All Rights Reserved.