public synchronized Integer generateNewManager(){
queueNumber.add(lastNumber);
return lastNumber++;
}
public synchronized Integer fetchServiceNumber(){
//Integer num=0;
if(queueNumber.size()>0){
return (Integer)queueNumber.remove(0);
}else{
return null;
// return num;
}
}
或者把Integer num=0;换成Integer num=null; |