Search in sources :

Example 1 with FetchVersionResponse

use of org.apache.geode.internal.cache.RemoteFetchVersionMessage.FetchVersionResponse in project geode by apache.

the class DistributedRegion method fetchRemoteVersionTag.

/**
   * Fetch Version for the given key from a remote replicate member.
   * 
   * @throws EntryNotFoundException if the entry is not found on replicate member
   * @return VersionTag for the key
   */
protected VersionTag fetchRemoteVersionTag(Object key) {
    VersionTag tag = null;
    assert this.dataPolicy != DataPolicy.REPLICATE;
    final TXStateProxy tx = cache.getTXMgr().internalSuspend();
    try {
        boolean retry = true;
        InternalDistributedMember member = getRandomReplicate();
        while (retry) {
            try {
                if (member == null) {
                    break;
                }
                FetchVersionResponse response = RemoteFetchVersionMessage.send(member, this, key);
                tag = response.waitForResponse();
                retry = false;
            } catch (RemoteOperationException e) {
                member = getRandomReplicate();
                if (member != null) {
                    if (logger.isDebugEnabled()) {
                        logger.debug("Retrying RemoteFetchVersionMessage on member:{}", member);
                    }
                }
            }
        }
    } finally {
        if (tx != null) {
            cache.getTXMgr().internalResume(tx);
        }
    }
    return tag;
}
Also used : InternalDistributedMember(org.apache.geode.distributed.internal.membership.InternalDistributedMember) VersionTag(org.apache.geode.internal.cache.versions.VersionTag) FetchVersionResponse(org.apache.geode.internal.cache.RemoteFetchVersionMessage.FetchVersionResponse)

Aggregations

InternalDistributedMember (org.apache.geode.distributed.internal.membership.InternalDistributedMember)1 FetchVersionResponse (org.apache.geode.internal.cache.RemoteFetchVersionMessage.FetchVersionResponse)1 VersionTag (org.apache.geode.internal.cache.versions.VersionTag)1