mirror of
https://github.com/OpenHFT/Chronicle-Map.git
synced 2021-09-13 01:26:12 +00:00
Ensure HeapBytesStore has final fields for correct visibility, https://github.com/OpenHFT/Chronicle-Wire/issues/137
This commit is contained in:
Regular → Executable
+3
-3
@@ -43,7 +43,7 @@ public class ByteArrayDataAccess extends AbstractData<byte[]> implements DataAcc
|
||||
}
|
||||
|
||||
private void initTransients() {
|
||||
bs = HeapBytesStore.uninitialized();
|
||||
bs = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -77,14 +77,14 @@ public class ByteArrayDataAccess extends AbstractData<byte[]> implements DataAcc
|
||||
@Override
|
||||
public Data<byte[]> getData(@NotNull byte[] instance) {
|
||||
array = instance;
|
||||
bs.init(instance);
|
||||
bs = HeapBytesStore.wrap(array);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uninit() {
|
||||
array = null;
|
||||
bs.uninit();
|
||||
bs = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Regular → Executable
+1
-6
@@ -32,7 +32,6 @@ public class ByteBufferDataAccess extends AbstractData<ByteBuffer>
|
||||
implements DataAccess<ByteBuffer> {
|
||||
|
||||
// Cache fields
|
||||
private transient HeapBytesStore heapBytesStore;
|
||||
private transient NativeBytesStore nativeBytesStore;
|
||||
private transient VanillaBytes<Void> bytes;
|
||||
|
||||
@@ -45,7 +44,6 @@ public class ByteBufferDataAccess extends AbstractData<ByteBuffer>
|
||||
}
|
||||
|
||||
private void initTransients() {
|
||||
heapBytesStore = HeapBytesStore.uninitialized();
|
||||
nativeBytesStore = NativeBytesStore.uninitialized();
|
||||
bytes = VanillaBytes.vanillaBytes();
|
||||
}
|
||||
@@ -91,8 +89,7 @@ public class ByteBufferDataAccess extends AbstractData<ByteBuffer>
|
||||
nativeBytesStore.init(instance, false);
|
||||
bytesStore = nativeBytesStore;
|
||||
} else {
|
||||
heapBytesStore.init(instance);
|
||||
bytesStore = heapBytesStore;
|
||||
bytesStore = HeapBytesStore.wrap(instance);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
@@ -102,8 +99,6 @@ public class ByteBufferDataAccess extends AbstractData<ByteBuffer>
|
||||
bb = null;
|
||||
if (bytesStore == nativeBytesStore) {
|
||||
nativeBytesStore.uninit();
|
||||
} else {
|
||||
heapBytesStore.uninit();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,12 @@ public enum ZeroBytesStore implements BytesStore<ZeroBytesStore, Void> {
|
||||
|
||||
@Override
|
||||
public long addressForWrite(long offset) throws UnsupportedOperationException, BufferOverflowException {
|
||||
throw new UnsupportedOperationException("todo");
|
||||
throw new UnsupportedOperationException("Cannot get the address of nothing");
|
||||
}
|
||||
|
||||
@Override
|
||||
public long addressForWritePosition() throws UnsupportedOperationException, BufferOverflowException {
|
||||
throw new UnsupportedOperationException("Cannot get the address of nothing");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user