From ecfb3e94c8e5d7fef02cc8904b36f8975d4ae354 Mon Sep 17 00:00:00 2001
From: zzz <zzz@mail.i2p>
Date: Mon, 20 Apr 2015 13:09:48 +0000
Subject: [PATCH] javadoc and debug log tweaks for ST2

---
 core/java/src/net/i2p/util/SimpleTimer2.java | 34 +++++++++++++++++---
 1 file changed, 29 insertions(+), 5 deletions(-)

diff --git a/core/java/src/net/i2p/util/SimpleTimer2.java b/core/java/src/net/i2p/util/SimpleTimer2.java
index 3f54a524b0..ec4f2528db 100644
--- a/core/java/src/net/i2p/util/SimpleTimer2.java
+++ b/core/java/src/net/i2p/util/SimpleTimer2.java
@@ -128,8 +128,12 @@ public class SimpleTimer2 {
     /**
      * Queue up the given event to be fired no sooner than timeoutMs from now.
      *
-     * @param event
-     * @param timeoutMs 
+     * For transition from SimpleScheduler. Uncancellable.
+     * New code should use SimpleTimer2.TimedEvent.
+     *
+     * @param event to be run once
+     * @param timeoutMs run after this delay
+     * @since 0.9.20
      */
     public void addEvent(final SimpleTimer.TimedEvent event, final long timeoutMs) {
         if (event == null)
@@ -140,19 +144,27 @@ public class SimpleTimer2 {
             public void timeReached() {
                 event.timeReached();
             }
+
+            @Override
+            public String toString() {
+                return event.toString();
+            }
         };
     }
     
     /**
      * Schedule periodic event
-     * 
+     *
      * The TimedEvent must not do its own rescheduling.
      * As all Exceptions are caught in run(), these will not prevent
      * subsequent executions (unlike SimpleTimer, where the TimedEvent does
      * its own rescheduling).
      * 
+     * For transition from SimpleScheduler. Uncancellable.
+     * New code should use SimpleTimer2.TimedEvent.
+     * 
      * @since 0.9.20
-     * @param timeoutMs run subsequent iterations of this event every timeoutMs ms
+     * @param timeoutMs run first and subsequent iterations of this event every timeoutMs ms
      */
     public void addPeriodicEvent(final SimpleTimer.TimedEvent event, final long timeoutMs) {
         addPeriodicEvent(event, timeoutMs, timeoutMs);
@@ -166,6 +178,9 @@ public class SimpleTimer2 {
      * subsequent executions (unlike SimpleTimer, where the TimedEvent does
      * its own rescheduling).
      * 
+     * For transition from SimpleScheduler. Uncancellable.
+     * New code should use SimpleTimer2.TimedEvent.
+     * 
      * @since 0.9.20
      * @param delay run the first iteration of this event after delay ms
      * @param timeoutMs run subsequent iterations of this event every timeoutMs ms
@@ -177,6 +192,11 @@ public class SimpleTimer2 {
             public void timeReached() {
                 event.timeReached();
             }
+
+            @Override
+            public String toString() {
+                return event.toString();
+            }
         };        
     }
 
@@ -459,7 +479,11 @@ public class SimpleTimer2 {
             " Queued: " + _executor.getQueue().size();
     }
     
-    public static abstract class PeriodicTimedEvent extends TimedEvent {
+    /**
+     * For transition from SimpleScheduler.
+     * @since 0.9.20
+     */
+    private static abstract class PeriodicTimedEvent extends TimedEvent {
         private long _timeoutMs;
         
         /**
-- 
GitLab