當前位置: 首頁>>代碼示例>>Java>>正文


Java ObjectDoesNotExistException類代碼示例

本文整理匯總了Java中com.amazonaws.mturk.service.exception.ObjectDoesNotExistException的典型用法代碼示例。如果您正苦於以下問題:Java ObjectDoesNotExistException類的具體用法?Java ObjectDoesNotExistException怎麽用?Java ObjectDoesNotExistException使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ObjectDoesNotExistException類屬於com.amazonaws.mturk.service.exception包,在下文中一共展示了ObjectDoesNotExistException類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getTask

import com.amazonaws.mturk.service.exception.ObjectDoesNotExistException; //導入依賴的package包/類
public ITask getTask(String taskId)
    {
        String name = "getTask";
        int waittime = 2;
        while (true) {
            synchronized (service) {
                try {
                    HIT hit = service.getHIT(taskId);
//                    LOGGER.info(String.format("Retrieved HIT %s", hit.getHITId()));
                    return new MturkTask(hit);
                } catch (InternalServiceException ise) {
                    if (overTime(name, waittime)) {
                        LOGGER.error(String.format("%s ran over time", name));
                        return null;
                    }
                    LOGGER.warn(format("{0} {1}", name, ise));
                    chill(waittime);
                    waittime *= 2;
                } catch (ObjectDoesNotExistException odnee) {
                    LOGGER.warn(format("{0} {1}", name, odnee));
                }
            }
        }
    }
 
開發者ID:SurveyMan,項目名稱:Runner,代碼行數:25,代碼來源:MturkResponseManager.java

示例2: makeTaskUnavailable

import com.amazonaws.mturk.service.exception.ObjectDoesNotExistException; //導入依賴的package包/類
@Override
public boolean makeTaskUnavailable(
        ITask task)
{
    String name = "expireHIT";
    while (true){
        synchronized (service) {
            try{
                service.forceExpireHIT(task.getTaskId());
                return true;
            }catch(InternalServiceException ise){
              LOGGER.warn(MessageFormat.format("{0} {1}", name, ise));
              chill(1);
            }catch(ObjectDoesNotExistException odne) {
              LOGGER.warn(MessageFormat.format("{0} {1}", name, odne));
              return false;
            }
        }
    }
}
 
開發者ID:SurveyMan,項目名稱:Runner,代碼行數:21,代碼來源:MturkResponseManager.java

示例3: numAvailableAssignments

import com.amazonaws.mturk.service.exception.ObjectDoesNotExistException; //導入依賴的package包/類
int numAvailableAssignments(ITask task) {
    String name = "availableAssignments";
    while (true){
        synchronized (service) {
            try{
                HIT hit = service.getHIT(task.getTaskId());
                return hit.getNumberOfAssignmentsAvailable();
            }catch(InternalServiceException ise){
                LOGGER.warn(MessageFormat.format("{0} {1}", name, ise));
                chill(1);
            }catch(ObjectDoesNotExistException odne) {
                LOGGER.warn(MessageFormat.format("{0} {1}", name, odne));
                return 0;
            }
        }
    }
}
 
開發者ID:SurveyMan,項目名稱:Runner,代碼行數:18,代碼來源:MturkResponseManager.java

示例4: approveAssignment

import com.amazonaws.mturk.service.exception.ObjectDoesNotExistException; //導入依賴的package包/類
private boolean approveAssignment(String assignmentId) {
    Class clz = new Object(){}.getClass();
    int waittime = 1;
    while (true) {
        synchronized (service) {
            try {
                service.approveAssignment(assignmentId, "Thank you.");
                return true;
            } catch (InternalServiceException ise) {
                if (waittime > maxWaitTimeInSeconds) {
                    String msg = String.format("WARNING: Exceeded max wait time in %s.%s..."
                            , clz.getEnclosingClass().getName()
                            , clz.getEnclosingMethod().getName());
                    LOGGER.warn(msg);
                    System.err.println(msg);
                }
                chill(waittime);
                waittime *= 2;
            } catch(ObjectDoesNotExistException odne) {
                LOGGER.warn(MessageFormat.format("{0} {1}", clz, odne));
                return false;
            }
        }
    }
}
 
開發者ID:SurveyMan,項目名稱:Runner,代碼行數:26,代碼來源:MturkResponseManager.java

示例5: addAssignments

import com.amazonaws.mturk.service.exception.ObjectDoesNotExistException; //導入依賴的package包/類
ITask addAssignments(ITask task, int n) {
    Class name = new Object(){}.getClass();
    int waittime = 1;
    while (true){
        synchronized (service) {
            try {
                String id = task.getTaskId();
                service.extendHIT(id, n, minExpirationIncrementInSeconds);
                return task;
            } catch(InternalServiceException ise){
                LOGGER.warn(MessageFormat.format("{0} {1}; error codes: {2}", name, ise,
                        StringUtils.join(ise.getErrorCodes(), ",")));
                if (waittime > maxWaitTimeInSeconds) {
                    String msg = String.format("WARNING: Exceeded max wait time in %s.%s..."
                            , name.getEnclosingClass().getName()
                            , name.getEnclosingMethod().getName());
                    LOGGER.warn(msg);
                    System.err.println(msg);
                }
                chill(waittime);
                waittime *= 2;
            }catch(ObjectDoesNotExistException odne) {
                LOGGER.warn(MessageFormat.format("{0} {1}", name, odne));
                return null;
            }
        }
    }
}
 
開發者ID:SurveyMan,項目名稱:Runner,代碼行數:29,代碼來源:MturkResponseManager.java


注:本文中的com.amazonaws.mturk.service.exception.ObjectDoesNotExistException類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。