Resubscribe listeners when subscription link breaks.

// FREEBIE
This commit is contained in:
Moxie Marlinspike 2015-03-13 10:56:48 -07:00
parent 2e429c5b35
commit 41d30fc8dc
1 changed files with 13 additions and 0 deletions

View File

@ -64,6 +64,12 @@ public class PubSubManager {
}
}
private synchronized void resubscribeAll() {
for (String serializedAddress : listeners.keySet()) {
baseListener.subscribe(serializedAddress.getBytes());
}
}
private synchronized void waitForSubscription() {
try {
while (!subscribed) {
@ -149,6 +155,13 @@ public class PubSubManager {
subscribed = true;
PubSubManager.this.notifyAll();
}
threaded.execute(new Runnable() {
@Override
public void run() {
resubscribeAll();
}
});
}
}