You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by te...@apache.org on 2008/09/24 16:19:40 UTC
svn commit: r698583 -
/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Timer.java
Author: tellison
Date: Wed Sep 24 07:19:39 2008
New Revision: 698583
URL: http://svn.apache.org/viewvc?rev=698583&view=rev
Log:
Formatting changes.
Modified:
harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Timer.java
Modified: harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Timer.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Timer.java?rev=698583&r1=698582&r2=698583&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Timer.java (original)
+++ harmony/enhanced/classlib/trunk/modules/luni/src/main/java/java/util/Timer.java Wed Sep 24 07:19:39 2008
@@ -29,15 +29,15 @@
* excessive amount of time to run it may impact the time at which subsequent
* tasks may run.
* <p>
- *
+ *
* The Timer task does not offer any guarantees about the real-time nature of
* scheduling tasks as it's underlying implementation relies on the
* <code>Object.wait(long)</code> method.
* <p>
- *
+ *
* Multiple threads can share a single Timer without the need for their own
* synchronization.
- *
+ *
* @see TimerTask
* @see java.lang.Object#wait(long)
*/
@@ -67,7 +67,7 @@
TimerTask[] appendedTimers = new TimerTask[size * 2];
System.arraycopy(timers, 0, appendedTimers, 0, size);
timers = appendedTimers;
- }
+ }
timers[size++] = task;
upHeap();
}
@@ -109,8 +109,9 @@
}
// compare selected child with parent
- if (timers[current].when < timers[child].when)
+ if (timers[current].when < timers[child].when) {
break;
+ }
// swap the two
TimerTask tmp = timers[current];
@@ -142,10 +143,10 @@
}
}
}
-
+
private int getTask(TimerTask task) {
for (int i = 0; i < timers.length; i++) {
- if (timers[i] == task){
+ if (timers[i] == task) {
return i;
}
}
@@ -154,7 +155,6 @@
}
-
/**
* True if the method cancel() of the Timer was called or the !!!stop()
* method was invoked
@@ -174,7 +174,7 @@
/**
* Starts a new timer.
- *
+ *
* @param isDaemon
*/
TimerImpl(boolean isDaemon) {
@@ -242,7 +242,7 @@
synchronized (task.lock) {
int pos = 0;
- if(tasks.minimum().when != task.when){
+ if (tasks.minimum().when != task.when) {
pos = tasks.getTask(task);
}
if (task.cancelled) {
@@ -329,7 +329,7 @@
/**
* Creates a new Timer which may be specified to be run as a Daemon Thread.
- *
+ *
* @param isDaemon
* true if Timers thread should be a daemon thread.
*/
@@ -346,10 +346,10 @@
/**
* Create a new timer with the given name and daemon status.
- *
+ *
* The name is given the timer's background thread and if the flag is true
* the thread is run as a daemon.
- *
+ *
* @param name
* a name to associate with the timer thread.
* @param isDaemon
@@ -362,10 +362,10 @@
/**
* Create a new timer whose thread has the given name.
- *
+ *
* The name is given the timer's background thread, that is not run as a
* daemon.
- *
+ *
* @param name
* a name to associate with the timer thread.
*/
@@ -384,12 +384,12 @@
/**
* Purging the timer eagerly removes cancelled tasks.
- *
+ *
* When a large number of tasks have been cancelled it may be helpful to
* explicitly purge them from the timer rather than let them be removed
* during normal expiry processing. This is a housekeeping task that does
* not affect the timer's schedule tasks.
- *
+ *
* @return the number of tasks that were purged.
*/
public int purge() {
@@ -401,12 +401,12 @@
/**
* Schedule a task for single execution. If when is less than the current
* time, it will be scheduled to executed as soon as possible.
- *
+ *
* @param task
* The task to schedule
* @param when
* Time of execution
- *
+ *
* @exception IllegalArgumentException
* if when.getTime() < 0
* @exception IllegalStateException
@@ -423,12 +423,12 @@
/**
* Schedule a task for single execution after a specific delay.
- *
+ *
* @param task
* The task to schedule
* @param delay
* Amount of time before execution
- *
+ *
* @exception IllegalArgumentException
* if delay < 0
* @exception IllegalStateException
@@ -444,14 +444,14 @@
/**
* Schedule a task for repeated fix-delay execution after a specific delay.
- *
+ *
* @param task
* The task to schedule
* @param delay
* Amount of time before first execution
* @param period
* Amount of time between subsequent executions
- *
+ *
* @exception IllegalArgumentException
* if delay < 0 or period < 0
* @exception IllegalStateException
@@ -468,14 +468,14 @@
/**
* Schedule a task for repeated fix-delay execution after a specific time
* has been reached.
- *
+ *
* @param task
* The task to schedule
* @param when
* Time of first execution
* @param period
* Amount of time between subsequent executions
- *
+ *
* @exception IllegalArgumentException
* if when.getTime() < 0 or period < 0
* @exception IllegalStateException
@@ -495,14 +495,14 @@
* has been happened. The difference of fixed-rate is that it may bunch up
* subsequent task runs to try to get the task repeating at it's desired
* time.
- *
+ *
* @param task
* The task to schedule
* @param delay
* Amount of time before first execution
* @param period
* Amount of time between subsequent executions
- *
+ *
* @exception IllegalArgumentException
* if delay < 0 or period < 0
* @exception IllegalStateException
@@ -521,14 +521,14 @@
* has been reached. The difference of fixed-rate is that it may bunch up
* subsequent task runs to try to get the task repeating at it's desired
* time.
- *
+ *
* @param task
* The task to schedule
* @param when
* Time of first execution
* @param period
* Amount of time between subsequent executions
- *
+ *
* @exception IllegalArgumentException
* if when.getTime() < 0 or period < 0
* @exception IllegalStateException
@@ -543,13 +543,8 @@
scheduleImpl(task, delay < 0 ? 0 : delay, period, true);
}
- /**
+ /*
* Schedule a task.
- *
- * @param task
- * @param delay
- * @param period
- * @param fixed
*/
private void scheduleImpl(TimerTask task, long delay, long period,
boolean fixed) {