Represents a thread waiting for a connection. More...
This class implements throwaway objects. It is instantiated whenever a thread needs to wait. Instances are not re-used, except if the waiting thread experiences a spurious wakeup and continues to wait.
All methods assume external synchronization on the condition passed to the constructor. Instances of this class do not synchronize access!
The following notice applies to the original API on which this API is based, and to its documentation. The documentation of this API has been revised from the original.
/* * Copyright (C) 2006 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */
Public Member Functions | |
WaitingThread (Condition cond, RouteSpecificPool pool) | |
Creates a new entry for a waiting thread. More... | |
final Condition | getCondition () |
Obtains the condition. More... | |
final RouteSpecificPool | getPool () |
Obtains the pool, if there is one. More... | |
final Thread | getThread () |
Obtains the thread, if there is one. More... | |
boolean | await (Date deadline) throws InterruptedException |
Blocks the calling thread. More... | |
void | wakeup () |
Wakes up the waiting thread. More... | |
WaitingThread | ( | Condition | cond, |
RouteSpecificPool | pool | ||
) |
cond | the condition for which to wait |
pool | the pool on which the thread will be waiting, or null |
final Condition getCondition | ( | ) |
null
final RouteSpecificPool getPool | ( | ) |
null
final Thread getThread | ( | ) |
null
boolean await | ( | Date | deadline | ) | throws InterruptedException |
This method returns when the thread is notified or interrupted, if a timeout occurrs, or if there is a spurious wakeup.
This method assumes external synchronization.
deadline | when to time out, or null for no timeout |
true
if the condition was satisfied, false
in case of a timeout. Typically, a call to wakeup is used to indicate that the condition was satisfied. Since the condition is accessible outside, this cannot be guaranteed though.InterruptedException | if the waiting thread was interrupted |
void wakeup | ( | ) |
This method assumes external synchronization.