@@ -20,6 +20,11 @@ public class PingService {
2020 * */
2121 public String apiKey = "" ;
2222
23+ /**
24+ * If `true`, `standby` will always return `false` for debugging purposes!
25+ * */
26+ private boolean debugging = false ;
27+
2328 /**
2429 * The executor service to ping the server
2530 * */
@@ -55,10 +60,21 @@ public PingService(String key, int pingInterval) {
5560 this .interval = pingInterval ;
5661 }
5762
63+ public void setDebugging (boolean debug ) {
64+ this .debugging = debug ;
65+ if (this .debugging == true ) {
66+ PingService .standby = new AtomicBoolean (false );
67+ }
68+ }
69+
70+ public boolean getDebugging () {
71+ return this .debugging ;
72+ }
73+
5874 /**
5975 * Resets the executor services and starts pinging the server
6076 * */
61- public void start () {
77+ public final void start () {
6278 this .executorService = null ;
6379 this .executorService = Executors .newSingleThreadScheduledExecutor ();
6480
@@ -82,6 +98,10 @@ private void secureExecute() {
8298 * @source https://www.mkyong.com/java/how-to-send-http-request-getpost-in-java/
8399 * */
84100 private void execute () throws Throwable {
101+ //don't execute on debug-mode
102+ if (this .debugging == true )
103+ return ;
104+
85105 String url = "https://redunda.erwaysoftware.com/status.json" ;
86106 URL obj = new URL (url );
87107 HttpsURLConnection con = (HttpsURLConnection ) obj .openConnection ();
0 commit comments