#1069: Improved patch according to ticket feedback

This commit is contained in:
dev
2015-04-08 17:47:27 +00:00
parent e44fe98c7e
commit 44f8154f07
2 changed files with 6 additions and 14 deletions

View File

@ -30,7 +30,7 @@ public class SimpleScheduler {
/** /**
* If you have a context, use context.simpleScheduler() instead * If you have a context, use context.simpleScheduler() instead
* @deprecated in 0.9.19 * @deprecated in 0.9.20, replaced by SimpleTimer2
*/ */
public static SimpleScheduler getInstance() { public static SimpleScheduler getInstance() {
return I2PAppContext.getGlobalContext().simpleScheduler(); return I2PAppContext.getGlobalContext().simpleScheduler();
@ -47,7 +47,7 @@ public class SimpleScheduler {
/** /**
* To be instantiated by the context. * To be instantiated by the context.
* Others should use context.simpleTimer() instead * Others should use context.simpleTimer() instead
* @deprecated in 0.9.19 * @deprecated in 0.9.20, replaced by SimpleTimer2
*/ */
public SimpleScheduler(I2PAppContext context) { public SimpleScheduler(I2PAppContext context) {
this(context, "SimpleScheduler"); this(context, "SimpleScheduler");
@ -56,7 +56,7 @@ public class SimpleScheduler {
/** /**
* To be instantiated by the context. * To be instantiated by the context.
* Others should use context.simpleTimer() instead * Others should use context.simpleTimer() instead
* @deprecated in 0.9.19 * @deprecated in 0.9.20, replaced by SimpleTimer2
*/ */
private SimpleScheduler(I2PAppContext context, String name) { private SimpleScheduler(I2PAppContext context, String name) {
_log = context.logManager().getLog(SimpleScheduler.class); _log = context.logManager().getLog(SimpleScheduler.class);

View File

@ -151,12 +151,13 @@ public class SimpleTimer2 {
* subsequent executions (unlike SimpleTimer, where the TimedEvent does * subsequent executions (unlike SimpleTimer, where the TimedEvent does
* its own rescheduling). * its own rescheduling).
* *
* @since 0.9.20
* @param delay run the first iteration of this event after delay ms * @param delay run the first iteration of this event after delay ms
* @param timeoutMs run subsequent iterations of this event every timeoutMs ms * @param timeoutMs run subsequent iterations of this event every timeoutMs ms
*/ */
public void addPeriodicEvent(final SimpleTimer.TimedEvent event, final long timeoutMs) { public void addPeriodicEvent(final SimpleTimer.TimedEvent event, final long timeoutMs) {
new PeriodicTimedEvent(SimpleTimer2.getInstance(), timeoutMs) { new PeriodicTimedEvent(SimpleTimer2.getInstance(), timeoutMs, timeoutMs) {
@Override @Override
public void timeReached() { public void timeReached() {
event.timeReached(); event.timeReached();
@ -172,6 +173,7 @@ public class SimpleTimer2 {
* subsequent executions (unlike SimpleTimer, where the TimedEvent does * subsequent executions (unlike SimpleTimer, where the TimedEvent does
* its own rescheduling). * its own rescheduling).
* *
* @since 0.9.20
* @param delay run the first iteration of this event after delay ms * @param delay run the first iteration of this event after delay ms
* @param timeoutMs run subsequent iterations of this event every timeoutMs ms * @param timeoutMs run subsequent iterations of this event every timeoutMs ms
*/ */
@ -467,16 +469,6 @@ public class SimpleTimer2 {
public static abstract class PeriodicTimedEvent extends TimedEvent { public static abstract class PeriodicTimedEvent extends TimedEvent {
private long _timeoutMs; private long _timeoutMs;
/**
* Schedule periodic event
*
* @param timeoutMs run subsequent iterations of this event every timeoutMs ms
*/
public PeriodicTimedEvent(SimpleTimer2 pool, long timeoutMs) {
super(pool, timeoutMs);
_timeoutMs = timeoutMs;
}
/** /**
* Schedule periodic event * Schedule periodic event
* *