diff options
| author | eea1 <eea1@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-07-08 22:16:46 +0000 |
|---|---|---|
| committer | eea1 <eea1@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-07-08 22:16:46 +0000 |
| commit | e75e64e6b93800116de5e7da5f16a87006d20b22 (patch) | |
| tree | 44ea3c9fd203fce5d7c12d752fdc75c5cd1b9d01 /java/src/MessageQueue.java | |
| parent | 4c8e64c42a2a50576b94bcdcaab3af11ef69106e (diff) | |
| download | ATCD-e75e64e6b93800116de5e7da5f16a87006d20b22.tar.gz | |
*** NOTE:
Changed the semantics of Condition, TimedWait, MessageQueue,
Task, Mutex, Semaphore, and Token to use absolute times for
their timeouts.
Changed the semantics of EventHandler, ServiceObject, and
SvcHandler such that handleTimeout receives a TimeValue
representing when the event occured.
Changed TimerQueue internally to reflect the above changes.
Also made better checks in Token and Mutex so that non-owners
can call release without adverse effects. I plan to try to
do this with Semaphore and RWMutex as well.
Fixed several bugs in Token tryacquire and renew. Added
relativeTimeOfDay methods to TimeValue.
Diffstat (limited to 'java/src/MessageQueue.java')
| -rw-r--r-- | java/src/MessageQueue.java | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/java/src/MessageQueue.java b/java/src/MessageQueue.java index e25fdc65238..8c8dab1a0fe 100644 --- a/java/src/MessageQueue.java +++ b/java/src/MessageQueue.java @@ -108,10 +108,11 @@ public class MessageQueue return 0; } + // ************ Note! *********** // = For enqueue, enqueueHead, enqueueTail, and dequeueHead if - // timeout is specified, the caller will wait for amount of time in + // timeout is specified, the caller will wait until the *absolute time* // tv. Calls will return, however, when queue is closed, - // deactivated, or if the time specified in tv elapses. + // deactivated, or if it is past the time tv /** * Enqueue a <MessageBlock> into the <MessageQueue> in accordance @@ -130,11 +131,10 @@ public class MessageQueue /** * Enqueue a <MessageBlock> into the <MessageQueue> in accordance * with its <msgPriority> (0 is lowest priority). Note that the - * call will return if <timeout> amount of time expires or if the - * queue has been deactivated. + * call will return if the queue has been deactivated or it is + * later than the specified absolute time value. *@param newItem item to enqueue onto the Message Queue - *@param tv amount of time (TimeValue) to wait before returning - * (unless operation completes before) + *@param tv absolute TimeValue to timeout after *@return -1 on failure, else the number of items still on the * queue. *@exception java.lang.InterruptedException Interrupted while accessing queue @@ -182,11 +182,11 @@ public class MessageQueue /** * Enqueue a <MessageBlock> at the end of the <MessageQueue>. Note - * that the call will return if <timeout> amount of time expires or + * that the call will return when it's later than the given TimeValue or * if the queue has been deactivated. *@param newItem item to enqueue onto the Message Queue - *@param tv amount of time (TimeValue) to wait before returning - * (unless operation completes before) + *@param tv absolute TimeValue to wait until before returning (unless + * the operation compeltes before this time) *@return -1 on failure, else the number of items still on the queue. *@exception java.lang.InterruptedException Interrupted while accessing queue */ @@ -232,12 +232,12 @@ public class MessageQueue } /** - * Enqueue a <MessageBlock> at the head of the <MessageQueue>. Note - * that the call will return if <timeout> amount of time expires or + * Enqueue a <MessageBlock> at the head of the <MessageQueue>. Note + * that the call will return when it's later than the given TimeValue or * if the queue has been deactivated. *@param newItem item to enqueue onto the Message Queue - *@param tv amount of time (TimeValue) to wait before returning - * (unless operation completes before) + *@param tv absolute TimeValue to wait until before returning (unless + * the operation completes before that time) *@return -1 on failure, else the number of items still on the queue. *@exception java.lang.InterruptedException Interrupted while accessing queue */ @@ -284,12 +284,15 @@ public class MessageQueue /** * Dequeue and return the <MessageBlock> at the head of the - * <MessageQueue>. Note that the call will return if <timeout> - * amount of time expires or if the queue has been deactivated. + * <MessageQueue>. Note that the call when return if the queue has + * been deactivated or when the current time is later than the given + * time value. + *@param tv absolute time timeout (blocks indefinitely if null) *@return null on failure, else the <MessageBlock> at the head of queue. *@exception InterruptedException Interrupted while accessing queue */ - public synchronized MessageBlock dequeueHead (TimeValue tv) throws InterruptedException + public synchronized MessageBlock dequeueHead (TimeValue tv) + throws InterruptedException { MessageBlock result = null; if (this.deactivated_) |
