use of org.qi4j.library.locking.ReadLock in project qi4j-sdk by Qi4j.
the class JdbmEntityStoreMixin method get.
@ReadLock
@Override
public Reader get(EntityReference entityReference) throws EntityStoreException {
try {
Long stateIndex = getStateIndex(entityReference.identity());
if (stateIndex == null) {
throw new EntityNotFoundException(entityReference);
}
byte[] serializedState = (byte[]) recordManager.fetch(stateIndex, serializer);
if (serializedState == null) {
throw new EntityNotFoundException(entityReference);
}
return new StringReader(new String(serializedState, "UTF-8"));
} catch (IOException e) {
throw new EntityStoreException(e);
}
}
Aggregations