Search in sources :

Example 1 with NonExistenceResponse

use of com.ms.silverking.cloud.dht.NonExistenceResponse in project SilverKing by Morgan-Stanley.

the class AsyncRetrievalOperationImpl method isFailure.

@Override
protected boolean isFailure(OpResult result) {
    switch(result) {
        case MULTIPLE:
            // multiple will only be called when checking completion of the entire operation
            // others will be called key-by-key also
            // filter no such value errors to allow for users to override
            // all other failures result in a failure
            NonExistenceResponse nonExistenceResponse;
            nonExistenceResponse = getNonExistenceResponse();
            for (OpResult _result : allResults) {
                if (_result.hasFailed(nonExistenceResponse)) {
                    return true;
                }
            }
            return false;
        case TIMEOUT:
            RetrievalOptions retrievalOptions;
            retrievalOptions = retrievalOperation.retrievalOptions();
            if (retrievalOptions.getWaitMode() == WaitMode.WAIT_FOR && ((WaitOptions) retrievalOptions).getTimeoutResponse() == TimeoutResponse.IGNORE) {
                return false;
            } else {
                return result.hasFailed();
            }
        default:
            return result.hasFailed(getNonExistenceResponse());
    }
}
Also used : RetrievalOptions(com.ms.silverking.cloud.dht.RetrievalOptions) InternalRetrievalOptions(com.ms.silverking.cloud.dht.common.InternalRetrievalOptions) OpResult(com.ms.silverking.cloud.dht.common.OpResult) WaitOptions(com.ms.silverking.cloud.dht.WaitOptions) NonExistenceResponse(com.ms.silverking.cloud.dht.NonExistenceResponse)

Aggregations

NonExistenceResponse (com.ms.silverking.cloud.dht.NonExistenceResponse)1 RetrievalOptions (com.ms.silverking.cloud.dht.RetrievalOptions)1 WaitOptions (com.ms.silverking.cloud.dht.WaitOptions)1 InternalRetrievalOptions (com.ms.silverking.cloud.dht.common.InternalRetrievalOptions)1 OpResult (com.ms.silverking.cloud.dht.common.OpResult)1