Class Overview
Helper class that helps you use IBinder objects as reference counted
tokens. IBinders make good tokens because we find out when they are
removed
Summary
[Expand]
Inherited Methods |
From class java.lang.Object
Object
|
clone()
Creates and returns a copy of this Object .
|
boolean
|
equals(Object o)
Compares this instance with the specified object and indicates if they
are equal.
|
void
|
finalize()
Is called before the object's memory is being reclaimed by the VM.
|
final
Class<? extends Object>
|
getClass()
Returns the unique instance of Class which represents this
object's class.
|
int
|
hashCode()
Returns an integer hash code for this object.
|
final
void
|
notify()
Causes a thread which is waiting on this object's monitor (by means of
calling one of the wait() methods) to be woken up.
|
final
void
|
notifyAll()
Causes all threads which are waiting on this object's monitor (by means
of calling one of the wait() methods) to be woken up.
|
String
|
toString()
Returns a string containing a concise, human-readable description of this
object.
|
final
void
|
wait(long millis, int nanos)
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the
specified timeout expires.
|
final
void
|
wait(long millis)
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the
specified timeout expires.
|
final
void
|
wait()
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object.
|
|
Public Constructors
public
TokenWatcher
(Handler h, String tag)
Construct the TokenWatcher
Parameters
h
| A handler to call acquired() and released()
on. If you don't care, just call it like this, although your thread
will have to be a Looper thread.
new TokenWatcher(new Handler()) |
tag
| A debugging tag for this TokenWatcher
|
Public Methods
public
void
acquire
(IBinder token, String tag)
Record that this token has been acquired. When acquire is called, and
the current count is 0, the acquired method is called on the given
handler.
Parameters
token
| An IBinder object. If this token has already been acquired,
no action is taken. |
tag
| A string used by the dump() method for debugging,
to see who has references.
|
public
abstract
void
acquired
()
Called when the number of active tokens goes from 0 to 1.
public
void
cleanup
(IBinder token, boolean unlink)
public
boolean
isAcquired
()
public
void
release
(IBinder token)
public
abstract
void
released
()
Called when the number of active tokens goes from 1 to 0.