@Override public void updateAttempt(TaskAttemptStatus status, long timestamp) { super.updateAttempt(status, timestamp); TaskAttemptId attemptID = status.id; float progress = status.progress; incorporateReading(attemptID, progress, timestamp); } }
@Override public void updateAttempt(TaskAttemptStatus status, long timestamp) { super.updateAttempt(status, timestamp); TaskAttemptId attemptID = status.id; float progress = status.progress; incorporateReading(attemptID, progress, timestamp); } }
@Override public void updateAttempt(TaskAttemptStatus status, long timestamp) { super.updateAttempt(status, timestamp); TaskAttemptId attemptID = status.id; float progress = status.progress; incorporateReading(attemptID, progress, timestamp); } }
private void incorporateReading (TaskAttemptId attemptID, float newProgress, long newTime) { //TODO: Refactor this method, it seems more complicated than necessary. AtomicReference<EstimateVector> vectorRef = estimates.get(attemptID); if (vectorRef == null) { estimates.putIfAbsent(attemptID, new AtomicReference<EstimateVector>(null)); incorporateReading(attemptID, newProgress, newTime); return; } EstimateVector oldVector = vectorRef.get(); if (oldVector == null) { if (vectorRef.compareAndSet(null, new EstimateVector(-1.0, 0.0F, Long.MIN_VALUE))) { return; } incorporateReading(attemptID, newProgress, newTime); return; } while (!vectorRef.compareAndSet (oldVector, oldVector.incorporate(newProgress, newTime))) { oldVector = vectorRef.get(); } }
private void incorporateReading (TaskAttemptId attemptID, float newProgress, long newTime) { //TODO: Refactor this method, it seems more complicated than necessary. AtomicReference<EstimateVector> vectorRef = estimates.get(attemptID); if (vectorRef == null) { estimates.putIfAbsent(attemptID, new AtomicReference<EstimateVector>(null)); incorporateReading(attemptID, newProgress, newTime); return; } EstimateVector oldVector = vectorRef.get(); if (oldVector == null) { if (vectorRef.compareAndSet(null, new EstimateVector(-1.0, 0.0F, Long.MIN_VALUE))) { return; } incorporateReading(attemptID, newProgress, newTime); return; } while (!vectorRef.compareAndSet (oldVector, oldVector.incorporate(newProgress, newTime))) { oldVector = vectorRef.get(); } }
private void incorporateReading (TaskAttemptId attemptID, float newProgress, long newTime) { //TODO: Refactor this method, it seems more complicated than necessary. AtomicReference<EstimateVector> vectorRef = estimates.get(attemptID); if (vectorRef == null) { estimates.putIfAbsent(attemptID, new AtomicReference<EstimateVector>(null)); incorporateReading(attemptID, newProgress, newTime); return; } EstimateVector oldVector = vectorRef.get(); if (oldVector == null) { if (vectorRef.compareAndSet(null, new EstimateVector(-1.0, 0.0F, Long.MIN_VALUE))) { return; } incorporateReading(attemptID, newProgress, newTime); return; } while (!vectorRef.compareAndSet (oldVector, oldVector.incorporate(newProgress, newTime))) { oldVector = vectorRef.get(); } }