Methods Summary |
---|
private void | doStartPolling()
mStopped = false;
if (mPollingThread == null) {
mPollingThread = new Thread(this, "PollingThread");
mPollingThread.setDaemon(true);
mPollingThread.start();
} else {
synchronized (mLock) {
mLock.notify();
}
}
|
private ImpsAddress[] | getContactLists()
if (mContactLists == null) {
mContactLists = mManager.getAllListAddress();
}
return mContactLists;
|
public void | resetPollingContacts()
synchronized (mLock) {
mContactLists = null;
}
|
public void | run()
while (!mFinished) {
synchronized (mLock) {
if (!mStopped) {
ImpsAddress[] pollingAddress = mPollingAddress;
if (pollingAddress == null) {
// Didn't specify of which contacts the presence will
// poll. Fetch the presence of all contacts in list.
pollingAddress = getContactLists();
}
mManager.fetchPresence(pollingAddress);
}
try {
mLock.wait(mPollingInterval);
} catch (InterruptedException e) {
// ignore
}
}
}
|
public void | shutdownPolling()
mFinished = true;
synchronized (mLock) {
mLock.notify();
}
|
public void | startPolling()
synchronized (mLock) {
// Clear the polling address; the polling thread will fetch the
// presence of all the contacts in lists.
mPollingAddress = null;
}
doStartPolling();
|
public void | startPolling(ImpsUserAddress user)
synchronized (mLock) {
mPollingAddress = new ImpsAddress[] { user };
}
doStartPolling();
|
public void | stopPolling()
mStopped = true;
|