예제 #1
0
파일: DBAbstract.java 프로젝트: joval/JDBM3
  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);
    }
  }
예제 #2
0
파일: DBAbstract.java 프로젝트: joval/JDBM3
 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);
   }
 }