diff --git a/pom.xml b/pom.xml index 3f99a561aa..3767b2e49e 100644 --- a/pom.xml +++ b/pom.xml @@ -69,6 +69,11 @@ chronicle-core + + net.openhft + chronicle-bytes + + net.openhft posix diff --git a/src/main/java/net/openhft/chronicle/hash/impl/VanillaChronicleHash.java b/src/main/java/net/openhft/chronicle/hash/impl/VanillaChronicleHash.java index b56d542cbd..d861754b15 100644 --- a/src/main/java/net/openhft/chronicle/hash/impl/VanillaChronicleHash.java +++ b/src/main/java/net/openhft/chronicle/hash/impl/VanillaChronicleHash.java @@ -224,8 +224,6 @@ public VanillaChronicleHash(@NotNull final ChronicleMapBuilder builder) { preShutdownAction = privateAPI.getPreShutdownAction(); skipCloseOnExitHook = privateAPI.skipCloseOnExitHook(); - - disableThreadSafetyCheck(true); } public static IOException throwRecoveryOrReturnIOException(@NotNull final File file, @@ -934,8 +932,7 @@ private void allocateTierBulk() { globalMutableState.addDataStoreSize(tierBulkSizeInBytes); } - // TODO: x.25 remove throws IOException - public void msync() throws IOException { + public void msync() { throwExceptionIfClosed(); if (persisted()) { @@ -1073,7 +1070,8 @@ private void mapTierBulksMapped(final int upToBulkIndex) throws IOException { * @see net.openhft.chronicle.bytes.MappedFile#acquireByteStore(ReferenceOwner, long, BytesStore, MappedBytesStoreFactory) */ private BytesStore map(long mapSize, final long mappingOffsetInFile) throws IOException { - mapSize = pageAlign(mapSize); + int pageSize = (int) OS.mapAlignment(); + mapSize = pageAlign(mapSize, pageSize); final long minFileSize = mappingOffsetInFile + mapSize; final FileChannel fileChannel = raf.getChannel(); if (fileChannel.size() < minFileSize) { @@ -1094,7 +1092,7 @@ private BytesStore map(long mapSize, final long mappingOffsetInFile) throws IOEx fallocate(mappingOffsetInFile, minFileSize - mappingOffsetInFile); } } - final long address = OS.map(fileChannel, READ_WRITE, mappingOffsetInFile, mapSize); + final long address = OS.map(fileChannel, READ_WRITE, mappingOffsetInFile, mapSize, pageSize); resources.addMemoryResource(address, mapSize); return BytesStore.wrap(address, mapSize); } diff --git a/src/main/java/net/openhft/chronicle/hash/impl/stage/data/bytes/InputKeyBytesData.java b/src/main/java/net/openhft/chronicle/hash/impl/stage/data/bytes/InputKeyBytesData.java index 6fdb3b4a47..e7690eaeb4 100644 --- a/src/main/java/net/openhft/chronicle/hash/impl/stage/data/bytes/InputKeyBytesData.java +++ b/src/main/java/net/openhft/chronicle/hash/impl/stage/data/bytes/InputKeyBytesData.java @@ -26,8 +26,6 @@ import net.openhft.sg.StageRef; import net.openhft.sg.Staged; -import static net.openhft.chronicle.bytes.NoBytesStore.NO_BYTES_STORE; - @Staged public class InputKeyBytesData extends AbstractData { @@ -66,7 +64,7 @@ void initInputKeyBytes() { } void closeInputKeyBytes() { - inputKeyBytes.bytesStore(NO_BYTES_STORE, 0, 0); + inputKeyBytes.bytesStore(BytesStore.empty(), 0, 0); inputKeyBytesUsed = false; } diff --git a/src/main/java/net/openhft/chronicle/hash/impl/util/CanonicalRandomAccessFiles.java b/src/main/java/net/openhft/chronicle/hash/impl/util/CanonicalRandomAccessFiles.java index 3e0a31d37d..87efc65c57 100644 --- a/src/main/java/net/openhft/chronicle/hash/impl/util/CanonicalRandomAccessFiles.java +++ b/src/main/java/net/openhft/chronicle/hash/impl/util/CanonicalRandomAccessFiles.java @@ -16,9 +16,9 @@ package net.openhft.chronicle.hash.impl.util; -import net.openhft.chronicle.core.CleaningRandomAccessFile; import net.openhft.chronicle.core.Jvm; import net.openhft.chronicle.core.OS; +import net.openhft.chronicle.core.io.CleaningRandomAccessFile; import net.openhft.chronicle.hash.ChronicleFileLockException; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; diff --git a/src/main/java/net/openhft/chronicle/hash/serialization/impl/BytesMarshallableDataAccess.java b/src/main/java/net/openhft/chronicle/hash/serialization/impl/BytesMarshallableDataAccess.java index ee2d024526..7f0b30aed8 100644 --- a/src/main/java/net/openhft/chronicle/hash/serialization/impl/BytesMarshallableDataAccess.java +++ b/src/main/java/net/openhft/chronicle/hash/serialization/impl/BytesMarshallableDataAccess.java @@ -94,7 +94,7 @@ public void writeTo(RandomDataOutput target, long targetOffset) { target.capacity() - targetOffset); targetBytes.writePosition(targetOffset); instance.writeMarshallable(targetBytes); - targetBytes.bytesStore(NoBytesStore.NO_BYTES_STORE, 0, 0); + targetBytes.bytesStore(BytesStore.empty(), 0, 0); } } diff --git a/src/main/java/net/openhft/chronicle/hash/serialization/impl/SizedMarshallableDataAccess.java b/src/main/java/net/openhft/chronicle/hash/serialization/impl/SizedMarshallableDataAccess.java index 57b790df36..765ef381c0 100644 --- a/src/main/java/net/openhft/chronicle/hash/serialization/impl/SizedMarshallableDataAccess.java +++ b/src/main/java/net/openhft/chronicle/hash/serialization/impl/SizedMarshallableDataAccess.java @@ -104,7 +104,7 @@ public void writeTo(RandomDataOutput target, long targetOffset) { targetBytes.bytesStore((BytesStore) target, targetOffset, size); targetBytes.writePosition(targetOffset); sizedWriter.write(targetBytes, size, instance); - targetBytes.bytesStore(NoBytesStore.NO_BYTES_STORE, 0, 0); + targetBytes.bytesStore(BytesStore.empty(), 0, 0); } } diff --git a/src/main/java/net/openhft/chronicle/map/impl/CompiledMapIterationContext.java b/src/main/java/net/openhft/chronicle/map/impl/CompiledMapIterationContext.java index 871956cb0d..80639fa492 100644 --- a/src/main/java/net/openhft/chronicle/map/impl/CompiledMapIterationContext.java +++ b/src/main/java/net/openhft/chronicle/map/impl/CompiledMapIterationContext.java @@ -1,64 +1,35 @@ package net.openhft.chronicle.map.impl; -import net.openhft.chronicle.hash.AbstractData; -import net.openhft.chronicle.algo.bytes.Access; -import net.openhft.chronicle.hash.impl.stage.entry.Alloc; -import java.util.ArrayList; -import java.util.function.BiFunction; -import net.openhft.chronicle.hash.impl.BigSegmentHeader; +import net.openhft.chronicle.algo.MemoryUnit; import net.openhft.chronicle.algo.bitset.BitSetFrame; -import net.openhft.chronicle.bytes.Bytes; -import net.openhft.chronicle.bytes.BytesStore; -import net.openhft.chronicle.bytes.BytesUtil; -import net.openhft.chronicle.hash.impl.stage.hash.ChainingInterface; -import net.openhft.chronicle.hash.ChecksumEntry; -import net.openhft.chronicle.hash.impl.stage.entry.ChecksumStrategy; -import net.openhft.chronicle.hash.ChronicleHash; -import net.openhft.chronicle.hash.ChronicleHashCorruption; -import net.openhft.chronicle.map.ChronicleHashCorruptionImpl; -import net.openhft.chronicle.hash.ChronicleHashRecoveryFailedException; -import net.openhft.chronicle.map.ChronicleMap; -import net.openhft.chronicle.set.ChronicleSet; -import net.openhft.chronicle.hash.impl.CompactOffHeapLinearHashTable; -import java.util.ConcurrentModificationException; -import java.util.function.Consumer; -import net.openhft.chronicle.hash.Data; -import net.openhft.chronicle.hash.serialization.DataAccess; -import net.openhft.chronicle.map.ExternalMapQueryContext; -import net.openhft.chronicle.hash.HashEntry; -import net.openhft.chronicle.hash.HashSegmentContext; +import net.openhft.chronicle.algo.bitset.ReusableBitSet; +import net.openhft.chronicle.algo.bitset.SingleThreadedFlatBitSetFrame; +import net.openhft.chronicle.algo.bytes.Access; +import net.openhft.chronicle.algo.hashing.LongHashFunction; +import net.openhft.chronicle.bytes.*; +import net.openhft.chronicle.core.Jvm; import net.openhft.chronicle.core.io.IOTools; +import net.openhft.chronicle.hash.*; +import net.openhft.chronicle.hash.impl.*; +import net.openhft.chronicle.hash.impl.stage.entry.*; +import net.openhft.chronicle.hash.impl.stage.hash.ChainingInterface; +import net.openhft.chronicle.hash.impl.util.Objects; import net.openhft.chronicle.hash.locks.InterProcessDeadLockException; import net.openhft.chronicle.hash.locks.InterProcessLock; -import net.openhft.chronicle.core.Jvm; -import net.openhft.chronicle.hash.impl.stage.entry.KeyHashCode; -import java.util.List; -import net.openhft.chronicle.hash.impl.LocalLockState; -import net.openhft.chronicle.hash.impl.stage.entry.LocksInterface; -import net.openhft.chronicle.algo.hashing.LongHashFunction; -import net.openhft.chronicle.map.MapAbsentEntry; -import net.openhft.chronicle.map.MapContext; -import net.openhft.chronicle.map.MapEntry; -import net.openhft.chronicle.algo.MemoryUnit; -import net.openhft.chronicle.bytes.NoBytesStore; -import net.openhft.chronicle.hash.impl.stage.entry.NoChecksumStrategy; -import org.jetbrains.annotations.NotNull; -import net.openhft.chronicle.hash.impl.util.Objects; -import net.openhft.chronicle.bytes.PointerBytesStore; -import java.util.function.Predicate; -import net.openhft.chronicle.bytes.RandomDataInput; -import net.openhft.chronicle.algo.bitset.ReusableBitSet; -import net.openhft.chronicle.hash.impl.SegmentHeader; -import net.openhft.chronicle.hash.SegmentLock; -import net.openhft.chronicle.set.SetContext; -import net.openhft.chronicle.algo.bitset.SingleThreadedFlatBitSetFrame; +import net.openhft.chronicle.hash.serialization.DataAccess; import net.openhft.chronicle.hash.serialization.SizedReader; -import net.openhft.chronicle.hash.impl.TierCountersArea; +import net.openhft.chronicle.map.*; +import net.openhft.chronicle.set.ChronicleSet; +import net.openhft.chronicle.set.SetContext; +import org.jetbrains.annotations.NotNull; + +import java.util.ArrayList; +import java.util.ConcurrentModificationException; +import java.util.List; import java.util.concurrent.TimeUnit; -import net.openhft.chronicle.bytes.VanillaBytes; -import net.openhft.chronicle.hash.impl.VanillaChronicleHash; -import net.openhft.chronicle.map.VanillaChronicleMap; -import net.openhft.chronicle.hash.VanillaGlobalMutableState; +import java.util.function.BiFunction; +import java.util.function.Consumer; +import java.util.function.Predicate; import static net.openhft.chronicle.hash.impl.LocalLockState.UNLOCKED; @@ -911,8 +882,8 @@ public void doCloseNext() { public void doCloseWrappedValueBytes() { if (!(this.wrappedValueBytesInit())) return ; - - wrappedValueBytes.bytesStore(NoBytesStore.NO_BYTES_STORE, 0, 0); + + wrappedValueBytes.bytesStore(BytesStore.empty(), 0, 0); wrappedValueBytesUsed = false; } @@ -1047,7 +1018,7 @@ void closeWrappedValueBytes() { return ; this.closeWrappedValueBytesDependants(); - wrappedValueBytes.bytesStore(NoBytesStore.NO_BYTES_STORE, 0, 0); + wrappedValueBytes.bytesStore(BytesStore.empty(), 0, 0); wrappedValueBytesUsed = false; } diff --git a/src/main/java/net/openhft/chronicle/map/impl/CompiledMapQueryContext.java b/src/main/java/net/openhft/chronicle/map/impl/CompiledMapQueryContext.java index 5f1a4e8b4c..b46f88a096 100644 --- a/src/main/java/net/openhft/chronicle/map/impl/CompiledMapQueryContext.java +++ b/src/main/java/net/openhft/chronicle/map/impl/CompiledMapQueryContext.java @@ -707,8 +707,8 @@ public void doCloseCachedInputKey() { public void doCloseInputKeyBytes() { if (!(this.inputKeyBytesInit())) return ; - - inputKeyBytes.bytesStore(NoBytesStore.NO_BYTES_STORE, 0, 0); + + inputKeyBytes.bytesStore(BytesStore.empty(), 0, 0); inputKeyBytesUsed = false; } @@ -793,7 +793,7 @@ void closeInputKeyBytes() { return ; this.closeInputKeyBytesDependants(); - inputKeyBytes.bytesStore(NoBytesStore.NO_BYTES_STORE, 0, 0); + inputKeyBytes.bytesStore(BytesStore.empty(), 0, 0); inputKeyBytesUsed = false; } @@ -1155,8 +1155,8 @@ public void doCloseNext() { public void doCloseWrappedValueBytes() { if (!(this.wrappedValueBytesInit())) return ; - - wrappedValueBytes.bytesStore(NoBytesStore.NO_BYTES_STORE, 0, 0); + + wrappedValueBytes.bytesStore(BytesStore.empty(), 0, 0); wrappedValueBytesUsed = false; } @@ -1291,7 +1291,7 @@ void closeWrappedValueBytes() { return ; this.closeWrappedValueBytesDependants(); - wrappedValueBytes.bytesStore(NoBytesStore.NO_BYTES_STORE, 0, 0); + wrappedValueBytes.bytesStore(BytesStore.empty(), 0, 0); wrappedValueBytesUsed = false; } diff --git a/src/main/java/net/openhft/chronicle/map/impl/CompiledReplicatedMapIterationContext.java b/src/main/java/net/openhft/chronicle/map/impl/CompiledReplicatedMapIterationContext.java index a6f7ec4dae..abb6728cd5 100644 --- a/src/main/java/net/openhft/chronicle/map/impl/CompiledReplicatedMapIterationContext.java +++ b/src/main/java/net/openhft/chronicle/map/impl/CompiledReplicatedMapIterationContext.java @@ -1038,8 +1038,8 @@ public void doCloseNext() { public void doCloseWrappedValueBytes() { if (!(this.wrappedValueBytesInit())) return ; - - wrappedValueBytes.bytesStore(NoBytesStore.NO_BYTES_STORE, 0, 0); + + wrappedValueBytes.bytesStore(BytesStore.empty(), 0, 0); wrappedValueBytesUsed = false; } @@ -1186,7 +1186,7 @@ void closeWrappedValueBytes() { return ; this.closeWrappedValueBytesDependants(); - wrappedValueBytes.bytesStore(NoBytesStore.NO_BYTES_STORE, 0, 0); + wrappedValueBytes.bytesStore(BytesStore.empty(), 0, 0); wrappedValueBytesUsed = false; } diff --git a/src/main/java/net/openhft/chronicle/map/impl/CompiledReplicatedMapQueryContext.java b/src/main/java/net/openhft/chronicle/map/impl/CompiledReplicatedMapQueryContext.java index b9364f71b4..1647d40770 100644 --- a/src/main/java/net/openhft/chronicle/map/impl/CompiledReplicatedMapQueryContext.java +++ b/src/main/java/net/openhft/chronicle/map/impl/CompiledReplicatedMapQueryContext.java @@ -736,8 +736,8 @@ public void doCloseCachedInputKey() { public void doCloseInputKeyBytes() { if (!(this.inputKeyBytesInit())) return ; - - inputKeyBytes.bytesStore(NoBytesStore.NO_BYTES_STORE, 0, 0); + + inputKeyBytes.bytesStore(BytesStore.empty(), 0, 0); inputKeyBytesUsed = false; } @@ -822,7 +822,7 @@ void closeInputKeyBytes() { return ; this.closeInputKeyBytesDependants(); - inputKeyBytes.bytesStore(NoBytesStore.NO_BYTES_STORE, 0, 0); + inputKeyBytes.bytesStore(BytesStore.empty(), 0, 0); inputKeyBytesUsed = false; } @@ -1215,8 +1215,8 @@ public void doCloseNext() { public void doCloseWrappedValueBytes() { if (!(this.wrappedValueBytesInit())) return ; - - wrappedValueBytes.bytesStore(NoBytesStore.NO_BYTES_STORE, 0, 0); + + wrappedValueBytes.bytesStore(BytesStore.empty(), 0, 0); wrappedValueBytesUsed = false; } @@ -1351,7 +1351,7 @@ void closeWrappedValueBytes() { return ; this.closeWrappedValueBytesDependants(); - wrappedValueBytes.bytesStore(NoBytesStore.NO_BYTES_STORE, 0, 0); + wrappedValueBytes.bytesStore(BytesStore.empty(), 0, 0); wrappedValueBytesUsed = false; } diff --git a/src/main/java/net/openhft/chronicle/map/impl/stage/data/ZeroBytesStore.java b/src/main/java/net/openhft/chronicle/map/impl/stage/data/ZeroBytesStore.java index a48a13c6c0..10d17ee04d 100644 --- a/src/main/java/net/openhft/chronicle/map/impl/stage/data/ZeroBytesStore.java +++ b/src/main/java/net/openhft/chronicle/map/impl/stage/data/ZeroBytesStore.java @@ -158,11 +158,6 @@ public boolean compareAndSwapLong(long offset, long expected, long value) { return true; } - @Override - public byte[] internalNumberBuffer() { - throw new UnsupportedOperationException(); - } - @Override public void reserve(ReferenceOwner id) throws IllegalStateException { } @@ -172,11 +167,6 @@ public boolean tryReserve(ReferenceOwner id) throws IllegalStateException { return false; } - @Override - public boolean reservedBy(ReferenceOwner owner) { - return true; - } - @Override public void release(ReferenceOwner id) throws IllegalStateException { } diff --git a/src/main/java/net/openhft/chronicle/map/impl/stage/data/bytes/WrappedValueBytesData.java b/src/main/java/net/openhft/chronicle/map/impl/stage/data/bytes/WrappedValueBytesData.java index 9144f0e2d6..3be42da23e 100644 --- a/src/main/java/net/openhft/chronicle/map/impl/stage/data/bytes/WrappedValueBytesData.java +++ b/src/main/java/net/openhft/chronicle/map/impl/stage/data/bytes/WrappedValueBytesData.java @@ -26,8 +26,6 @@ import net.openhft.sg.StageRef; import net.openhft.sg.Staged; -import static net.openhft.chronicle.bytes.NoBytesStore.NO_BYTES_STORE; - @Staged public class WrappedValueBytesData extends AbstractData { @@ -95,7 +93,7 @@ void initWrappedValueBytes() { } void closeWrappedValueBytes() { - wrappedValueBytes.bytesStore(NO_BYTES_STORE, 0, 0); + wrappedValueBytes.bytesStore(BytesStore.empty(), 0, 0); wrappedValueBytesUsed = false; } diff --git a/src/test/java/net/openhft/chronicle/map/CHMUseCasesTest.java b/src/test/java/net/openhft/chronicle/map/CHMUseCasesTest.java index b3cb6d0cb5..9aabf146f1 100644 --- a/src/test/java/net/openhft/chronicle/map/CHMUseCasesTest.java +++ b/src/test/java/net/openhft/chronicle/map/CHMUseCasesTest.java @@ -1207,7 +1207,7 @@ public void testByteBufferDirectByteBufferMap() .asReadOnlyBuffer(); final ByteBuffer key2 = ByteBuffer.wrap(new byte[]{2, 2, 2, 2}); - // Apparently, asReadOnlyBuffer cannot be used as keys because the backing array cannot be exposed; + // Apparently, asReadOnlyBuffer cannot be used as keys because the backing array cannot be exposed; final ByteBuffer value1 = ((ByteBuffer) ByteBuffer.allocateDirect(4) .put(new byte[]{11, 11, 11, 11}) diff --git a/src/test/java/net/openhft/chronicle/map/MemoryLeaksTest.java b/src/test/java/net/openhft/chronicle/map/MemoryLeaksTest.java index 60278fabd6..5c2da25f82 100644 --- a/src/test/java/net/openhft/chronicle/map/MemoryLeaksTest.java +++ b/src/test/java/net/openhft/chronicle/map/MemoryLeaksTest.java @@ -17,7 +17,6 @@ package net.openhft.chronicle.map; import com.google.common.collect.Lists; -import net.openhft.chronicle.bytes.NoBytesStore; import net.openhft.chronicle.core.Jvm; import net.openhft.chronicle.core.OS; import net.openhft.chronicle.core.values.IntValue; @@ -91,11 +90,6 @@ private static String named(final List flags) { (!flags.get(2) ? "not " : "") + "closed within context"; } - @Before - public void initNoBytesStore() { - Assert.assertNotEquals(0, NoBytesStore.NO_PAGE); - } - @Before public void resetSerializerCount() { System.err.println("This test is expect to print 'ChronicleMap ... is not closed manually, cleaned up from Cleaner'"); @@ -120,8 +114,11 @@ public void testChronicleMapCollectedAndDirectMemoryReleased() throws IOExceptio // the purpose of the test is to find maps which are not closed properly. ChronicleMap map = getMap(); long expectedNativeMemory = nativeMemoryUsedBeforeMap + map.offHeapMemoryUsed(); - assertEquals(expectedNativeMemory, nativeMemoryUsed()); - tryCloseFromContext(map); + try { + assertEquals(expectedNativeMemory, nativeMemoryUsed()); + } finally { + tryCloseFromContext(map); + } WeakReference> ref = new WeakReference<>(map); Assert.assertNotNull(ref.get()); //noinspection UnusedAssignment diff --git a/src/test/java/net/openhft/chronicle/map/channel/PerfMapHandlerMain.java b/src/test/java/net/openhft/chronicle/map/channel/PerfMapHandlerMain.java index aba04f4dab..1ecdedb731 100644 --- a/src/test/java/net/openhft/chronicle/map/channel/PerfMapHandlerMain.java +++ b/src/test/java/net/openhft/chronicle/map/channel/PerfMapHandlerMain.java @@ -4,10 +4,10 @@ import net.openhft.chronicle.bytes.Bytes; import net.openhft.chronicle.bytes.MethodReader; import net.openhft.chronicle.core.Jvm; -import net.openhft.chronicle.core.Mocker; import net.openhft.chronicle.core.OS; import net.openhft.chronicle.core.io.Closeable; import net.openhft.chronicle.core.io.IORuntimeException; +import net.openhft.chronicle.core.util.Mocker; import net.openhft.chronicle.hash.serialization.impl.BytesMarshallableReaderWriter; import net.openhft.chronicle.hash.serialization.impl.BytesSizedMarshaller; import net.openhft.chronicle.jlbh.JLBH; diff --git a/src/test/java/net/openhft/chronicle/map/ipc/StateMachineData.java b/src/test/java/net/openhft/chronicle/map/ipc/StateMachineData.java index fbcbb13677..efdc36696f 100644 --- a/src/test/java/net/openhft/chronicle/map/ipc/StateMachineData.java +++ b/src/test/java/net/openhft/chronicle/map/ipc/StateMachineData.java @@ -19,6 +19,9 @@ import net.openhft.chronicle.bytes.Byteable; import net.openhft.chronicle.bytes.BytesStore; +import java.io.IOException; +import java.nio.channels.FileLock; + /** * */ @@ -160,4 +163,14 @@ public long offset() { public long maxSize() { return 16; } + + @Override + public FileLock lock(boolean shared) throws IOException { + throw new UnsupportedOperationException(); + } + + @Override + public FileLock tryLock(boolean shared) throws IOException { + throw new UnsupportedOperationException(); + } } diff --git a/src/test/java/net/openhft/lang/values/DoubleArray.java b/src/test/java/net/openhft/lang/values/DoubleArray.java index 8bc921c0b0..bb53914d80 100644 --- a/src/test/java/net/openhft/lang/values/DoubleArray.java +++ b/src/test/java/net/openhft/lang/values/DoubleArray.java @@ -21,6 +21,9 @@ import net.openhft.chronicle.bytes.DynamicallySized; import net.openhft.chronicle.values.Copyable; +import java.io.IOException; +import java.nio.channels.FileLock; + /** * Created by peter.lawrey on 23/04/2015. */ @@ -62,6 +65,16 @@ public long maxSize() { return BASE + capacity * 8; } + @Override + public FileLock lock(boolean shared) throws IOException { + throw new UnsupportedOperationException(); + } + + @Override + public FileLock tryLock(boolean shared) throws IOException { + throw new UnsupportedOperationException(); + } + public int length() { return HACK && bs == null ? 6 * 8 : bs.readInt(LENGTH + offset); }