Search in sources :

Example 1 with NonLocalRegionEntry

use of org.apache.geode.internal.cache.NonLocalRegionEntry in project geode by apache.

the class GetEntryCommand method getValueAndIsObject.

@Override
public void getValueAndIsObject(Region p_region, Object key, Object callbackArg, ServerConnection servConn, Object[] result) {
    Object data = null;
    LocalRegion region = (LocalRegion) p_region;
    Entry entry = region.getEntry(key);
    if (logger.isDebugEnabled()) {
        logger.debug("GetEntryCommand: for key: {} returning entry: {}", key, entry);
    }
    if (entry != null) {
        EntrySnapshot snap = new EntrySnapshot();
        NonLocalRegionEntry re = new NonLocalRegionEntry(entry, region);
        snap.setRegionEntry(re);
        snap.setRegion(region);
        data = snap;
    }
    result[0] = data;
    // isObject is true
    result[1] = true;
}
Also used : Entry(org.apache.geode.cache.Region.Entry) NonLocalRegionEntry(org.apache.geode.internal.cache.NonLocalRegionEntry) LocalRegion(org.apache.geode.internal.cache.LocalRegion) NonLocalRegionEntry(org.apache.geode.internal.cache.NonLocalRegionEntry) EntrySnapshot(org.apache.geode.internal.cache.EntrySnapshot)

Example 2 with NonLocalRegionEntry

use of org.apache.geode.internal.cache.NonLocalRegionEntry in project geode by apache.

the class GetEntry70 method getValueAndIsObject.

@Override
public Get70.Entry getValueAndIsObject(Region region, Object key, Object callbackArg, ServerConnection servConn) {
    LocalRegion lregion = (LocalRegion) region;
    Object data = null;
    Region.Entry entry = region.getEntry(key);
    if (logger.isDebugEnabled()) {
        logger.debug("GetEntryCommand: for key: {} returning entry: {}", key, entry);
    }
    VersionTag tag = null;
    if (entry != null) {
        EntrySnapshot snap = new EntrySnapshot();
        NonLocalRegionEntry re = new NonLocalRegionEntry(entry, lregion);
        snap.setRegionEntry(re);
        snap.setRegion(lregion);
        data = snap;
        tag = snap.getVersionTag();
    }
    Get70.Entry result = new Get70.Entry();
    result.value = data;
    result.isObject = true;
    result.keyNotPresent = false;
    result.versionTag = tag;
    return result;
}
Also used : Entry(org.apache.geode.cache.Region.Entry) NonLocalRegionEntry(org.apache.geode.internal.cache.NonLocalRegionEntry) Entry(org.apache.geode.cache.Region.Entry) VersionTag(org.apache.geode.internal.cache.versions.VersionTag) Region(org.apache.geode.cache.Region) LocalRegion(org.apache.geode.internal.cache.LocalRegion) LocalRegion(org.apache.geode.internal.cache.LocalRegion) NonLocalRegionEntry(org.apache.geode.internal.cache.NonLocalRegionEntry) EntrySnapshot(org.apache.geode.internal.cache.EntrySnapshot)

Aggregations

Entry (org.apache.geode.cache.Region.Entry)2 EntrySnapshot (org.apache.geode.internal.cache.EntrySnapshot)2 LocalRegion (org.apache.geode.internal.cache.LocalRegion)2 NonLocalRegionEntry (org.apache.geode.internal.cache.NonLocalRegionEntry)2 Region (org.apache.geode.cache.Region)1 VersionTag (org.apache.geode.internal.cache.versions.VersionTag)1