mirror of
https://github.com/OpenHFT/Chronicle-Map.git
synced 2021-09-13 01:26:12 +00:00
HCOLL-194 Code tidy.
This commit is contained in:
@@ -37,8 +37,7 @@ public interface ChronicleHash extends Closeable {
|
||||
*
|
||||
* @return the file this {@link ChronicleMap} or {@link ChronicleSet} is mapped to,
|
||||
* or {@code null} if it is not mapped to any file
|
||||
* @see ChronicleHashBuilder#file(java.io.File)
|
||||
* @see ChronicleHashBuilder#create()
|
||||
* @see ChronicleHashBuilder#createPersistedTo(java.io.File)
|
||||
*/
|
||||
File file();
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ import java.io.Serializable;
|
||||
* } else {
|
||||
* res = new LongPair[resLen];
|
||||
* }
|
||||
* for (int i = 0; i < resLen; i++) {
|
||||
* for (int i = 0; i < resLen; i++) {
|
||||
* LongPair pair = res[i];
|
||||
* if (pair == null)
|
||||
* res[i] = pair = new LongPair();
|
||||
|
||||
@@ -390,16 +390,20 @@ public abstract class AbstractChronicleMapBuilder<K, V,
|
||||
if (entries <= power * power * power)
|
||||
return power;
|
||||
}
|
||||
long size = entrySize * entries;
|
||||
if (size < 20L * 1000 * 1000) // 20 MB
|
||||
long size = (entrySize + 32) * entries;
|
||||
if (size < 10L * 1000 * 1000) // 10 MB
|
||||
return 64;
|
||||
if (size < 200L * 1000 * 1000) // 200 MB
|
||||
if (size < 100L * 1000 * 1000) // 100 MB
|
||||
return 128;
|
||||
if (size < 800L * 1000 * 1000) // 800 MB
|
||||
if (size < 400L * 1000 * 1000) // 400 MB
|
||||
return 256;
|
||||
if (size < 2L * 1000 * 1000 * 1000) // 2 GB
|
||||
if (size < 1L * 1000 * 1000 * 1000) // 1 GB
|
||||
return 512;
|
||||
return 1024;
|
||||
if (size < 10L * 1000 * 1000 * 1000) // 10 GB
|
||||
return 1024;
|
||||
if (size < 100L * 1000 * 1000 * 1000) // 100 GB
|
||||
return 2048;
|
||||
return 4096;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -25,13 +25,15 @@ public final class OffHeapUpdatableChronicleMapBuilder<K, V>
|
||||
|
||||
public static <K, V> OffHeapUpdatableChronicleMapBuilder<K, V> of(
|
||||
@NotNull Class<K> keyClass, @NotNull Class<V> valueClass) {
|
||||
if (!offHeapReference(valueClass)) {
|
||||
if (!valueClass.isInterface()) {
|
||||
throw new IllegalArgumentException(
|
||||
"Value class should be either Byteable subclass or interface," +
|
||||
"allowing direct Byteable implementation generation");
|
||||
}
|
||||
if (keyClass.isInterface() && keyClass != CharSequence.class) {
|
||||
keyClass = DataValueClasses.directClassFor(keyClass);
|
||||
}
|
||||
if (valueClass.isInterface()) {
|
||||
valueClass = DataValueClasses.directClassFor(valueClass);
|
||||
} else if (!offHeapReference(valueClass)) {
|
||||
throw new IllegalArgumentException(
|
||||
"Value class should be either Byteable subclass or interface," +
|
||||
"allowing direct Byteable implementation generation");
|
||||
}
|
||||
return new OffHeapUpdatableChronicleMapBuilder<K, V>(keyClass, valueClass);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user