List of usage examples for java.util.concurrent CopyOnWriteArraySet remove
public boolean remove(Object o)
From source file:com.devicehive.eventbus.SubscriberRegistry.java
/** * Unregisters subscriber from registry maps: * - gets all subscriber's subscriptions from {@link SubscriberRegistry#subscriberSubscriptions} * - removes subscriber from each subscription's list in {@link SubscriberRegistry#subscriptions} * - removes entry from {@link SubscriberRegistry#subscriberSubscriptions} * * @param subscriber - subscriber// ww w. j a va2 s. c o m */ void unregister(Subscriber subscriber) { CopyOnWriteArraySet<Subscription> subs = subscriberSubscriptions.getOrDefault(subscriber.getId(), new CopyOnWriteArraySet<>()); subs.forEach(s -> { CopyOnWriteArraySet<Subscriber> subscribers = this.subscriptions.get(s); if (subscribers != null) { subscribers.remove(subscriber); } }); }