4 가지 방법으로 클래스를 만들었습니다. 프린트 문을 삽입 했으므로 제대로 작동하는지 확인할 수있었습니다. 처음 세 개는 아무런 문제가 없습니다. 하지만 네 번째 방법을 부르면 아무것도 인쇄되지 않습니다. 이상하게도 디버거를 시작하고 단계별로 메서드를 이동하면 명령문이 호출되고 출력됩니다. 어떻게 이럴 수있어?인쇄 할 때 호출 할 때 인쇄 메서드가 디버깅 할 때 호출되지 않았습니다.
미리 감사드립니다. 문제
방법 :
public void robin(int counter, int quant, int penalty) {
if(Schedulers.quant==-1) {
Schedulers.quant=quant;
}
while(p!=null && p.getArrival()==counter) {
qrobin.add(p);
if(i.hasNext())
p=i.next();
else {
p=null;
break;
}
}
if(active!=null) {
if(active.getLeftOver()>0 && Schedulers.quant>0) {
active.decreaseLeftOver();
Schedulers.quant--;
System.out.print(active.getPID());
}
else if(active.getLeftOver()>0 && Schedulers.quant==0) {
qrobin.add(active);
active=qrobin.poll();
Schedulers.quant=quant;
Schedulers.quant--;
if(active!=null) {
System.out.print(active.getPID());
active.decreaseLeftOver();
}
else
System.out.print(" ");
}
else {
active=qrobin.poll();
Schedulers.quant=quant;
Schedulers.quant--;
if(active!=null) {
System.out.print(active.getPID());
active.decreaseLeftOver();
}
else
System.out.print(" ");
}
}
else {
active=qrobin.poll();
Schedulers.quant=quant;
Schedulers.quant--;
if(active!=null) {
System.out.print(active.getPID());
active.decreaseLeftOver();
}
else
System.out.print(" ");
}
}
코드를 호출 : 일이에 대한 많은 이유가 있습니다
while(true){
algorithm(algorithm,s,counter);
counter++;
}
코드를 보지 않고도 어떻게하면 우리가 무엇을 말할 것이라고 기대합니까? 수정 구슬을 사용하여? –
문제가 무엇인지 알 수 있도록 코드를 게시해야합니다. – BobbyShaftoe
일부 코드를 게시하십시오. – Naveen