@Test public void testUnregister() throws Exception { assertEquals(0, Receiver1.lostCount); Receiver1 r1 = new Receiver1(); informer.registerWeak(r1); informer.unregister(r1); informer.post(11); assertEquals(0, Receiver1.lostCount); informer.registerStrong(r1); informer.unregister(r1); informer.post(11); assertEquals(0, Receiver1.lostCount); }
public boolean unregister(Object subscriber) { boolean found = (weakInvocations.remove(subscriber) != null); found = found || (strongInvocations.remove(subscriber) != null); return found; }
Informer { public boolean unregister(Object subscriber) { boolean found = (weakInvocations.remove(subscriber) != null); found = found || (strongInvocations.remove(subscriber) != null); return found; } }
Informer { public boolean unregister(Object subscriber) { boolean found = (weakInvocations.remove(subscriber) != null); found = found || (strongInvocations.remove(subscriber) != null); return found; } Informer();  Informer(ExceptionListener listener); }
Informer { public boolean unregister(Object subscriber) { boolean found = (weakInvocations.remove(subscriber) != null); found = found || (strongInvocations.remove(subscriber) != null); return found; } Informer();  Informer(ExceptionListener listener); void post(Object event); void postAfter(final Object event, final long millis); void registerWeak(Object subscriber); void registerStrong(Object subscriber); boolean unregister(Object subscriber); void register(Object subscriber, boolean registerWeak); }
Informer { public boolean unregister(Object subscriber) { boolean found = (weakInvocations.remove(subscriber) != null); found = found || (strongInvocations.remove(subscriber) != null); return found; } Informer();  Informer(ExceptionListener listener); void post(Object event); void postAfter(final Object event, final long millis); void registerWeak(Object subscriber); void registerStrong(Object subscriber); boolean unregister(Object subscriber); void register(Object subscriber, boolean registerWeak);  }