/* * Copyright (c) 2012 Jan Kotek * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package org.mapdb; import java.io.Closeable; import java.io.DataInput; import java.io.DataOutput; import java.io.IOException; import java.lang.ref.WeakReference; import java.util.*; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.CountDownLatch; import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.ReentrantReadWriteLock; import java.util.logging.Level; import java.util.logging.Logger; /** * Thread safe concurrent HashMap *
* This map uses full 32bit hash from beginning, There is no initial load factor and rehash. * Technically it is not hash table, but hash tree with nodes expanding when they become full. * * This map is suitable for number of records 1e9 and over. * Larger number of records will increase hash collisions and performance * will degrade linearly with number of records (separate chaining). * * Concurrent scalability is achieved by splitting HashMap into 16 segments, each with separate lock. * Very similar to {@link java.util.concurrent.ConcurrentHashMap} * * @author Jan Kotek */ @SuppressWarnings({ "unchecked", "rawtypes" }) public class HTreeMap
* Maintaining snapshot have some overhead, underlying Engine is closed after Map view is GCed.
* Please make sure to release reference to this Map view, so snapshot view can be garbage collected.
*
* @return snapshot
*/
public Map