Dequeue the vm with the largest id first -- this ensures that newly started vms get updated early

This commit is contained in:
Chiradeep Vittal 2011-08-30 22:09:28 -07:00
parent 925f5f2f09
commit d81bc5a375

View File

@ -39,8 +39,8 @@ import com.cloud.network.security.SecurityGroupWork.Step;
public class LocalSecurityGroupWorkQueue implements SecurityGroupWorkQueue {
protected static Logger s_logger = Logger.getLogger(LocalSecurityGroupWorkQueue.class);
protected Set<SecurityGroupWork> _currentWork = new HashSet<SecurityGroupWork>();
//protected Set<SecurityGroupWork> _currentWork = new TreeSet<SecurityGroupWork>();
//protected Set<SecurityGroupWork> _currentWork = new HashSet<SecurityGroupWork>();
protected Set<SecurityGroupWork> _currentWork = new TreeSet<SecurityGroupWork>();
private final ReentrantLock _lock = new ReentrantLock();
private final Condition _notEmpty = _lock.newCondition();
@ -85,7 +85,9 @@ public class LocalSecurityGroupWorkQueue implements SecurityGroupWorkQueue {
@Override
public int compareTo(LocalSecurityGroupWork o) {
return this._instanceId.compareTo(o.getInstanceId());
//return this._instanceId.compareTo(o.getInstanceId());
return o.getInstanceId().compareTo(this.getInstanceId());
}
@Override