Skip to content
This repository was archived by the owner on Mar 31, 2023. It is now read-only.

Commit 053c9a7

Browse files
authored
Merge pull request #96 from spodila/fixErrorInTaskSchdlrusgFromTaskSchdlrSvc
Fix scheduling service to call internal versions of TaskScheduler
2 parents 1128dbd + 3bbb891 commit 053c9a7

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

fenzo-core/src/main/java/com/netflix/fenzo/TaskScheduler.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -401,8 +401,7 @@ private EvalResult(List<TaskAssignmentResult> assignmentResults, TaskAssignmentR
401401
private final ResAllocsEvaluater resAllocsEvaluator;
402402
private final TaskTracker taskTracker;
403403
private volatile boolean usingSchedulingService = false;
404-
private final IllegalStateException usingSchedSvcExcetption =
405-
new IllegalStateException("Invalid call when using task scheduling service");
404+
private final String usingSchedSvcMesg = "Invalid call when using task scheduling service";
406405

407406
private TaskScheduler(Builder builder) {
408407
if(builder.leaseRejectAction ==null)
@@ -600,7 +599,7 @@ public SchedulingResult scheduleOnce(
600599
List<? extends TaskRequest> requests,
601600
List<VirtualMachineLease> newLeases) throws IllegalStateException {
602601
if (usingSchedulingService)
603-
throw usingSchedSvcExcetption;
602+
throw new IllegalStateException(usingSchedSvcMesg);
604603
final Iterator<? extends TaskRequest> iterator =
605604
requests != null ?
606605
requests.iterator() :
@@ -801,7 +800,7 @@ public EvalResult call() throws Exception {
801800
*/
802801
public Map<String, Map<VMResource, Double[]>> getResourceStatus() throws IllegalStateException {
803802
if (usingSchedulingService)
804-
throw usingSchedSvcExcetption;
803+
throw new IllegalStateException(usingSchedSvcMesg);
805804
return getResourceStatusIntl();
806805
}
807806

@@ -826,7 +825,7 @@ public Map<String, Map<VMResource, Double[]>> getResourceStatus() throws Illegal
826825
*/
827826
public List<VirtualMachineCurrentState> getVmCurrentStates() throws IllegalStateException {
828827
if (usingSchedulingService)
829-
throw usingSchedSvcExcetption;
828+
throw new IllegalStateException(usingSchedSvcMesg);
830829
return getVmCurrentStatesIntl();
831830
}
832831

@@ -942,7 +941,7 @@ public void expireAllLeases() throws IllegalStateException {
942941
*/
943942
public Action2<TaskRequest, String> getTaskAssigner() throws IllegalStateException {
944943
if (usingSchedulingService)
945-
throw usingSchedSvcExcetption;
944+
throw new IllegalStateException(usingSchedSvcMesg);
946945
return getTaskAssignerIntl();
947946
}
948947

fenzo-core/src/main/java/com/netflix/fenzo/TaskSchedulingService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ private void doPendingActions() {
169169
final Action1<Map<String, Map<VMResource, Double[]>>> rsAction = resStatusRequest.poll();
170170
try {
171171
if (rsAction != null)
172-
rsAction.call(taskScheduler.getResourceStatus());
172+
rsAction.call(taskScheduler.getResourceStatusIntl());
173173
} catch (IllegalStateException e) {
174174
logger.warn("Unexpected when trying to get resource status: " + e.getMessage(), e);
175175
}

0 commit comments

Comments
 (0)