Search in sources :

Example 21 with ListEngineRecord

use of im.actor.runtime.storage.ListEngineRecord in project actor-platform by actorapp.

the class MemoryListEngine method loadValue.

private T loadValue(long key) {
    T res = cache.lookup(key);
    if (res != null) {
        return res;
    }
    ListEngineRecord record = storage.loadItem(key);
    if (record == null) {
        return null;
    }
    try {
        res = creator.createInstance();
        res.parse(new BserValues(BserParser.deserialize(new DataInput(record.getData()))));
    } catch (IOException e) {
        e.printStackTrace();
        return null;
    }
    cache.onObjectLoaded(key, res);
    return res;
}
Also used : DataInput(im.actor.runtime.bser.DataInput) ListEngineRecord(im.actor.runtime.storage.ListEngineRecord) BserValues(im.actor.runtime.bser.BserValues) IOException(java.io.IOException)

Aggregations

ListEngineRecord (im.actor.runtime.storage.ListEngineRecord)21 ArrayList (java.util.ArrayList)11 IOException (java.io.IOException)8 AutoreleasePool (com.google.j2objc.annotations.AutoreleasePool)4 Cursor (android.database.Cursor)3 BserValues (im.actor.runtime.bser.BserValues)1 DataInput (im.actor.runtime.bser.DataInput)1 List (java.util.List)1