public void resetForRetry() { final ExecutionAttempt pastAttempt = new ExecutionAttempt(this.attempt.get(), this); this.attempt.incrementAndGet(); synchronized (this) { if (this.pastAttempts == null) { this.pastAttempts = new ArrayList<>(); } this.pastAttempts.add(pastAttempt); } this.setStartTime(-1); this.setEndTime(-1); this.setUpdateTime(System.currentTimeMillis()); this.setStatus(Status.READY); this.setKilledBySLA(false); }
private void updatePastAttempts(final List<Object> pastAttemptsList) { if (pastAttemptsList == null) { return; } synchronized (this) { if (this.pastAttempts == null) { this.pastAttempts = new ArrayList<>(); } // We just check size because past attempts don't change if (pastAttemptsList.size() <= this.pastAttempts.size()) { return; } final Object[] pastAttemptArray = pastAttemptsList.toArray(); for (int i = this.pastAttempts.size(); i < pastAttemptArray.length; ++i) { final ExecutionAttempt attempt = ExecutionAttempt.fromObject(pastAttemptArray[i]); this.pastAttempts.add(attempt); } } }
public List<Object> getAttemptObjects() { final ArrayList<Object> array = new ArrayList<>(); for (final ExecutionAttempt attempt : this.pastAttempts) { array.add(attempt.toObject()); } return array; }
new ArrayList<>(this.pastAttempts.size()); for (final ExecutionAttempt attempts : this.pastAttempts) { attemptsList.add(attempts.toObject());
public static ExecutionAttempt fromObject(final Object obj) { final Map<String, Object> map = (Map<String, Object>) obj; final TypedMapWrapper<String, Object> wrapper = new TypedMapWrapper<>(map); final int attempt = wrapper.getInt(ATTEMPT_PARAM); final long startTime = wrapper.getLong(STARTTIME_PARAM); final long endTime = wrapper.getLong(ENDTIME_PARAM); final Status status = Status.valueOf(wrapper.getString(STATUS_PARAM)); return new ExecutionAttempt(attempt, startTime, endTime, status); }
final ArrayList<ExecutionAttempt> attempts = new ArrayList<>(); for (final Object attemptObj : pastAttempts) { final ExecutionAttempt attempt = ExecutionAttempt.fromObject(attemptObj); attempts.add(attempt);
public Map<String, Object> toUpdateObject() { final Map<String, Object> updatedNodeMap = new HashMap<>(); updatedNodeMap.put(ID_PARAM, getId()); updatedNodeMap.put(STATUS_PARAM, getStatus().getNumVal()); updatedNodeMap.put(STARTTIME_PARAM, getStartTime()); updatedNodeMap.put(ENDTIME_PARAM, getEndTime()); updatedNodeMap.put(UPDATETIME_PARAM, getUpdateTime()); updatedNodeMap.put(ATTEMPT_PARAM, getAttempt()); if (getAttempt() > 0) { final ArrayList<Map<String, Object>> pastAttempts = new ArrayList<>(); for (final ExecutionAttempt attempt : getPastAttemptList()) { pastAttempts.add(attempt.toObject()); } updatedNodeMap.put(PASTATTEMPTS_PARAM, pastAttempts); } return updatedNodeMap; }
public void resetForRetry() { ExecutionAttempt pastAttempt = new ExecutionAttempt(attempt, this); attempt++; synchronized (this) { if (pastAttempts == null) { pastAttempts = new ArrayList<ExecutionAttempt>(); } pastAttempts.add(pastAttempt); } this.setStartTime(-1); this.setEndTime(-1); this.setUpdateTime(System.currentTimeMillis()); this.setStatus(Status.READY); }
private void updatePastAttempts(List<Object> pastAttemptsList) { if (pastAttemptsList == null) { return; } synchronized (this) { if (this.pastAttempts == null) { this.pastAttempts = new ArrayList<ExecutionAttempt>(); } // We just check size because past attempts don't change if (pastAttemptsList.size() <= this.pastAttempts.size()) { return; } Object[] pastAttemptArray = pastAttemptsList.toArray(); for (int i = this.pastAttempts.size(); i < pastAttemptArray.length; ++i) { ExecutionAttempt attempt = ExecutionAttempt.fromObject(pastAttemptArray[i]); this.pastAttempts.add(attempt); } } }
public List<Object> getAttemptObjects() { ArrayList<Object> array = new ArrayList<Object>(); for (ExecutionAttempt attempt: pastAttempts) { array.add(attempt.toObject()); } return array; }
public void resetForRetry() { final ExecutionAttempt pastAttempt = new ExecutionAttempt(this.attempt.get(), this); this.attempt.incrementAndGet(); synchronized (this) { if (this.pastAttempts == null) { this.pastAttempts = new ArrayList<>(); } this.pastAttempts.add(pastAttempt); } this.setStartTime(-1); this.setEndTime(-1); this.setUpdateTime(System.currentTimeMillis()); this.setStatus(Status.READY); this.setKilledBySLA(false); }
private void updatePastAttempts(final List<Object> pastAttemptsList) { if (pastAttemptsList == null) { return; } synchronized (this) { if (this.pastAttempts == null) { this.pastAttempts = new ArrayList<>(); } // We just check size because past attempts don't change if (pastAttemptsList.size() <= this.pastAttempts.size()) { return; } final Object[] pastAttemptArray = pastAttemptsList.toArray(); for (int i = this.pastAttempts.size(); i < pastAttemptArray.length; ++i) { final ExecutionAttempt attempt = ExecutionAttempt.fromObject(pastAttemptArray[i]); this.pastAttempts.add(attempt); } } }
public List<Object> getAttemptObjects() { final ArrayList<Object> array = new ArrayList<>(); for (final ExecutionAttempt attempt : this.pastAttempts) { array.add(attempt.toObject()); } return array; }
public static ExecutionAttempt fromObject(final Object obj) { final Map<String, Object> map = (Map<String, Object>) obj; final TypedMapWrapper<String, Object> wrapper = new TypedMapWrapper<>(map); final int attempt = wrapper.getInt(ATTEMPT_PARAM); final long startTime = wrapper.getLong(STARTTIME_PARAM); final long endTime = wrapper.getLong(ENDTIME_PARAM); final Status status = Status.valueOf(wrapper.getString(STATUS_PARAM)); return new ExecutionAttempt(attempt, startTime, endTime, status); }
ArrayList<ExecutionAttempt> attempts = new ArrayList<ExecutionAttempt>(); for (Object attemptObj: pastAttempts) { ExecutionAttempt attempt = ExecutionAttempt.fromObject(attemptObj); attempts.add(attempt);
ArrayList<Object> attemptsList = new ArrayList<Object>(pastAttempts.size()); for (ExecutionAttempt attempts : pastAttempts) { attemptsList.add(attempts.toObject());
public static ExecutionAttempt fromObject(Object obj) { @SuppressWarnings("unchecked") Map<String, Object> map = (Map<String, Object>)obj; TypedMapWrapper<String, Object> wrapper = new TypedMapWrapper<String, Object>(map); int attempt = wrapper.getInt(ATTEMPT_PARAM); long startTime = wrapper.getLong(STARTTIME_PARAM); long endTime = wrapper.getLong(ENDTIME_PARAM); Status status = Status.valueOf(wrapper.getString(STATUS_PARAM)); return new ExecutionAttempt(attempt, startTime, endTime, status); }
final ArrayList<ExecutionAttempt> attempts = new ArrayList<>(); for (final Object attemptObj : pastAttempts) { final ExecutionAttempt attempt = ExecutionAttempt.fromObject(attemptObj); attempts.add(attempt);
new ArrayList<>(this.pastAttempts.size()); for (final ExecutionAttempt attempts : this.pastAttempts) { attemptsList.add(attempts.toObject());
public Map<String, Object> toUpdateObject() { Map<String, Object> updatedNodeMap = new HashMap<String,Object>(); updatedNodeMap.put(ID_PARAM, getId()); updatedNodeMap.put(STATUS_PARAM, getStatus().getNumVal()); updatedNodeMap.put(STARTTIME_PARAM, getStartTime()); updatedNodeMap.put(ENDTIME_PARAM, getEndTime()); updatedNodeMap.put(UPDATETIME_PARAM, getUpdateTime()); updatedNodeMap.put(ATTEMPT_PARAM, getAttempt()); if (getAttempt() > 0) { ArrayList<Map<String,Object>> pastAttempts = new ArrayList<Map<String,Object>>(); for (ExecutionAttempt attempt: getPastAttemptList()) { pastAttempts.add(attempt.toObject()); } updatedNodeMap.put(PASTATTEMPTS_PARAM, pastAttempts); } return updatedNodeMap; }