@SuppressWarnings("unchecked") @Override protected void getAsync(UserTObject object, Object key, FutureWithCallback<Object> future) { if (object.getSharedVersion_objectfabric().getUnion() instanceof Record) { long record = getOrFetchRecord(object.getSharedVersion_objectfabric()); if (Record.isStored(record)) { BTree tree = BTree.load(getRecordManager(), record, false); _writer.write(key); byte[] data = new byte[_writer.getOffset()]; PlatformAdapter.arraycopy(_writer.getBuffer(), 0, data, 0, data.length); long id = tree.fetch(data); if (id != 0) { data = getRecordManager().fetch(id); Object value = _reader.read(data); _reader.readVersions(); Version version = _reader.getOrCreateVersion(object); TKeyedEntry entry = new TKeyedEntry(key, TKeyed.hash(key), value, false); if (Debug.ENABLED) Debug.assertion(value != TKeyedEntry.REMOVAL); ((LazyMapVersion) version).putEntry(key, entry, true, true); _reader.importVersions(); future.set(value); return; } } } future.set(null); }
private final byte[] writeObject(Object object) { _writer.write(object); byte[] data = new byte[_writer.getOffset()]; PlatformAdapter.arraycopy(_writer.getBuffer(), 0, data, 0, data.length); return data; }