Created
July 7, 2019 18:47
-
-
Save snallami/d917ec049e5d80e4206e2ce0cd2ef895 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
If minuphours = 0 , code will be evaluating other rules like idle termination time i.e. as if this option doesn't exist.See below code. It prints "Evaluate other rules" message if minUpHours=0 | |
import java.util.concurrent.TimeUnit; | |
public class MinCheck { | |
public static void main(String[] args) { | |
// Check min number of hours instance must be up - if stayed up at least that minimum. | |
int minUpHours = 0; | |
long uptime = 5 * 60 * 1000; // 5 minutes | |
long minUpHoursInMills = TimeUnit.MILLISECONDS.toHours(minUpHours); | |
if (minUpHoursInMills > uptime) { | |
System.out.println("Do nothing, just return back "); | |
} else { | |
System.out.println("Evaluate other rules"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment