Beispiel #1
0
  public synchronized <K> NavigableSet<K> createTreeSet(
      String name, Comparator<K> keyComparator, Serializer<K> keySerializer) {
    try {
      assertNameNotExist(name);
      BTree<K, Object> tree = BTree.createInstance(this, keyComparator, keySerializer, null, false);
      setNamedObject(name, tree.getRecid());
      BTreeSet<K> ret = new BTreeSet<K>(new BTreeMap(tree, false));
      collections.put(name, new WeakReference<Object>(ret));
      return ret;

    } catch (IOException e) {
      throw new IOError(e);
    }
  }
Beispiel #2
0
 public synchronized <K, V> ConcurrentNavigableMap<K, V> createTreeMap(
     String name,
     Comparator<K> keyComparator,
     Serializer<K> keySerializer,
     Serializer<V> valueSerializer) {
   try {
     assertNameNotExist(name);
     BTree<K, V> tree =
         BTree.createInstance(this, keyComparator, keySerializer, valueSerializer, true);
     setNamedObject(name, tree.getRecid());
     ConcurrentNavigableMap<K, V> ret =
         new BTreeMap<K, V>(tree, false); // TODO put readonly flag here
     collections.put(name, new WeakReference<Object>(ret));
     return ret;
   } catch (IOException e) {
     throw new IOError(e);
   }
 }