I have this piece of code:
void timerCountDown(){
while(RaftNode.getTimeoutVar()){
long x = System.currentTimeMillis();
if(x >= RaftNode.limit){
System.out.println(x);
System.out.println(RaftNode.limit + " THIS SHOULD BE LESS THAN");
System.out.println(System.currentTimeMillis() + " THIS");
System.out.println("TIMED OUT");
raft.RaftNode.setTimeoutVar(false);
nextRandomTimeOut();
raft.RaftNode.onTimeOut();
}
}
}
So basically, this is a time-out function and the time-out is refreshed by another condition. My issue is that the x >= RaftNode.limit condition keeps triggering even though it is false (through the print statements).
My console outputs:
1431532870542
1431532872508 THIS SHOULD BE LESS THAN
1431532870542 THIS
So x is indeed the current time, but even though it is less than the limit, the condition is being triggered.
I have no idea why!
The limit var is
public static long limit;
so nothing fancy here